var thisMovieClip:MovieClip;
var thisLoader:Loader = new Loader();
function WhichMovieToPlay():void{
if(ButtonUnicValue == 1) //if button 1 Have been click
{
thisLoader.load(new URLRequest("Movie1.swf"));
thisLoader.name = "Movie1";
}
if(ButtonUnicValue == 2) //if button 2 Have been click
{
thisLoader.load(new URLRequest("Movie2.swf"));
thisLoader.name = "Movie2";
}
if(ButtonUnicValue == 3) //if button 3 Have been click
{
thisLoader.load(new URLRequest("Movie3.swf"));
thisLoader.name = "Movie3";
}
if(ButtonUnicValue == 4) //if button 4 Have been click
{
thisLoader.load(new URLRequest("Movie4.swf"));
thisLoader.name = "Movie4";
}
thisLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, doneLoading);
var info:LoaderInfo = LoaderInfo(thisLoader.contentLoaderInfo)
}
function doneLoading(e:Event):void {
thisMovieClip = MovieClip(e.currentTarget.content);
loadDemo_mc.addChild(thisMovieClip);
loadDemo_mc.addEventListener(Event.ENTER_FRAME,runOnce);
}
import flash.display.MovieClip;
import flash.display.Loader;
import flash.events.MouseEvent;
import flash.net.URLRequest;
import flash.events.Event;
var mcLoader:Loader = new Loader();
btnLoad1.movie = "Movie1.swf";
btnLoad1.addEventListener(MouseEvent.CLICK, playMovie);
btnLoad2.movie = "Movie2.swf";
btnLoad2.addEventListener(MouseEvent.CLICK, playMovie);
btnLoad3.movie = "Movie3.swf";
btnLoad3.addEventListener(MouseEvent.CLICK, playMovie);
btnLoad4.movie = "Movie4.swf";
btnLoad4.addEventListener(MouseEvent.CLICK, playMovie);
function playMovie(event:MouseEvent):void {
mcLoader.unloadAndStop();
mcLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, doneLoading);
mcLoader.load(new URLRequest(event.currentTarget.movie));
}
function doneLoading(event:Event):void {
addChild(mcLoader);
addEventListener(Event.ENTER_FRAME, runOnce);
}
function runOnce(event:Event):void {
if(event.currentTarget.currentFrame == event.currentTarget.totalFrames) {
//last frame reached... do something here
}
}
var addPause1:addPause = new addPause();
var c:int =0;
var o:int =0;
var WhoLoadingMovie:int =0;
var LoadingVariable:Number =0;
var LoadingTimeLite:Number =0;
var thisMovieClip:MovieClip;
var thisLoader:Loader = new Loader();
WhoisInside();
function WhoisInside():void{
if(WhoLoadingMovie == 0){
thisLoader.unloadAndStop();
thisLoader.load(new URLRequest("MainEnrollmentMovie.swf"));
thisLoader.name = "MainMovie";
LoadingVariable = 11.90;
LoadingTimeLite = 640;
}
if(WhoLoadingMovie == 1)
{
thisLoader.unloadAndStop();
thisLoader.load(new URLRequest("Life.swf"));
thisLoader.name = "LongTermDisability";
LoadingVariable = 1.35;
LoadingTimeLite = 640;
WhoLoadingMovie = 0;
}
if(WhoLoadingMovie == 2)
{
thisLoader.unloadAndStop();
thisLoader.load(new URLRequest("ShortTermDisability2.swf"));
thisLoader.name = "ShortTermDisability";
LoadingVariable = .95;
LoadingTimeLite = 640;
WhoLoadingMovie = 0;
}
if(WhoLoadingMovie == 3)
{
thisLoader.load(new URLRequest("IndividualShortTermDisability.swf"));
thisLoader.name = "IndiVidualShortTermDisability";
LoadingVariable = 1.35;
LoadingTimeLite = 640;
WhoLoadingMovie = 0;
}
if(WhoLoadingMovie == 4)
{
thisLoader.load(new URLRequest("Accident.swf"));
thisLoader.name = "Accident";
LoadingVariable = .95;
LoadingTimeLite = 640;
WhoLoadingMovie = 0;
}
if(WhoLoadingMovie == 5)
{
thisLoader.load(new URLRequest("LongTermDisability2.swf"));
thisLoader.name = "LongTermDisability";
LoadingVariable = .95;
LoadingTimeLite = 640;
WhoLoadingMovie = 0;
}
if(WhoLoadingMovie == 6)
{
thisLoader.load(new URLRequest("CriticalIllness.swf"));
thisLoader.name = "CriticalIllness";
LoadingVariable = 1.15;
LoadingTimeLite = 640;
WhoLoadingMovie = 0;
}
thisLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, doneLoading);
var info:LoaderInfo = LoaderInfo(thisLoader.contentLoaderInfo)
//trace(info.loaderURL);OnlySWFDemoCopy.fla
//trace(thisLoader.name);
}
function doneLoading(e:Event):void {
thisMovieClip = MovieClip(e.currentTarget.content);
loadDemo_mc.addChild(thisMovieClip);
loadDemo_mc.addEventListener(Event.ENTER_FRAME,runOnce);
}
function runOnce(event:Event):void{
//trace(thisMovieClip.demo_mc.currentFrame);OnlySWFDemoCopy
c = thisMovieClip.demo_mc.currentFrame;
o = thisMovieClip.demo_mc.totalFrames;
var Result:Number = o/.21;
// trace(Result);
//trace("timeNumer: "+c+" LoadingVariable: "+o);
}
TimeLine_mc.buttonMode=true;
TimeLine_mc.addEventListener("click",getDistance,false,0,true);
function getDistance(event:Event):void{
var timeNumer:int = int(event.currentTarget.mouseX);
var SetTimeLine:int = int(timeNumer*LoadingVariable);
trace(SetTimeLine/10);
thisMovieClip.demo_mc.gotoAndPlay(SetTimeLine);
}
TimeLine_mc.InsideTimeLine_mc.addEventListener("enterFrame",showProgress);
function showProgress(event:Event):void{
// var c:int = thisMovieClip.demo_mc.currentFrame;
//var o:int = thisMovieClip.demo_mc.totalFrames;
var p:Number = c/o;
//trace(p);
//trace("C: "+c+ " O: "+o);
//trace(p);
TimeLine_mc.InsideTimeLine_mc.width = LoadingTimeLite * p;
if(p == 1){
closeEveything();
}
}
PlayMovie_mc.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandlerPlay);
PlayMovie_mc.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandlerPlay);
PlayMovie_mc.addEventListener(MouseEvent.CLICK, PlayMovie);
PlayMovie_mc.buttonMode= true;
PlayMovie_mc.useHandCursor = true;
function onRollOverHandlerPlay(event:MouseEvent):void{
PlayMovie_mc.gotoAndPlay("over");
}
function onRollOutHandlerPlay(event:MouseEvent):void{
PlayMovie_mc.gotoAndPlay("out");
}
function PlayMovie(event:MouseEvent):void {
thisMovieClip.demo_mc.play();
doesHaveAchild();
thisMovieClip.demo_mc.removeEventListener("enterFrame",rewindHandler);
stage.frameRate = 21;
}
StopMovie_mc.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandlerStop);
StopMovie_mc.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandlerStop);
StopMovie_mc.addEventListener(MouseEvent.CLICK, StopMovie);
StopMovie_mc.buttonMode= true;
function StopMovie(event:MouseEvent):void {
thisMovieClip.demo_mc.stop();
thisMovieClip.demo_mc.Pausing_mc.addChild(addPause1);
thisMovieClip.demo_mc.removeEventListener("enterFrame",rewindHandler);
}
function onRollOverHandlerStop(event:MouseEvent):void{
StopMovie_mc.gotoAndPlay("over");
}
function onRollOutHandlerStop(event:MouseEvent):void{
StopMovie_mc.gotoAndPlay("out");
}
function doesHaveAchild():void{
if(thisMovieClip.demo_mc.Pausing_mc.numChildren != 0){
thisMovieClip.demo_mc.Pausing_mc.removeChild(addPause1);
}
}
RewindComplete_mc.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandlerRewind);
RewindComplete_mc.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandlerRewind);
RewindComplete_mc.addEventListener("click",startRewind,false,0,true);
RewindComplete_mc.buttonMode= true;
function startRewind(event:Event):void{
thisMovieClip.demo_mc.stop();
thisMovieClip.demo_mc.addEventListener("enterFrame",rewindHandler);
stage.frameRate = 60;
}
function rewindHandler(event:Event):void{
thisMovieClip.demo_mc.prevFrame();
}
function onRollOverHandlerRewind(event:MouseEvent):void{
RewindComplete_mc.gotoAndPlay("over");
}
function onRollOutHandlerRewind(event:MouseEvent):void{
RewindComplete_mc.gotoAndPlay("out");
}
forwardComplete_mc.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandlerForward);
forwardComplete_mc.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandlerForward);
forwardComplete_mc.addEventListener("click",resumePlay,false,0,true);
forwardComplete_mc.buttonMode= true;
function resumePlay(event:Event):void{
if(thisMovieClip.demo_mc.hasEventListener("enterFrame"))
thisMovieClip.demo_mc.removeEventListener("enterFrame",rewindHandler);
thisMovieClip.demo_mc.play();
stage.frameRate = 60;
}
function onRollOverHandlerForward(event:MouseEvent):void{
forwardComplete_mc.gotoAndPlay("over");
}
function onRollOutHandlerForward(event:MouseEvent):void{
forwardComplete_mc.gotoAndPlay("out");
}
function closeEveything():void{
thisMovieClip.demo_mc.stop();
}
login_mc.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandlerl);
login_mc.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandlerl);
login_mc.addEventListener(MouseEvent.CLICK, LoginSection);
login_mc.buttonMode = true;
login_mc.useHandCursor = true;
function onRollOverHandlerl(event:MouseEvent):void{
login_mc.gotoAndPlay("over");
}
function onRollOutHandlerl(event:MouseEvent):void{
login_mc.gotoAndPlay("out");
}
function LoginSection(event:MouseEvent):void{
if( thisLoader.name != "MainMovie")
WhoisInside();
else
{
thisMovieClip.demo_mc.gotoAndPlay("login");
doesHaveAchild();
}
}
Welcome_mc.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler);
Welcome_mc.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler);
Welcome_mc.addEventListener(MouseEvent.CLICK, WelcomeSection);
Welcome_mc.buttonMode = true;
Welcome_mc.useHandCursor = true;
function onRollOverHandler(event:MouseEvent):void{
Welcome_mc.gotoAndPlay("over");
}
function onRollOutHandler(event:MouseEvent):void{
Welcome_mc.gotoAndPlay("out");
}
function WelcomeSection(event:MouseEvent):void{
if( thisLoader.name != "MainMovie")
WhoisInside();
else
{
thisMovieClip.demo_mc.gotoAndPlay("welcome");
doesHaveAchild();
}
}
Learn_mc.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler1);
Learn_mc.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler1);
Learn_mc.addEventListener(MouseEvent.CLICK, LearnPage);
Learn_mc.buttonMode = true;
Learn_mc.useHandCursor = true;
function onRollOverHandler1(event:MouseEvent):void{
Learn_mc.gotoAndPlay("over");
}
function onRollOutHandler1(event:MouseEvent):void{
Learn_mc.gotoAndPlay("out");
}
function LearnPage(event:MouseEvent):void{
thisMovieClip.demo_mc.gotoAndPlay("LearnPage");
doesHaveAchild();
}
GetQuote_mc.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler2);
GetQuote_mc.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler2);
GetQuote_mc.addEventListener(MouseEvent.CLICK, GetAQuote);
GetQuote_mc.buttonMode = true;
GetQuote_mc.useHandCursor = true;
function onRollOverHandler2(event:MouseEvent):void{
GetQuote_mc.gotoAndPlay("over");
}
function onRollOutHandler2(event:MouseEvent):void{
GetQuote_mc.gotoAndPlay("out");
}
function GetAQuote(event:MouseEvent):void{
thisMovieClip.demo_mc.gotoAndPlay("GetAQuote");
doesHaveAchild();
}
CompleteApplication_mc.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler3);
CompleteApplication_mc.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler3);
CompleteApplication_mc.addEventListener(MouseEvent.CLICK, CompleteApplication);
CompleteApplication_mc.buttonMode = true;
CompleteApplication_mc.useHandCursor = true;
function onRollOverHandler3(event:MouseEvent):void{
CompleteApplication_mc.gotoAndPlay("over");
}
function onRollOutHandler3(event:MouseEvent):void{
CompleteApplication_mc.gotoAndPlay("out");
}
function CompleteApplication(event:MouseEvent):void{
thisMovieClip.demo_mc.gotoAndPlay("CompleteApplication");
doesHaveAchild();
}
AddBeneficiarie_mc.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler4);
AddBeneficiarie_mc.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler4);
AddBeneficiarie_mc.addEventListener(MouseEvent.CLICK, AddBeneficiaries);
AddBeneficiarie_mc.buttonMode = true;
AddBeneficiarie_mc.useHandCursor = true;
function onRollOverHandler4(event:MouseEvent):void{
AddBeneficiarie_mc.gotoAndPlay("over");
}
function onRollOutHandler4(event:MouseEvent):void{
AddBeneficiarie_mc.gotoAndPlay("out");
}
function AddBeneficiaries(event:MouseEvent):void{
thisMovieClip.demo_mc.gotoAndPlay("AddBeneficiaries");
doesHaveAchild();
}
ReviewDocument_mc.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler5);
ReviewDocument_mc.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler5);
ReviewDocument_mc.addEventListener(MouseEvent.CLICK, ReviewDocuments);
ReviewDocument_mc.buttonMode = true;
ReviewDocument_mc.useHandCursor = true;
function onRollOverHandler5(event:MouseEvent):void{
ReviewDocument_mc.gotoAndPlay("over");
}
function onRollOutHandler5(event:MouseEvent):void{
ReviewDocument_mc.gotoAndPlay("out");
}
function ReviewDocuments(event:MouseEvent):void{
thisMovieClip.demo_mc.gotoAndPlay("ReviewDocuments");
doesHaveAchild();
}
SignApplication_mc.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler6);
SignApplication_mc.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler6);
SignApplication_mc.addEventListener(MouseEvent.CLICK, SignApplication);
SignApplication_mc.buttonMode = true;
SignApplication_mc.useHandCursor = true;
function onRollOverHandler6(event:MouseEvent):void{
SignApplication_mc.gotoAndPlay("over");
}
function onRollOutHandler6(event:MouseEvent):void{
SignApplication_mc.gotoAndPlay("out");
}
function SignApplication(event:MouseEvent):void{
thisMovieClip.demo_mc.gotoAndPlay("SignApplication");
doesHaveAchild();
}
ConfirmApplication_mc.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler7);
ConfirmApplication_mc.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler7);
ConfirmApplication_mc.addEventListener(MouseEvent.CLICK, Confirmapplication);
ConfirmApplication_mc.buttonMode = true;
ConfirmApplication_mc.useHandCursor = true;
function onRollOverHandler7(event:MouseEvent):void{
ConfirmApplication_mc.gotoAndPlay("over");
}
function onRollOutHandler7(event:MouseEvent):void{
ConfirmApplication_mc.gotoAndPlay("out");
}
function Confirmapplication(event:MouseEvent):void{
thisMovieClip.demo_mc.gotoAndPlay("Confirmapplication");
doesHaveAchild();
}
LogOut_mc.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler8);
LogOut_mc.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler8);
LogOut_mc.addEventListener(MouseEvent.CLICK, Logout);
LogOut_mc.buttonMode = true;
LogOut_mc.useHandCursor = true;
function onRollOverHandler8(event:MouseEvent):void{
LogOut_mc.gotoAndPlay("over");
}
function onRollOutHandler8(event:MouseEvent):void{
LogOut_mc.gotoAndPlay("out");
}
function Logout(event:MouseEvent):void{
thisMovieClip.demo_mc.gotoAndPlay("Logout");
doesHaveAchild();
}
Life_mc.buttonMode = true;
Life_mc.useHandCursor = true;
Life_mc.addEventListener(MouseEvent.ROLL_OVER, onRollOverLife);
Life_mc.addEventListener(MouseEvent.ROLL_OUT, onRollOutLife);
function onRollOverLife(event:MouseEvent):void{
Life_mc.gotoAndPlay("over");
}
function onRollOutLife(event:MouseEvent):void{
Life_mc.gotoAndPlay("out");
}
Life_mc.addEventListener(MouseEvent.CLICK, Life);
function Life(event:MouseEvent):void{
WhoLoadingMovie=1;
WhoisInside();
}
STD_mc.buttonMode = true;
STD_mc.useHandCursor = true;
STD_mc.addEventListener(MouseEvent.ROLL_OVER, onRollOverSTD);
STD_mc.addEventListener(MouseEvent.ROLL_OUT, onRollOutSTD);
function onRollOverSTD(event:MouseEvent):void{
STD_mc.gotoAndPlay("over");
}
function onRollOutSTD(event:MouseEvent):void{
STD_mc.gotoAndPlay("out");
}
STD_mc.addEventListener(MouseEvent.CLICK, STD);
function STD(event:MouseEvent):void{
WhoLoadingMovie=2;
WhoisInside();
}
LTD_mc.buttonMode = true;
LTD_mc.useHandCursor = true;
LTD_mc.addEventListener(MouseEvent.ROLL_OVER, onRollOverLTD);
LTD_mc.addEventListener(MouseEvent.ROLL_OUT, onRollOutLTD);
function onRollOverLTD(event:MouseEvent):void{
LTD_mc.gotoAndPlay("over");
}
function onRollOutLTD(event:MouseEvent):void{
LTD_mc.gotoAndPlay("out");
}
LTD_mc.addEventListener(MouseEvent.CLICK, LTD);
function LTD(event:MouseEvent):void{
WhoLoadingMovie=5;
WhoisInside();
}
Istd_mc.buttonMode = true;
Istd_mc.useHandCursor = true;
Istd_mc.addEventListener(MouseEvent.ROLL_OVER, onRollOverISTD);
Istd_mc.addEventListener(MouseEvent.ROLL_OUT, onRollOutISTD);
function onRollOverISTD(event:MouseEvent):void{
Istd_mc.gotoAndPlay("over");
}
function onRollOutISTD(event:MouseEvent):void{
Istd_mc.gotoAndPlay("out");
}
Istd_mc.addEventListener(MouseEvent.CLICK, ISTDisability);
function ISTDisability(event:MouseEvent):void{
WhoLoadingMovie=3;
WhoisInside();
}
Critical_mc.buttonMode = true;
Critical_mc.useHandCursor = true;
Critical_mc.addEventListener(MouseEvent.ROLL_OVER, onRollOverCritical);
Critical_mc.addEventListener(MouseEvent.ROLL_OUT, onRollOutCritical);
function onRollOverCritical(event:MouseEvent):void{
Critical_mc.gotoAndPlay("over");
}
function onRollOutCritical(event:MouseEvent):void{
Critical_mc.gotoAndPlay("out");
}
Critical_mc.addEventListener(MouseEvent.CLICK, Critical);
function Critical(event:MouseEvent):void{
WhoLoadingMovie=6;
WhoisInside();
}
Accident_mc.buttonMode = true;
Accident_mc.useHandCursor = true;
Accident_mc.addEventListener(MouseEvent.ROLL_OVER, onRollOverAccident);
Accident_mc.addEventListener(MouseEvent.ROLL_OUT, onRollOutAccident);
function onRollOverAccident(event:MouseEvent):void{
Accident_mc.gotoAndPlay("over");
}
function onRollOutAccident(event:MouseEvent):void{
Accident_mc.gotoAndPlay("out");
}
Accident_mc.addEventListener(MouseEvent.CLICK, Accident);
function Accident(event:MouseEvent):void{
WhoLoadingMovie=4;
WhoisInside();
}
<code>
Something like that should work, but if it doesn't, I'd ask you to post your fla so I can take a look at it.
Good Luck,
-V
Open in new window