Sourcebits Body Background abt-left abt-rgt ser-left ser-rgt service-grid service-top service-mid portfolio-left portfolio-right selection menu-icons arrow tab_menu top-menu left-menu about-menu content-body content-top content-bottom

Sourcebits Blog

Back

ActionScript 3 Tips – part I

2Oct

This will be an updated post on ActionScript 3 tips.

1. How do I remove all the children from a DisplayObject (MovieClip etc)?

while (my_mc.numChildren) {
my_mc.removeChildAt(0);
}

2. How do I instantiate a class dynamicall?

import flash.utils.getDefinitionByName;

var cs:String = ‘Part_’+i;
var DynamicClass:Class = flash.utils.getDefinitionByName(cs) as Class;
var tc:* = new DynamicClass();

3. How do I create a mirror image of a MovieClip?

my_mc.scaleX = -1; // mirror image
my_mc.scaleX = 1; // back to normal

Posted by staff in Code,Web. 0 Comments

Leave a Reply

You must be logged in to post a comment.

About Us

About Us

Sourcebits is a Macintosh, iPhone, Android and Web development company. Our efforts on the Mac are focused on researching and developing innovative and engaging applications that are new in the market or something we believe can be done in a better way. On iPhone and Android we are among the industry front runners and are among the first to develop applications for the platform. On the Web front, we develop world class quality web sites and web applications by considering the latest development trends and techniques, ensuring nothing is outdated.

Contact Us

Contact Us

Sourcebits develops outstanding services and applications for iPhone, iPad, Blackberry, Android, Mac and the Web. Our 200+ strong team of dedicated programmers and graphics designers spend their days building intelligent, easy to use applications leaving you free to focus on your next project. Contact Sourcebits today.