actionscript-embed-ClassLevelEmbedDemo.ax [swf] flex
package { import flash.display.*; import flash.events.*; public class @ax-actionscript-embed-ClassLevelEmbedDemo extends Sprite { public function @ax-actionscript-embed-ClassLevelEmbedDemo () { // Class-level bitmap var photo:actionscript_embed_Photo = new actionscript_embed_Photo(); addChild(photo); // Class-level SVG var svgline:actionscript_embed_SVGLine = new actionscript_embed_SVGLine(); addChild(svgline); // Class-level FP8 .swf symbol var fp8ball:actionscript_embed_FP8Ball = new actionscript_embed_FP8Ball(); addChild(fp8ball); // Class-level binary data (FP9 .swf) var fp9binarydata:actionscript_embed_FP9BinaryData = new actionscript_embed_FP9BinaryData(); var loader:Loader = new Loader(); loader.loadBytes(fp9binarydata); addChild(loader); // Wait for the embedded .swf file to initialize loader.contentLoaderInfo.addEventListener(Event.INIT, initListener); } private function initListener (e:Event):void { // Obtain a reference to the Ball symbol from the embedded .swf file var BallSymbol:Class = Object(e.target.content).loaderInfo.applicationDomain.getDefinition("Ball"); // Make a new instance of the Ball symbol var ball:MovieClip = MovieClip(new BallSymbol()); // Position the Ball instance and place it on screen ball.x = 200; ball.y = 230; addChild(ball); } } }
(C) Æliens 27/08/2009
You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.