View Full Version : Reversing a .swf during unload movie?
MakaveliReturns
July 19th, 2006, 11:48 PM
I have a site with 5 buttons...on entrance I have a onload movie (external swf) action which is fine...but I want that external movie to unload from the main movie if I click on another button (And that button have the similar onload action etc)....reverse action would be fine, since the in action is good....is there a way to reverse it without doing alot of goto actions?
Thank you!!
Anogar
July 20th, 2006, 12:05 AM
What I do is:
this.onEnterFrame = function (){
if (rewind == true){
myMC.prevFrame()
}
Then I declare rewind to be true whenever I want it to reverse.
MakaveliReturns
July 20th, 2006, 12:30 AM
So if my main root swf has a "contents" container with this code:
_root.contents.loadMovie("main.swf");
How would I reverse the main.swf content and then make the "contents" container load the next swf (based on the button pressed)? Sorry I'm not the greatest in ActionScript.
thanks! :)
Anogar
July 20th, 2006, 12:50 AM
I'm not sure I completely understand, but you don't really want your main.swf file to have more than one frame, so I'm having trouble visualizing how to reverse it.
MakaveliReturns
July 20th, 2006, 04:50 AM
Ok I have a swf which has the buttons and an instance named "contents" where contents will be called...aka external swf's...the "main.swf" is my ROOT contents (on top of the main master swf)...there's "personal.swf" "work.swf" etc that will be loaded into the "contents" instance under the master swf. Main.swf is just one of the buttons and the default when the user visits the site.
I just want the "contents" to change when I click on the buttons. Each button is already animated. I just want the "contents" to reverse itself upon exit and go to the next swf (when the user clicks the appropriate button)...
This is done alot on many sites...just dont have a sample with me so I can show it to you.
scotty
July 20th, 2006, 05:09 AM
If the buttons and contents are in the same timeline, put this in that timeline
function trans(clip) {
contents._currentframe>1 ? contents.prevFrame() : (clearInterval(my_int), contents.loadMovie(clip));
}
//eg for the work button
work_btn.onRelease = function() {
my_int = setInterval(trans, 30, "work.swf");
};
scotty(-:
MakaveliReturns
July 20th, 2006, 05:12 AM
The buttons are all MC's....but the "content" are all loaded from external SWFs when buttons are clicked. The "Contents" is an intance in the master swf (blank MC) where swfs are loaded externally.
The buttons (All MC's) have their own Action scripts, one of them is:
on (release) {
_root.contents.loadMovie("main.swf");
}
I will try the above code, thank you!
MakaveliReturns
July 20th, 2006, 06:09 AM
Scott you are DA MAN! It worked!
One Q...reversal works...BUT not all items are reversed in the .swf...As in I had incoming text that faded and then slided over with ease in...only some items were reversed.
scotty
July 20th, 2006, 06:14 AM
Maybe it's the setup of your external swfs?
scotty(-:
MakaveliReturns
July 20th, 2006, 06:26 AM
Well I have a stop(); action after the external swf loads and then the text comes in (which is an MC with stop action in there as well).
The way it comes in is fine. Does the external swf have to not have any MC's inside of it?
It doesnt look fine when I scrub it, but during playback it looks ok (This is for the main.swf)
MakaveliReturns
July 20th, 2006, 06:44 AM
Ok it seems that text HAS to NOT have any stop action for its own MC (Kinda odd?) so I took out the texts from it's own MC and put it in the root of main.swf and now it's working fine!
Thank you very much for yer time! :beer: :beer:
Also one thing I noticed is that if I press a button many many times (You never know if the user wants to have fun :D ) the whole "contents" container just stops working all together. Is there a fix for this?
bigcy
July 20th, 2006, 07:02 AM
Can anyone post their fla here ?
I've try it the code, but not succeed.
Thanks in advance.
MakaveliReturns
July 20th, 2006, 07:47 AM
Works for me...but as long as you don't click on the same button, it works! It becomes a little funky whenever you press the same button a couple of times.
I can't post the whole FLA here because it's still work in progress...but I'll try to put a small sample.
I will explain what line does what:
//Put this in your main master swf...change the MYcontents to your desired container. i.e. a transparent movie clip with an instance name.
function trans(clip) {
MYcontents._currentframe>1 ? contents.prevFrame() : (clearInterval(my_int), MYcontents.loadMovie(clip));
}
//This one is obvious...change work_btn to the button that you want to be clicked on and change the mymovie.swf to your external swf...interval is the frames per second. I set mine to 25 and it works.. All of my swf's are in 40fps anyway.
work_btn.onRelease = function() {
my_int = setInterval(trans, 30, "mymovie.swf");
};
Hope this helps...thanks to scotty...I'm getting really close to what I wanted!
bigcy
July 20th, 2006, 08:47 AM
Well....
Its still not working
May be some problems.I'm not getting it.
I've replaced the names with MC , but still not working
Waiting for you source so that it'll be easy for me to understand.
Thanks & regards
garyzero
July 20th, 2006, 08:57 AM
Great question and answers, this is a keeper. :)
bigcy
July 24th, 2006, 02:53 AM
hi MakaveliReturns
I'm still waiting for ur source file.
I'll be very thankful to you if you post here !
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.