PDA

View Full Version : Movie clips and Button actions


bettyswiffin
10-26-2004, 04:27 PM
Hi i need some info/help again with movie clips and buttons.

Basically I am creating a website and i want the following to happen:

When the user is on the homepage and clicks buttons to open up other webpages (eg History, Contact etc etc) it plays an animation in another movie clip. This animation is effectively a box that expands out to hold subnavigation for each of the individual pages. When on any of the webpages the user clicks 'home' that animation then rolls back (ie the box rolls back to reveal more of the main scene).

At the moment I have this working but need to iron out some problems. Firstly, whenever i click on any button (eg history, contact) wherever i am, it repeats the animation and so i need to somehow put in some script to check to see if the animation is already at a certain state or point and if so then tell it to not play the animation from the start? How can i do this?

Secondly, how can i do the same for the 'home' button. By this i mean if i click on the button once the animation rolls back - fine. But if i click it again it repeats it again - How can i stop this from happening as well.

Really appreciate some help on this. Cheers

reverb9
10-26-2004, 04:41 PM
Use variables like 'active' and 'clicked'. When you click a button - set 'clicked' to whatever the button is called. Trigger and run the animation if 'active' and 'clicked' are not the same. When the animation is played 'active' must be set to 'clicked'. Hope this small explanation was to some help. If this doesnŽt help, zip your files and post it here and IŽll take a look.

bettyswiffin
10-26-2004, 05:08 PM
Ok i kinda understand that but not fully. If its easy could you possibly implement it on the home button and one of the others?

Zip file should be attached.

Thanks a lot

bettyswiffin
10-26-2004, 06:36 PM
If anyone can help me on this I would really appreciate it.

reverb9
10-26-2004, 09:07 PM
Im on it... get back to you soon.

reverb9
10-26-2004, 09:27 PM
HereŽs the finished file and code. Simply added active="home"; in the first frame of your movie. Then added some controls to the onRelease functions (code is for the homebutton):on (release) {
if(active != "home"){
_root.mainmask.gotoAndPlay('back');
active = "home";
}
}Your site looks fine btw!

bettyswiffin
10-27-2004, 12:17 AM
Hey reverb thanks so much for getting back to me and helping me out. However i do have one last question. How can i go about getting the box to stay in its out position when browsing between the 'cv' 'portfolio' and 'contact' pages? By this i mean how can i stop the re-animation of the box from left to right when any one of these buttons are pressed? I suppose i'm kinda after a memory function or something so it knows whether to animate from scratch or stay still??

This would really solve my initial idea for the website and make it seem a lot slicker i feel. I just wish i knew AS a lot better!!

Thanks in advance

reverb9
10-27-2004, 11:12 AM
IŽve added another if clause within the first if. This is for the CV button:on (release) {
if(active != "CV"){
if(active != "portfolio" && active != "contact"){
_root.mainmask.gotoAndPlay('forward');
}
active = "CV";
}
}Now, if you click cv when either portfolio or contact is active, the mask animation wont execute. Contact:on (release) {
if(active!="contact"){
if(active != "portfolio" && active != "CV"){
_root.mainmask.gotoAndPlay('forward');
}
active = "contact";
}
} And so on (Portfolio):on (release) {
if(active!= "portfolio"){
if(active!= "CV" && active != "contact"){
_root.mainmask.gotoAndPlay('forward');
}
active = "portfolio";
}
}Whadda ya think?

bettyswiffin
10-27-2004, 12:00 PM
THANK YOU SO MUCH! Working like a dream now! I was trying something very similar but i am just not used to the "&'s" and "!'s" in AS.

Thanks again reverb

reverb9
10-27-2004, 01:45 PM
Glad it works, drop me a line when the site is on line and running! Good luck with the scripting!