Posted in as3 on November 24th, 2009 by admin – Be the first to comment
There is 3 great ways to reduce redundant code in your actionscript 3 projects:
1) Aggregation
If objects A and B has same function, why not put that function on a separate object C and let both other objects call it from there.
2) Composition ie. inheritance
Put your redundant code to a class C and let your objects A and B inherit those methods from there.
3) Last but not least: include -statement
Sometimes good old include -statement is best way to go. Just put your code on separate file and include it where ever it’s needed. Quick, dirty and powerfull!
Included code doesn’t even have to be full class or function, but any usefull bit of code will do.
Posted in as3 on November 22nd, 2009 by admin – Be the first to comment
Classical implementation of a Adobe flash actionscript function could be something like this:
function doSquareThing(x,y,width,height,fillcolor,bordercolor,callback){
//Do something with the parameters
}
doSquareThing(10,20,15,15,#cccccc,#000000,squareReady);
Everytime you call the function you have to remember what order the parameters should be. If somebody else is reading the code he/she can’t know what the parameters are without seeing documentation or function definition.
Better way to do the same thing is read more »
Posted in as3 on November 22nd, 2009 by admin – Be the first to comment
With actionscript as3 you can ad a mask to a display object ie. movieclip with simple line of code.
mc_to_be_masked.mask = masking_mc;
But this will usually ignore any alpha gradients you might have in your masking movie clip.
To make the masking work properly, you have to read more »
Posted in as3 on November 22nd, 2009 by admin – Be the first to comment
Flash textfields doesn’t support css line-height property. But they do support property “leading”. Default value for leading is 0.
So for smaller line-height between lines of textfield you have to set leading on a css -style to negative values and vice versa for bigger line-height.
Something like this for decreased line-height:
.mystyle{
leading:-2px;
}
Posted in gmail on November 14th, 2009 by admin – Be the first to comment
If you have Gmail account you actually have several working email addresses. Gmail ignores . -charaters on emails addresses, so everyone of these email addresses will be directed to the same Gmail account:
forename.surename@gmail.com
forenamesurename@gmail.com
f.o.r.e.n.a.m.e.surename@gmail.com
f.o.r.e.n.a.m.e.s.u.r.e.n.a.m.e@gmail.com
Next time you will need a new email address, for example to register to same service twice, look no further than your gmail account.
Posted in as3 on September 15th, 2009 by admin – Be the first to comment
Actionscript 3 doesn’t have build-in global variables. Globals are however easy to implement with just one small class with a public static object. Just three easy steps. read more »
Posted in as3 on September 14th, 2009 by admin – Be the first to comment
After you have setup main class for your flash project, and perhaps put it in to a package, you can start writing code for your application.
Calling timeline from main class
read more »
Posted in as3 on September 13th, 2009 by admin – Be the first to comment
Many people, when starting with flash actionscript 3 developement, first save all the class files to the same folder as the main Flash file (.fla). It works allright when applications are small and you don’t have to share them with anybody.
However, there is a better way to organise your code, that’s called packages ( That’s a fancy object oriented name for subfolders) read more »
Posted in as3 on September 13th, 2009 by admin – Be the first to comment
Adobe Actionscript 3 based flash project (with flash IDE) has a bit different file structure, than traditional Adobe flash project. Every as3 flash application has a main class where the hole application starts. read more »