Groups | Blog | Home
all groups > flash actionscript > march 2006 >

flash actionscript : ActionScript butto



Maya_88
3/9/2006 7:16:20 PM
I am trying to create an actionscript button;
in the _root I have two layers: on one the a movie clip (button_ant), taken
frome the library (which is the button), and on the other the code to animate
the movie clip:

this.button_ant.onRollOver = function() {
button_ant.gotoAndPlay("_over");
}
this.button_ant.onRollOut = function() {
button_ant.gotoAndPlay(85 - _currentframe);
}



that _currentframe" instead of taking the frame from button_ant, I think, it
takes it from root, returning "1".
I also tried "button_ant._currentframe", but had no luck...

I would appreciate any help!
Sorry if my english is not very clear, but I'm Italian :D

ps. if my post is not clear enough take a look at my .fla:
http://www.gemstreetwear.com/prove/ant.fla
http://www.gemstreetwear.com/prove/ant.swf
boxdoctor
3/9/2006 8:17:34 PM
Hi there. This may not be what you're looking for but change your current
rollout code to this:

this.button_ant.onRollOut = function() {
button_ant.gotoAndPlay("_out");
}

should do what you want it to.
Maya_88
3/9/2006 10:13:51 PM
this.button_ant.onRollOut = function() {
button_ant.gotoAndPlay("_out");
}

This is what I had initially, but what i'm trying to do is: when I RollOut,
instead of just going to the "_out" frame subtract from the current frame a 85
frames so that it will skip a part of the "_out" animation making the animation
smoother...
I hope this is clear... I know it's kind of hard to understand...
thanks anyways for the hint :)
boxdoctor
3/9/2006 11:35:12 PM
Hmm...well I'm probably tired from a long week already, but perhaps a quick
solution would be to go to the various keyframes you have stops on and put this
into the actionframe:
In frame 45 of the button_ant MC put:
_global.currentAntFrame = _currentframe;
trace("current Ant Animation: " + _currentframe);

Then back in your Scena1 you can call it. I don't know if that'll help you or
not. Let me know.
AddThis Social Bookmark Button