|
-
Loading External swf Issue
Hi There,
I am trying to load an external swf (Banner Rotator) to an existing swf (website).
My problem is that the banner rotator I am trying to add totally changes the display of my site which I had coded to resize to browsers and remain central.
Here is the live website before I have added the Banner Rotator:
www.samuelkarlbohn.com
and this is what happens to it after I add the code:
my website
This is the code I used to load the external swf, it is within a an MC within an MC on the stage:
Code:
var my_loader:Loader = new Loader();
my_loader.load(new URLRequest("PowerRotator.swf"));
addChild(my_loader);
As you can see, the site is centred, and fits to browser window using this code: in the 3rd frame of the main .fla:
Code:
stop();
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
var swfWidth:int = myStage.stageWidth;
var swfHeight:int = myStage.stageHeight;
var myStage:Stage = this.stage;
myStage.scaleMode = StageScaleMode.NO_SCALE;
myStage.align = StageAlign.TOP_LEFT;
var main_mcYPos:Number = swfHeight - main_mc.height;
var main_mcXPos:Number = swfWidth - main_mc.width;
main_mc.y = main_mcYPos / 2;
main_mc.x = main_mcXPos / 2;
function resizeDisplay(event:Event):void {
var swfWidth:int = myStage.stageWidth;
var swfHeight:int = myStage.stageHeight;
var menu2YPos:Number = swfHeight - menu2.height;
var main_mcYPos:Number = swfHeight - main_mc.height;
var main_mcXPos:Number = swfWidth - main_mc.width;
var tweenMenu2Y:Tween = new Tween(menu2, "y", Elastic.easeOut, menu2.y, menu2YPos, 1.2, true);
}
myStage.addEventListener(Event.RESIZE, resizeDisplay);
The banner rotator is XML based, and has a folder called classes containing:
Banner, Main Application and a com folder containing some .as files for motion/dynamics. If this is of any relevance.
I am utterly confused as to how to sort this out, and am getting very close to my deadline (2 days away!).
Any help is greatly appreciated!
Many Thanks in advance,
Sarah
-
Flash/Flex Developer
I suggest that you load the external SWF into a movieclip and not directly onto the stage. This will give you more control over it and you can adjust the size and position without affecting the rest of the page. Give this a try first before altering the resize code.
Some people are like Slinkies, not really good for anything, but they bring a smile to your face when pushed down the stairs.
-
Accidentally double-posted, sorry!
Last edited by doodark; 12-02-2009 at 12:51 PM.
Reason: double post
-
Thanks for quick reply,
the loader code IS sitting within a movie clip, within another movie clip. I can move the movie clip around to change the position of the rotator, thats not the issue.
The issue is that the entire stage is shifted to the left-hand side of the screen, when it was previously central (please see 2 x links to versions before and after I added loader code)
thanks though...
Tags for this Thread
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
|