Quick Tip: AS3 Function parameters…..

In old AS1 / AS2 you could get away with not passing all the parameters to a function, AS3 on the other hand has none of it.

But what you can do is asssign default values for each parameter so you don’t need to pass a value it.


function hideObject(child:DisplayObject,fadeOut:Boolean=false):void
      //fadeout Tweener code
   } else {
      child.visible = false;

hideObject(target);//would instantly hide target
hideObject(target , true);//would override default value and so fade

Leave a Reply

Your email address will not be published. Required fields are marked *