-
Unload movie problem
I have a external swf loaded into a container mc. I load the swf from a menu but want to be able to close it after it is loaded. I have put a close button in the loaded swf. But it won't work.
Here is what I have for code.
//close_btn
close_btn.onPress=function(){
schedcont_mc.unLoadMovie();
schedule_btn.enabled=true;
}
What am I doing wrong? is there a much easier way that I can do this..
Thanks for the help
-
Try...
Code:
//close_btn
close_btn.onPress=function(){
_parent.schedcont_mc.unloadMovie(); //no CAPS on the L
// Or you could simply use...
// this.unloadMovie();
schedule_btn.enabled=true;
}
-
Oldnewbie,
I tried your code with just this.unloadMovie and got this error:
Statement must appear within on handler
this.unloadMovie();
what am I doing wrong..
thanks for the quick help.. appreciate it..
-
Well the line would have to be within the button's handler function...
close_btn.onPress=function(){
this.unloadMovie();
schedule_btn.enabled=true;
}
-
Ok,
Tried that.. still same error.. I have put that code in the main .fla where the button that loads the movie is located. Is this correct?
I didnt' think it was going to be this hard..
-
Confusion!
Isn't the button and code in the loaded.swf?
That's what I understood from your initial post!
If not, you can't assign a button's handler function unless that button is actually on stage, on the frame you define the handler.
-
The close button is in the loaded swf. But the button that loads the swf is on the main timeline.
I want the user to be able to close that swf after it loads when the user is done viewing the swf.
I put the code on the close button on the loaded swf but it wouldn't work either.
-
Can you forget about handlers for now, and just try the following on the button itself in the loaded movie?
Right-click the button on stage and select actions...
Type...
on(release){
this.unloadMovie();
}
-
YOU ARE THE BOMB!!
Thanks so much for helping me with this.. I was about to lose my mind.. You rock..
One more hopefully quick question. If I wanted to add dragging to that swf, is that possible and any tutorials?
Thanks again
-
Sorry but one other problem with this button..
Why does it not allow me to load again? It loads, close with the button but if I try to load the same swf again it won't allow me..
-
I'd have to see both your .flas, zipped up and in a MX only format, not MX2004. Attach them.
You'd have a better chance of getting an answer if your .fla was in a MX only format, and zipped up.
You would have to save a copy of your MX2004 .fla, (using Save as...) and changing the Document type to MX only in the Save as... window.
-
1 Attachment(s)
Ok here is the first .fla..
the other one is large 437KB. It won't zip up any smaller
-
1 Attachment(s)
Okay here is the main .fla
I had to delete all the pics but the layout is the same..
-
You can try other process for the button:
Code:
Use:
on (release) {
_parent.destroyObject(instancename);
}
and also try to use the loadMovieNum ("your.swf", level )
with it
-
why does the button not work after it has loaded once and been unloaded?
-
Code:
stop ();
// schedule_btn
schedule_btn.onPress = function(){
loadMovie ("blackteamschedule.swf", "schedcont_mc");
this.enabled = false;
};
/* This is all useless...
close_btn.onPress = function ()
{
this.unloadMovie ();
schedule_btn.enabled = true;
};
//__________________;*/
And in the loaded movie...
Code:
on (release) {
_parent.schedule_btn.enabled = true;
this.unloadMovie();
}
And DON'T use spaces in file names!
-
Oldnewbie,
Thanks so much for looking at my fla's.. I realy appreciate it.. that works like a charm..
Is there an easy way to do a drag feature for that swf?
-
I supposed you mean the loaded one?
-
Shouldn't you get the scrollbar scrolling first?
-
It does work on my copy.. I not sure why it isn't working now.. My original file that I am working with is at my office.. But it does work..
-
Are you on MX2004 and AS2.0?
Just scrapped your scrollbar and added a new one, and it now scrolls fine...
What about this drag? You want a top drag bar or do you want to be able to press and drag it when pressing anywhere. Guess there might be a conflict with the scrollbar then... Or maybe not, would have to try it.
-
I am using mx 2004 AS 2.0
I would like to be able to drag the loaded swf around. I would want a top drag bar.. Iknow I would have to create the area.. no prob there..
thanks again for helping me..
-
Oldnewbie,
I am so thankful for your help.. I appreciate the time you put into this forum..
It all works and all becuase of your help..
Have any good tutorials on that drag window?