Archive for November, 2009

3 ways to reduce redundant code in your adobe flash actionscript 3 projects

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.

Clearer adobe actionscript AS3 code by using objects as function parameters

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 »

Adobe flash actionscript as3 mask movieclips with gradient alpha masks

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 »

Flash textfields styling with CSS line-height

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;
}

One Gmail address is many

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.