FORUMS: list search recent posts

load swf file at (X,Y) position AS3

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Eyla Eyla
load swf file at (X,Y) position AS3
on Feb 12, 2011 at 6:00:47 am

Greeting,
I have the listed code to load swf file to the stage using action script 3 and I want to modify it to place the swf in (X,Y) place.

what I should add to the code to have the swf file placed in the specify position.

Thank you,

var swfLoader:Loader = new Loader();

stage.addChild(swfLoader);

var bgURL:URLRequest = new URLRequest("test.swf");

swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadProdComplete);

swfLoader.load(bgURL);

function loadProdComplete(e:Event):void {

trace("file loaded");

}


Return to posts index


demetri tashie
Re: load swf file at (X,Y) position AS3
on Feb 12, 2011 at 11:08:23 pm

call the position of the loader after it is added as a child like this:

var swfLoader:Loader = new Loader();

stage.addChild(swfLoader);
<b>swfLoader.x=200; // use your X position here
swfLoader.y=150; // use your Y position here</b>

var bgURL:URLRequest = new URLRequest("test.swf");

swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadProdComplete);

swfLoader.load(bgURL);

function loadProdComplete(e:Event):void {

trace("file loaded");

}


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]