-
Modify X,Y Coordinates of an SWF?
If a swf loads multiple swfs that each have multiple layers of content, can the X and Y coordinates of them be modified?
The flies were created at different times so the positioning is different between each file once they play.
-
Senior Member
Are you wanting to change the x, y coords of the loaded swf? or the content within them?
-
the swf, unless its possible to change the coords of all the content at once.
-
Senior Member
Oh yeah, you can do that easily with your loader object.
var xCoord:Number = 0;
var yCoord:Number = 0;
loaderObject.x = xCoord;
loaderObject.y = yCoord;
-
and that goes in each swf?
-
Senior Member
No, what happens is when you load your swf into your main file you have a complete event listener. In that listener is where you would position your completely loaded files.
-
So that makes the swfs load to the x and y of the main?
-
Senior Member
Yes, if you want it at x50 and y50, it would be that of the main.
-
It seems to make no difference, previously I had simply:
Actionscript Code:
myLoader2.x = -155 myLoader2.y = -355
But I guess the problem lies in the individual SWFs.
My main and SWF1 are aligned with this, but SWF2,3,4,5 and 6 are another 30 down the Y axis. Do you have any advice?
-
Senior Member
Could you attach source? Seems there is some factor here acting wierd.
-
yea of course, how I attach source? You want the menu or an individual swf?
-
My code is very simple, this is all have on the menu
Actionscript Code:
import flash.display.Loader; import flash.net.URLRequest; import flash.events.MouseEvent; import flash.events.Event; import flash.events.ProgressEvent; import flash.text.TextField;
var myLoader:Loader = new Loader(); var myLoader2:Loader = new Loader();
function buttonClick(event:MouseEvent):void { //trace("target name: "+event.target.name); myLoader.load(new URLRequest(event.target.name + ".swf")); myLoader.x = -155 myLoader.y = -355 addChild(myLoader); }
myLoader.contentLoaderInfo.addEventListener(Event.OPEN,showPreloader); myLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,showProgress); myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,showLoadResult);
var loadProgress_txt:TextField = new TextField();
function showPreloader(evt:Event):void { addChild(loadProgress_txt); }
function showProgress(evt:ProgressEvent):void { loadProgress_txt.text = "loaded:"+evt.bytesLoaded+" from "+evt.bytesTotal; }
function showLoadResult(evt:Event):void { removeChild(loadProgress_txt); addChild(myLoader); }
1.addEventListener(MouseEvent.CLICK, buttonClick); 2.addEventListener(MouseEvent.CLICK, buttonClick); 3.addEventListener(MouseEvent.CLICK, buttonClick); 4.addEventListener(MouseEvent.CLICK, buttonClick); 5.addEventListener(MouseEvent.CLICK, buttonClick); 6.addEventListener(MouseEvent.CLICK, buttonClick);
-
Does anyone have any suggestions?
-
How do I set defferent x, y values for the different swfs?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|