|
-
reverse action on a button
Hi I am trying to make it so that when the "print button" is clicked a line comes down and displays a sub menu with more options on. I have done this by masking out the sub menu and tweening the mask out as the line comes down... easy...but...
I want the action to reverse when another (or the same) button is clicked so the line goes back up and hides that menu and then opens the new menu (of the corresponding button
My site is here so you can see what i have done - (click the button that says print)
http://vectorsesh.com/vectorsesh_2/v_3.html
please help me
-
Obsolete Vernacular
There may be an easier way to do this, but here's how I've done it in the past: In your case it looks like for each menu, you're going to have three "parts"...
1 - Line moves up to hide the menu
2 - Line moves down to show the new menu
3 - Just the menu without any animation happening to it.
I'd make all of this happen inside one movie clip - we'll call it "menus" and assume it's not contained in any other movie clips, putting it at "_root.menus". For each menu, have three labeled frames, for example "web_in", "web_show" and "web_out". Starting from "web_in" to "web_show", you'll have the animation of the line moving down. From "web_show" to "web_out", it will just be the menu showing. And from "web_out" to the end of that menu animating out (could be blank frames to keep it tidy, or the next menu if you prefer), just have the line going up to hide whatever menu was there. On the "web_show", "print_show" and "motion_show" frames, you'll have to add "stop();" to the frames' ActionScript.
We're going to have a variable that tells Flash which menu is showing. By default we can set it to "none".. in the first frame of your movie, put _global.menuShowing = 'none';
On your web, print and motion buttons, you're going to do two things: one, change this variable, and two, tell _root.menus to play. So for example on the web button, you'll have...
PHP Code:
on(release) {
_global.menuShowing = 'web';
_root.menus.play();
}
Whichever menu the movie's stopped on, it will play the animation of the line moving up, which brings us to the last frame of the "web_out", "print_out" or "motion_out" animation segments. On these frames, you want to put this bit of ActionScript:
PHP Code:
if(menuShowing == 'web') {
this.gotoAndPlay('web_in');
} else if(menuShowing == 'print') {
this.gotoAndPlay('print_in');
} else if(menuShowing == 'motion') {
this.gotoAndPlay('motion_in');
}
Does that all make sense?
Last edited by Number Three; 06-15-2006 at 08:02 PM.
Reason: Syntax errors
-
Looking over it it makes sense using if and else statements yeah
Ill give it a go and get back to you if any problems. Thanks a lot man
-
are the frames right next together (i.e. ina row of three) and more clips inside of them or is it like "web_in" with a tween say from 1 - 10 then "web_show" with a tween from 10-20 and finally "web_out" with a tween from 20-30
-
Obsolete Vernacular
I usually do it with the 1-10, 10-20, 20-30 approach but you could do it with frames next to each other containing movie clips. You'd just have to have the nested movie clips play, then trigger their parent timeline. Having nested movie clips would be good if your animation was particularly fancy.
-
man can i add you to msn for some aid please
-
do you think you could take a look at the swf ive started?? little puzzled
vectorsesh.com/vectorsesh_2/Untitled-1.fla
-
-
Obsolete Vernacular
I'll try and take a look sometime soon - at work right now.
-
cheers man would really appreciate it
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|