Guys, I am thoroughly surprised that there is no Flash Hidden Features post yet in the Hidden Features series that I've been tracking for a while now.
There is a recent AS3/Flex one but it's not very active and I don't exactly mean just AS3 when I say Flash here.
The Hidden Features series is great for people who are new to a certain language. It shows the ropes and certain valuable tricks, all in one place. I think it's a brilliant idea. Even experts sometimes find tricks they'd never heard about.
When I started with Flash, I was taken aback by the Flash IDE and odd concepts of Flash, compared to other programming languages.
So, here goes: what are some hidden features of Flash as a language (AS2/3) and the Flash IDE?
Let the fun begin.
Not exactly hidden, but what about the often overlooked "include" macro (yes, it still exists in as3)? - very useful for faking multiple inheritance (when used side by side with an interface), even if it usually is a bad practice.
You can create weak references in ActionScript3 by using the Dictionary object.
[AS3]
When you use the trace statement in AS3 you can pass in multiple parameters and AS3 will format the output so that there is a space between each.
would output "Hello World".
AS2 does not support multiple parameters for trace so you are forced to do something like
[Flash IDE]
When you export a MovieClip as a swc you can add it to the components panel of by dropping it into the folder
C:\Documents and Settings\USER_NAME\Local Settings\Application Data\Adobe\Flash CS3\en\Configuration\Components\SOME_COMPONENT_FOLDER
Restart flash and it'll be in the components panel for you to use.
Custom metadata isn't something that's well documented or promoted, but it's very helpful - without modifying a variable or changing its namespace, you can give it custom annotations similar to the way that you can in Java.
It is gone over in depth by Christophe Conraets on his blog.
The simplicity of it is that you can put all of your own metadata, and then you just use
describeType()
and you will see all of your custom metadata at run time :)For those of you using FlashDevelop, there is some nifty conditional compilation functionality:
read more about it here