| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
|
|
#1 (permalink) |
|
Arf arf
Join Date: Jan 2005
Location: Bath, England
Posts: 31
|
Ok peeps, I have a wee little problem. I’m almost there in understanding it, but I’d be grateful for a helpful push in the right direction. Rather than giving you all the details of the confusing thing that I’m putting together, I’ll spare you all the irritation and instead use the idea of an animated ‘ball’. I have a movieclip ("ball_mc"), inside which is an animation of a ball that moves from A to B (there is a stop here), then back to A. I have placed an instance of this movieclip ("ball_mc_1") on the main timeline and would like it to be controlled by a button. Upon rollOver of this button, I would like the movieclip to play so that the ball travels from A to B and stops, then when you rollOut I would like rest of the movieclip to play so that the ball travels from B back to A. What actionscript do I have to put on this button to achieve this? I am still trying to grasp the idea of controlling a movieclip’s timeline within another timeline but am unsure of exactly what script to write to do that. I know that this is really a simple problem but your help would be VERY much appreciated. |
|
|
|
|
|
#2 (permalink) |
|
Senior Member
Join Date: Oct 2004
Location: Bristol
Posts: 3,155
|
i wouldn't use the timeline, i would use the 'ball_mc_1' _x positioning. so give 'ball_mc_1' an instance name of 'ball' if the button is in the 'ball_mc' movieclip it would have an on Mouse rollover command which would contain ball._x += 5, and on rollout ball._x -= 5, stick these commands inside an if conditional which would have the maximum and minimum distances (if (ball._x>20)&&(ball._x<300){}) |
|
|
|
#3 (permalink) |
|
turd 2.0
Join Date: Aug 2005
Location: Right on your tit end
Posts: 1,166
|
or you could use a hit test and the nextFrame() prevFrame() command to control the timeline of your MC. Make an invisible MC with the name hitTestClip or something (for your hit area) and place this code in your ball MC. Put a stop() at the last frame of your animation. if (_root.hitTestClip.hitTest(_root._xmouse, _root._ymouse, false)) { this.nextFrame(); } else { this.prevFrame(); } Then just stick an invisible button over the top for the link. |
|
![]() |