Flash has some features to make coding easier. Some of the features include code collapse, code hinting, and commenting buttons. One of the other features is auto format which is extremely satisfying if your copy and pasting and your tabbing gets crazy.
If your code has no syntax errors auto format will indent it properly, add spaces and put your curly braces where you would like them to be. For even more control over auto format, you can change how it auto formats under preferences. Go to Flash > Preferences > Auto Format. There you can check off the auto format behaviors that best suit you.
There is one caveat to using auto format that could drive you to near madness if you can not prepared for it’s evil. It could add a line termination “;” to the class definition line. I’ve had it happen several times and I don’t know what makes it happen. I was unable to replicate it in a test. If it happens it will give you a 1084 error code in the Compiler window. It’s easily resolved, but it happened more than a few times to me, so I’d rather just be careful and use the tab key.
There are 2 classes that deal with color. There is the appropriately named Color class and the ColorTransform class. Color is a subclass of the ColorTransform class. The Color class adds a few more features to the ColorTransform class such as control over brightness and tint.
A new instance of the ColorTransform accepts a lot of parameters. There is redMultiplier, redOffset, greenMultiplier, greenOffset, blueMultiplier, blueOffset, alphaMultiplier and alphaOffset. Personally, I find these values very counterintuitive. Give me good old HSB any day. All these crazy, meaningless numbers are additive, which means they are appended to the target’s current color value. If you have an exact color value in mind you can circumvent trying to figure out how to use all this stuff with the color property. The color property can be used with the Color class and the ColorTransform class. Below are simple examples of the usage of this. Read more …
To make a custom right click menu, you will need to use 3 classes. First, use the ContextMenuItem class to make new contextual menu items. Then, make an empty context menu with the ContextMenu class. Lastly those contextual menu items need to be passed to the Array class.
Create a new variable and data type it to ContextMenuItem. Make as many new contextual menu item vars as you want. The new ContextMenuItem takes 4 parameters. The first is a string, written in quotes. This is the text that will appear in the menu. The rest of the parameters are determined by Booleans, true or false. The next parameter is separator before. False means no separator, true means include one. Then the next is enabled. Default is true or enabled, this parameter is optional. Last parameter is visible, default is true. Read more …
I am an Actionscript beginner. I am a novice, a noob if you will. This is all true, but I am going to write about Actionscript anyway. Why you ask? Why would you write about something you are not an authority on? The reason that I am starting this documentation early is for posterity. I want to see my progression from an Actionscript beginner to an Actionscript badass. Notice I didn’t say guru. I am not peddling holistic Tibetan Goji Berries. Badass is the appropriate term. Which is what I would like to be one day.
I am not a total novice. I have background in Web 1.0. I even got the Web 1.0.3 update. Before Actionscript 3.0, I even put together some Flash sites with AS2. Those successes were generally what I would call copy and paste programming. I could find something that someone made close to what I wanted to do and then tweak the code a bit to get it to work. The logic of programming escaped me, but the sites got done and no one got wise to my programmatic fumbling. Read more …