-
buttons and on release or rollout
hello
ive created a button that should play an animation when you hover over it with your mousepointer and when you click on it that a reversed animation occurs.
however with the down event i have to keep the mousebutton pressed in if i want to view the full reversed animation
so when i click that button like everyone does
(nodbody's gonna keep the mousebutton pressed in when clicking on a link) i only see a glimpse of the reversed animation followed immediately by the initial animation because my mousepointer is still hovering over the button
ive tried solving it with movieclip buttons but unfortunately flash only seems to recognize the same _over and _down events
and i need a release or a rollOut event
im outve ideas
-
Cheap Bear Imitation
try to work with if-statements and _currentframe.
for example on the rollOver event, let the code check if the animation is still reversing and if so prevent it from playing the inital animation.
Pink signature?
-
ok but can i do this with buttons or do i have to make it a movieclip? its plain text my menu item
so i have two movieclips on the over and on the down state
of my button
so can i say for instance (dont mind the syntax im no expert on actionscript used to animating) if (onrollover) movieclip2 is still playing then dont bring up movieclip1 else play movieclip1?
or maybe make my button a movieclip and use the loadmovie action?
sorry im a novice in scripting and pretty tired
-
Cheap Bear Imitation
i'd suggest using movieclips instead of buttons since movieclips give you more control.
let's say, you make up a movieclip which will be your button later on. in this movieclip you have another two movieclips, your rollOver animation and the reversed one when pressing the button (both stopped on the first frame). give them some instance names, i will use anim und rev_anim here.
on your movieclip/button you could use a script like that:
code:
on (rollOver){
if(this.rev_anim._currentframe==1){
this.anim.play();
}
on(press){
this.rev_anim.play();
}
got the trick?
Pink signature?
-
ok
so my button becomes a movieclip
which has the two other movieclips contained on its timeline
but do i have to place them each on a separate frame?
or do you mean that i have to place them both on the first frame
with a stop action assigned to it ? and the required animation gets triggered with its instance name?
-
Cheap Bear Imitation
"or do you mean that i have to place them both on the first frame
with a stop action assigned to it ? and the required animation gets triggered with its instance name?"
right.
Pink signature?
-
ok ill give it a go this evening but now first im off to eat something
anyway thank you for your time and effort i appreciate your help
ill let you know how things turn out
btw i placed the menu online at www.geocities.com/svenbracke the bio button
so you know what im trying to attain here
cheers
-
hooray it works
this is the final code ive added for my button
on (rollOver) {
if (this.movie2._currentframe == 1) {
this.movie1.play();
}
}
on (press) {
if (this.movie1._currentframe == 25) {
this.movie2.play();
this.movie1.gotoAndStop(1);
}
}
on (rollOut) {
this.movie1.gotoAndStop(1);
}
the reason why i added a couple things such as the second if statement and the gotoandstop was because i had another movieclip inside my first animation on the last frame (25)
so i had to stop the animation there (as long as the mouse was over the button)
and i made an extra empty keyframe for both animations
at the beginning with a stop action assigned to it
i also wanted to make sure the first animation would be completely played before the reversed animation started since both animations kinda form a whole
anyway thx again for the help
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
|