Hey guys i have a project (see screenshot for layout of timeline) that has three main pages, ‘home’, ‘gallery’,‘contact’. On the home page an external .swf (random animation) is loaded in, what i want is a preloader for that animation being loaded in. I thought i had it but i was mistaken.
Here is my AS code for frame 1 (which is the home page), apologies if it doesnt follow normal structure, i am brand new to flash.
import fl.controls.ProgressBar;
import flash.events.Event;
swfOnStage = true;
currentPage = "home";
/*
You must keep the variables and functions you can write
additional ones but you must not start from scratch.
on scene home - delete the layer with named animation and create the animation this size
*/
//loading the animation
var swfRequest:URLRequest = new URLRequest("assignmentfinal.swf");
var swfLoader:Loader = new Loader();
swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoaded, false, 0, true);
swfLoader.load(swfRequest);
function swfLoaded(event:Event):void
{
swfLoader.x=40;
swfLoader.y=150;
addChild(swfLoader);
}
// used to navigate to the home page
homeBT.addEventListener(MouseEvent.CLICK, homeDisplay);
function homeDisplay(event:Event):void
{
if ((swfOnStage==true)&&(currentPage != "home"))
{
swfOnStage= false;
removeChild(swfLoader);
}
if (galOnStage==true)
{ galOnStage= false;
removeChild(galleryhold);
}
gotoAndStop("home");
}
// used to navigate to the gallery page
galleryBT.addEventListener(MouseEvent.CLICK, galleryDisplay);
function galleryDisplay(event:Event):void
{
if (swfOnStage==true)
{
swfOnStage= false;
removeChild(swfLoader);
}
if ((galOnStage==true)&&(currentPage != "gallery"))
{
galOnStage= false;
removeChild(galleryhold);
}
gotoAndStop("gallery");
}
// used to navigate to the contact page
contactBT.addEventListener(MouseEvent.CLICK, contactDisplay);
function contactDisplay(event:Event):void
{
if (swfOnStage==true)
{
swfOnStage= false;
removeChild(swfLoader);
}
if (galOnStage==true)
{
galOnStage= false;
removeChild(galleryhold);
}
gotoAndStop("contact");
}
stop();
If anyone could help me with this i would really appreciate it.
Chris W