Highlighted

Action script in external swf !!!

New Here ,
Feb 09, 2015

Copy link to clipboard

Copied

Hi my friends.

I have designed main swf to load external swf for android by Adobe Flash and Adobe Air.

All thing is OK in PC and Adobe Air simulator, in android phone: external swf is loaded But it‘s action script isn’t run! (External script isn’t run)

(Tested at Android 4.3)

var mw:Number = stage.stageWidth;

var mh:Number = stage.stageHeight;  

var loader:Loader=new Loader();

var swfExternal:MovieClip;

function gotoswf(url:String):void {

                loader.unload();

                var contextswf:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);

                contextswf.checkPolicyFile = false;

                contextswf.allowCodeImport = true;

                loader.load(new URLRequest(url),contextswf);

                loader.contentLoaderInfo.addEventListener(Event.COMPLETE, runswf); 

}

function runswf(event:Event):void

{

                var info:LoaderInfo = LoaderInfo(loader.contentLoaderInfo);

                this.frameRate=info.frameRate;

                var fw:Number = (stage.stageWidth-80) / loader.width;

                var fh:Number = (stage.stageHeight) / loader.height;

                var ratio:Number = (fw < fh) ? fw : fh;

                loader. width *= ratio;

                loader.height *= ratio;

                trace(fw+" "+fh+" "+ratio);

                holder_ob.y=((stage.stageHeight-1)-(loader.height))/2;

                holder_ob.x=80;

                holder_ob.w=loader.width;

                holder_ob.h=loader.height;

                //swfExternal=loader.content as MovieClip;

                 holder_ob.addChild(loader);

                //MovieClip(root).addChild(externalSWF);

               

}

TOPICS
Development

Views

198

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Action script in external swf !!!

New Here ,
Feb 09, 2015

Copy link to clipboard

Copied

Hi my friends.

I have designed main swf to load external swf for android by Adobe Flash and Adobe Air.

All thing is OK in PC and Adobe Air simulator, in android phone: external swf is loaded But it‘s action script isn’t run! (External script isn’t run)

(Tested at Android 4.3)

var mw:Number = stage.stageWidth;

var mh:Number = stage.stageHeight;  

var loader:Loader=new Loader();

var swfExternal:MovieClip;

function gotoswf(url:String):void {

                loader.unload();

                var contextswf:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);

                contextswf.checkPolicyFile = false;

                contextswf.allowCodeImport = true;

                loader.load(new URLRequest(url),contextswf);

                loader.contentLoaderInfo.addEventListener(Event.COMPLETE, runswf); 

}

function runswf(event:Event):void

{

                var info:LoaderInfo = LoaderInfo(loader.contentLoaderInfo);

                this.frameRate=info.frameRate;

                var fw:Number = (stage.stageWidth-80) / loader.width;

                var fh:Number = (stage.stageHeight) / loader.height;

                var ratio:Number = (fw < fh) ? fw : fh;

                loader. width *= ratio;

                loader.height *= ratio;

                trace(fw+" "+fh+" "+ratio);

                holder_ob.y=((stage.stageHeight-1)-(loader.height))/2;

                holder_ob.x=80;

                holder_ob.w=loader.width;

                holder_ob.h=loader.height;

                //swfExternal=loader.content as MovieClip;

                 holder_ob.addChild(loader);

                //MovieClip(root).addChild(externalSWF);

               

}

TOPICS
Development

Views

199

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Feb 09, 2015 0

Have something to add?

Join the conversation