Hey there.
Using Lee’s External Loader tutorial, I tried to make one for a portfolio site.
There are two problems with my output:
-
when i put a background colour for the swf1 and swf2, they don’t seem to be there. the data is, but not the background colour.
-
how come when i run it on a webpage in html, the selected swf1 won’t load up, but, when i load it as a SWF on it’s own, it loads up?
import mx.transitions.Tween;
import mx.transitions.easing.*;
stop();
logoSlide = mx.transitions.easing.Strong.easeOut;
//MAIN TWEENS
var logoTween = new mx.transitions.Tween(bodyBG, "_xscale", logoSlide, 0, 100.0, 0.5, true);
logoTween.onMotionStopped = function()
{
var logoTween2 = new mx.transitions.Tween(bodyBG, "_height", logoSlide, 0, 516.0, 0.6, true);
logoTween2.onMotionStopped = function()
{
var logoTween3 = new mx.transitions.Tween(extLoader, "_alpha", logoSlide, 0, 100, 0.5, true);
logoTween3.onMotionStopped = extLoaderFunc;
}
}
//EXTERNAL LOADER
function extLoaderFunc()
{
//trace("anyone here?");
var mcl:MovieClipLoader = new MovieClipLoader();
var mclL:Object = new Object();
mclL.onLoadProgress = function(target,loaded,total)
{
//trace("onLoad");
//updates percentage of loaded content
//returns values of loaded, total.
extLoader.percent.text = Math.round((loaded/total) * 100) + "%";
var amount:Number = Math.round((loaded/total) * 100);
extLoader.extLoaderBar._xscale = amount;
/*if(amount == 100)
{
logo = mx.transitions.easing.Strong.easeOut;
var logoAlphaFinal = new mx.transitions.Tween(extLoader.percent, "_alpha", logo, 100, 0, 3.95, true);
}*/
}
mclL.onLoadInit = function()
{
//when 100% has been reached, the loader becomes invisible
//empty the percent text string to nothing
logo = mx.transitions.easing.Strong.easeOut;
var thePercent = new mx.transitions.Tween(extLoader.percent, "_alpha", logo, 100, 0, 0.8, true);
thePercent.onMotionStopped = closeUp;
function closeUp()
{
extLoader._visible = false;
extLoader.percent.text = "";
}
}
//will receive events from the above objects/functions
mcl.addListener(mclL);
//loads clip when you start SWF
mcl.loadClip("swf1.swf",holder);
//BUTTONS
home_btn.onRelease = function()
{
//will make the loader visible and load the clip for swf1
extLoader._visible = true;
mcl.loadClip("swf1.swf",holder);
}
b2.onRelease = function()
{
//will make the loader visible and load the clip for swf2
extLoader._visible = true;
mcl.loadClip("swf2.swf",holder);
}
}//end extLoader()
This is not the entire code for the project, but this is the most important part so it’s all you need to know.
The link is at: http://www.tsaconas.com/temp2/
The SWF file is at: http://www.tsaconas.com/temp2/flash/body.swf
The SWF file it is calling is: http://www.tsaconas.com/temp2/flash/swf1.swf
Cheers.