HTML and CSS in Flash

May 2nd, 2009

I have just uploaded my slides on HTML and CSS in Flash from the last A-SFUG meeting

I hope you find it useful.

Structure Creator

April 20th, 2009
Structure Creator

Structure Creator extension for Flash is now available.  Fixed issue with class path.

Get it from Google Code

I'd appreciate your feedback. Thanks.

April A-SFUG Meeting – Sound, Loading & CSS

April 13th, 2009

The next meeting for A-SFUG is coming up on Saturday April 25th, 11am at the Ogilvy Centre, Singapore.

This round Shang will be talking about the use of sound in Flash, including using the equalizer. After that, Danny will give an overview of loading in Flash with as3. Ed will end the session with a talk about the use of CSS in Flash, and a tip & trick. Following that will be a free discussion and some Q&A.


11:00-11:15: Welcome message
11:15-11:45: Sound in Flash by Shang
11:45-12:15: Loading in Flash by Danny
12:15-12:45: CSS in Flash by Ed
12-45-1:00: Free Discussion and Q&A


35 Robinson Road, #03-01 the Ogilvy Centre, Singapore

Please come along and share your thoughts, ideas, and questions.

Please RSVP via Facebook

Hope to see you all there,

Structure Creator 1.1.6 Out Now!

March 26th, 2009
Structure Creator

Structure Creator 1.1.6 extension for Flash is now available. It will now save your last used schema, width, height and frame rate.

Get it from Google Code

I'd appreciate your feedback. Thanks.

Use SharedObject to save data on users computer

March 24th, 2009

By using SharedObject you are able to store limited amounts of data on a user's computer. It's works in the same kind of way that your browser stores cookies. However there are some limitations with using this. Sometimes swf files may not be able to write the data, and the data can sometimes be deleted without your knowledge. Users can set their own limits on how much space flash player can use on their computer. When they lower the amount of disk space available, some local shared objects might get removed.

I'll show you a basic example of using SharedObject. We will have an input text field on stage and a button that will save the text in the text field.

Create a new AS3 Document and put a text field on stage and give it an instance name. I will call mine theText_txt.
Next make a button on stage and give it an instance name. I called mine save_btn.

Create a new layer in the main timeline and call it actions and lock it. Open up the actions panel and enter the following:

  1. var mySO:SharedObject;
  2. mySO = SharedObject.getLocal("myfirstSO");

The first line creates the shared object. The second line gets a local shared object called myfirstSO. Nothing is stored in it at the moment but we will assign data to it shortly.

Now when we click the button we want to assign whatever text is in the text field to the shared object. In the actions panel enter:

  1. save_btn.addEventListener(MouseEvent.CLICK, saveText);
  3. function saveText(e:MouseEvent):void
  4. {
  5. = theText_txt.text;
  6. }

This has now assigned the text in the text field to a variable called myText in the SharedObject.

OK now that the text is saved we will want to populate the text field with that saved data when you open the swf again. In the actions panel enter the following.

  1. if (
  2. {
  3. theText_txt.text =;
  4. }

This checks to see if there is any data in the myText variable in the SharedObject. If there is then it assigns that value to the text field.

Now test the movie. Enter some text in the text field and click your save button. Close the swf and test the movie again. You will see that the text you entered before is in the text field.

You can download the example here:

Hope this was helpful,

Instance names and code hinting – Tips & Tricks

March 2nd, 2009

code_hintingWhen coding in actionscript sometimes it can be a pain that you don't get code hinting with objects that are on stage. A good way of overcoming this is to change the instance names of your objects (Movie Clips, Buttons, etc.) to have an underscore "_" then the abbreviated name of that object at the end of the name.

For example, you may have a movie clip on stage called myMovieClip. Change the instance name to have an _mc at the end (myMovieClip_mc), and now in your actions panel type myMovieClip_mc and press period. You will now see all the code hinting for a movie clip popup (see image). This can save a whole heap of time when coding.

Here is a list of the different shortcuts that you can use to bring up the code hinting. Some of these are for AS2 but the rest will work with AS3.

Object type Variable suffix
Array _array
Button _btn
Camera _cam
Color _color
ContextMenu _cm
ContextMenuItem _cmi
Date _date
Error _err
LoadVars _lv
LocalConnection _lc
Microphone _mic
MovieClip _mc
MovieClipLoader _mcl
PrintJob _pj
NetConnection _nc
NetStream _ns
SharedObject _so
Sound _sound
String _str
TextField _txt
TextFormat _fmt
Video _video
XML _xml
XMLNode _xmlnode
XMLSocket _xmlsocket

I find that using this technique saves me a whole heap of time when programming.

Make a button from a MovieClip – Tips & Tricks

February 24th, 2009

movieclipbtnIn the first meeting of A-SFUG I showed a tip about creating the up, over and down states of a button using a movie clip. I thought that I should put it up here as a reference.

An easy way of creating a button from a movie clip is to give the names of the frames with the different states of the button "_up", "_over" and "_down".

Add a stop(); frame on frame 1 of the movie clip. Then out on the main timeline, open the actions panel and write:

myButton_btn.buttonMode = true;

Just change myButton_btn to the instance name of your movieclip.

Now test the movie and roll over the button and It will now go to the over state. Press down on it and it will go to the down state.

So you do not need to write the code for on roll over, on mouse down and on roll out. Flash will automatically detect what you are wanting to do and do it for you.

Now you may be asking "Why should I do it this way? Why can't I just make it as a regular button?" Well you can still do it that way if you like, however the benefit of doing it this way is that a movie clip is more light weight then a button. This means that flash can run a bit faster.


Forget 25 lines. Try 140 Characters

February 19th, 2009

A while ago I talked about the 25 lines competition which is a contest to see who can make the most spectacular thing with only 25 lines of code. Today Grant Skinner has announced on his blog a competition called #tweetcoding. Basically the contest is to create the coolest thing you can in AS3, with  only using 140 characters of code. If you enter you stand to win a copy of Flash CS4!

Details can be found here:

Structure Creator 1.1.5

February 2nd, 2009
Structure Creator

Structure Creator 1.1.5 extension for Flash is now available. The Mac folder issue has now been fixed.

Get it from Google Code

I would like to have some feedback to see if people actually like it, how i could make it better etc. Please leave a comment or contact me via email.

Structure Creator 1.1.4

January 20th, 2009
Structure Creator

I have updated the Structure Creator extension for Flash on Google code. Now at version 1.1.4.
Now included the new SWFAddress 2.2 and allows for custom FLA names as well as a few minor bug fixes.

Get it at Google Code