kolnedra . com | Tags | Posts tagged with 'snippet'

Posts tagged with 'snippet'

Executing command line commands through AS3 and JSFL

Date: 10 March 2010

During the creation of a Flash CS4 Codebase panel I found myself struggling around a simple feature in this panel: Opening a folder in the local file system.
This might look like an easy task, but unfortuantely I couldn't find anything close to what I was aiming for in the Flash CS4 Resource.
So I started another google quest for a satisfying answer and luckally for me (and you) I found a simple solution using the FLfile.runCommandLine method

// Windows approach
MMExecute('FLfile.runCommandLine("cmd /C explorer C:\\folder\\to\\open\\");');

// OSX
MMExecute('FLfile.runCommandLine("exec /Path/to/folder");');
The /C means: Carries out the command specified by string and then terminates.
And don't forget the double backslashes for the Windows example

15 Useful AS3 code snippets

Date: 25 February 2010

A collection of self-made functions (aka snippets) to speed things up.

1. Check if an e-mail is valid
2. First character in uppercase
3. Random number
4. Shuffle an array
5. Does an element exist in an array
6. Remove an element from an array
7. The AS2 setRGB method
8. Reverse timeline animation
9. Get the file extension
10. Filesize
11. Hexadecimal to RGB object
12. Color to monochrome color
13. Crop a bitmap
14. Forces to run the garbage collection
15. Local to global position



Read more ...