Hey All :
I have a main swf file. In this file, you can click on a link, which stops a background swf from playing and also loads an external swf into a blank movie clip. All works well except for two problems:
-
The external swf is not loading where it should be, but off kilter. I think this is registration issue, haven’t figured out the particulars.
-
More importantly… upon resizing the external swf “disappears” into the ether. I understand it might not really be gone, just somewhere I can’t see it. Very twilight zone.
import com.greensock.TweenLite;
import fl.motion.easing.*;
import flash.events.MouseEvent;
stage.align = "TL";
stage.scaleMode = "noScale";
projectsmain.addEventListener(MouseEvent.ROLL_OVER, onOver, false, 0, true);
function onOver(evt:MouseEvent):void {
TweenLite.to(proj_one, 1, {alpha:1});
TweenLite.to(proj_two, 1, {alpha:1});
TweenLite.to(proj_three, 1, {alpha:1});
}
projframe.addEventListener(MouseEvent.ROLL_OUT, onOut, false, 0, true);
function onOut(evt:MouseEvent):void {
TweenLite.to(proj_one, 1, {alpha:0});
TweenLite.to(proj_two, 1, {alpha:0})
TweenLite.to(proj_three, 1, {alpha:0});
}
proj_one.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame);
function fl_ClickToGoToAndPlayFromFrame(event:MouseEvent):void
{
gotoAndStop(2);
}
//center blankmcture on stage
function centerblankmc():void {
blankmc.x = stage.stageWidth / 2;
blankmc.y = stage.stageHeight / 2;
}
// make listener change blankmcture size and center blankmcture on browser resize
function sizeListener(e:Event):void {
scaleProportional();
centerblankmc();
}
//load swf in blank mc
proj_one.addEventListener(MouseEvent.CLICK, extswfLoad);
function extswfLoad (event:MouseEvent):void{
var swfLoader:Loader = new Loader();
blankmc.addChild(swfLoader);
var bgURL:URLRequest = new URLRequest("external.swf");
swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadProdComplete);
swfLoader.load(bgURL);
}
function loadProdComplete(e:Event):void {
trace("file loaded");
}
proj_one.addEventListener(MouseEvent.CLICK, stopSlideshow1);
function stopSlideshow1 (event:MouseEvent):void{
this.parent.slideshow.gotoAndStop(457);
}
//define dynamic aspect ratios
var blankmcHeight = blankmc.height / blankmc.width;
var blankmcWidth = blankmc.width / blankmc.height;
//add event listener to the stage
stage.addEventListener(Event.RESIZE, sizeListener);
//conditional statement to account for various initial browswer sizes and proportions
function scaleProportional():void {
if ((stage.stageHeight / stage.stageWidth) < blankmcHeight) {
blankmc.width = stage.stageWidth;
blankmc.height = blankmcHeight * blankmc.width;
} else {
blankmc.height = stage.stageHeight;
blankmc.width = blankmcWidth * blankmc.height;
};
}
If anyone has any ideas, I’d love to hear them :o)