/ Published in: ActionScript 3
Expand |
Embed | Plain Text
// This is for creating a duplicate of a stage object that exists in the FLA library at compile time // The object must have a 'Export for Actionscript ticked in it's properties panel and a valid class name in the 'Class' box // If the symbol only has a single frame just add another so it registers as MovieClip() rather than Sprite() private function cloneObject(source:DisplayObject):void { var objectClass:Class = Object(source).constructor; var instance:MovieClip = new objectClass() as MovieClip; instance.transform = source.transform; instance.filters = source.filters; instance.cacheAsBitmap = source.cacheAsBitmap; instance.opaqueBackground = source.opaqueBackground; source.parent.addChild(instance); instance.x += 20; // just to show the duplicate exists! }
You need to login to post a comment.
