Saturday, December 5, 2009

Browse Load Read Local Files in Flex SWF

Thanks to the New Super cool features introduced with Adobe Flash Player 10, you can now Browse, Load and Read Local Files in your Computer from a Shockwave File.

Browse works just like the normal "File Dialog" in your Windows system. You can Select any file from your PC or Laptop, Load and Open it.

Try the SWF below - created in Flex. You can try and select virtually all types of fles. However, only readbale files (like ".txt", ".htm", ".js") will produce meaningful character display. Others (".exe", "dll" etc.) will produce hex dump.

Have Fun.

FlexBrowse_v2.swf

Saturday, November 21, 2009

Control Adjust Flash Player Window Size

When you create Shockwave File (SWF) in Adobe Flash (say in version CS4) and play it in Flash Player in non-bowser mode, the Player Window Size gets automatically adjusted to the values specified by the Stage Width and Height parameters in your flash file.

Take a look at the following two SWFs created in Flash CS4. They are the same Tinting Flash files - only difference being the Stage Width value. The first one has width value 250 while the second one 435, height being 292 for both.

The first one simply Crops the image but there is no scroll bar.





However, things are little different when you create SWF using Flex. If you create say the Line Chart in Flex Builder 3 and play it in Flash Player, it does not fit automatically in the Window and you get a Scroll Bar. The user needs to drag the Player Window or make it full screen to have a full view.



To Control and Adjust Flash Player Window Size so that it fits nice and fine with your application, all you need to do is to define Width and Height values of your application at the very beginning of your MXML code.

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="top" horizontalAlign="center" backgroundGradientColors="[0x000000,0x323232]" width="650" height="265">


Friday, October 23, 2009

Access Local File System with Flex SWF

Yes, you can access Local File System in Flex and that too with a standard SWF without resorting to Adobe Air.

Click the link below.

AccessTextFile.zip

You will find one SWF in a Zip. Download, Extract and Play the SWF from anywhere in your system. It's designed to read Text Files (including .htm files) that show up in a Text Editor. However, so far as the file access part is concerned, you can try virtually any file anywhere in your local system like the PDF or EXE - but the display will just be some nonsense dump.

All you need to do to access text files or any file for that matter is to key in the file name with full path and hit the button "Go".

It’s fitted with error handler. So it will not throw up the nasty dump in your flash player if you get the file path or file name wrong.

There's lot of buzz around sandbox security and Access to Local File System in Flex. So this is just a dig to check out what all an SWF can do.

Do let me know if you find any problem. Appreciate your comments if you find it of any interest to you.

Saturday, October 3, 2009

Import Insert Read - Text File to Flex TextArea

Now you can easily Import/Insert/Read any Text File contents to Flex TextArea and Display it with each and every line indentation in place.

With this, you can import Text File (even .htm content) seamlessly into Flex TextArea if the file is viewable in Notepad. It really works for any text file [.txt, .htm, .xml, .as, .js or any other that you may have]

Typically, this is a standard SWF file that gets generated as you compile the code in Flex 3 SDK. You can freely download the complete mxml code at
Download ReadTextFile.zip

Do let me know if you find any problem.

You can even use \\ to point to text file location. Example: C:\\WINDOWS\\system32\\oobe\\iconnect.js'. However, to do this, you have to add "-use-network=false" to Flex Compiler additional arguments before compilation.

Hope you find it useful. Code image is down below.

Ciao

Friday, October 2, 2009

Digging Flex for All

I have always been fascinated by Graphics.

No Wonder I like Adobe Flex, Flash and Actionscript which unleashes the power of Rich Internet Application [RIA] to the modern World Web Space. However till date, it’s mostly confined to developers’ community.

At “Flex For All”, the effort is focused onto releasing the awesome power of Flex and RIA to Non-Techies and right to their Desktop ... and why not?

At Flex Canvas, something is cooking up for all Computer Users across the world. Expect something new for All in weeks to come. And I want to keep it “Shockingly Simple”.

Ciao