Jump to content
GreenSock

Gabums

replay issue - need help asap :(

Recommended Posts

Sorry for the "ASAP" part but my project is supposed to go out today and I noticed a glitch which I cannot figure out. I have a loader:

 

var queue:LoaderMax = new LoaderMax({name:"mainQueue", onProgress:progressHandler});
queue.append(new SelfLoader(this, {name:"self"}));
queue.append(new SWFLoader("title_mask.swf", {name:"title_mask", estimatedBytes:2196542, autoPlay:false}));

//begin loading
queue.load();

function progressHandler(event:LoaderEvent):void
{
   var pcent:Number=event.target.progress*100;
   lbar.scaleX=pcent/100;
   lbc.text=int(pcent)+"%";
if(pcent == 100){
gotoAndPlay(2);
}
}

 

and I have the code to make the title play later on:

 

var LoaderContentTitle:ContentDisplay = LoaderMax.getContent("title_mask.swf");
title_show.addChild(LoaderContentTitle);
LoaderMax.getLoader("title_mask.swf").rawContent.play();

 

Everything works as it should until you get to the end of my animation and there is a button that says "replay". Code as follows:

 

replay_btn.addEventListener(MouseEvent.CLICK, replayButton);
function replayButton(e:MouseEvent) {
gotoAndPlay(2);
SoundMixer.stopAll();
mainChannel = mainMusic.play();
}

 

I tell it to go to and play frame 2 since frame 1 has the loader bar and such. When the animation replays the title_mask.swf flashes on for an instant and then plays itself out. If I tell the replay button to gotoandplay frame 1... I get all kinds of output errors specifically "cannot process a null object reference" but the title_mask.swf doesn't flash and plays as it should. Any thoughts????

 

Thanks so much!

Gab

 

 

UPDATE:

 

I have this weird work around that I'm gonna use for now I think. If I can make it work better later I'll secretly swap out the files on the server ;-)

So I added this code:

 

LoaderMax.getLoader("title_mask.swf").unload();

var queue2:LoaderMax = new LoaderMax({name:"mainQueue2"});
queue2.append(new SWFLoader("title_mask.swf", {name:"title_mask", estimatedBytes:2196542, autoPlay:false}));

//begin loading
queue2.load();

 

So it removes my loaded swf after its done playing and then reloads it and keeps it waiting for the code to call it back to play when the animation is replayed. I keep getting that null object reference error, and I know if has to do with this line

LoaderMax.getLoader("title_mask.swf").unload();

and I don't know why. But its working anyway... so i dunno...

Link to comment
Share on other sites

very difficult to visualize without knowing how your fla is set up.

 

is the title_show clip always on the stage? do you have blank key frames that would cause it to be added and removed?

doest telling your loaded swf to gotoAndPlay(1) work better than just play?

Link to comment
Share on other sites

OMG! I can't thank you enough! You've been such a huge help for me this whole project! HUGE virtual HUG!!!

 

gotoAndPlay(1) worked just dandy. Figures when I spend the past 3 hours trying to resolve the issue it was that simple. I'm gonna test it on all my usual browsers and operating systems just to be sure, but...it worked locally for me :)

Link to comment
Share on other sites

wow. glad to hear it worked. i really had no idea.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×