PDA

View Full Version : animation problem


friz2002
11-02-2002, 04:09 PM
I have 4 buttons and a mc (containing two mc's - mc1 & mc2) on the main timeline.
When I press button one, mc1 moves to a new position, when it reaches the new position, mc2 starts to move to a new position.
No problem so far.
when button2 , 3 or 4 are clicked, I want mc2 to return to it's original position and then mc1.
How do I do this?
I didn't know how to explain more clearly, so here's a link the an example and the .fla
example + fla (http://uk.geocities.com/chris_vigier/mc_problem.html)

red penguin
11-02-2002, 07:29 PM
You'd have something that on the LOAD of the clips grabs the original X and Y positions. Then on the click, you just send it back to those vars/positions.


onClipEvent(load){
origX = this._x;
origY = this._y;
}

That should be a starting point for ya.

friz2002
11-02-2002, 10:26 PM
Hi,

thx for the reply.
I don't want the mc's to jump back to their original positions, but move back.
If you click button1 on the example, you see a first part come down, then a second part.
What I want is, when one of the other buttons is clicked, part2 movies back up and then part1.
So, the thing that happens when clicking on button1 in reverse.

red penguin
11-03-2002, 11:15 PM
Okay. A basic test file to get you in the right direction.....

Instead of using onEnterFrame, I am now using a timeline loop on a clip. In this way, we can have two frames which we use for the lowering and two frames to raise the bar.

Take a peek and see if you can't get it to trigger it in steps...one section and then the other. Think about adding a variable that'll check to see when it's in a particular position.

up_down.zip.....tee-hee!

friz2002
11-04-2002, 05:25 PM
Thx for the help ;)
All very new to me, I'll try to figure this out now

friz2002
11-04-2002, 07:37 PM
ok, I found how to triggrt the second clip. I didn't use a variable like u suggested, but instead I used this on the down label in clip one
this._y +=10;
if(this._y >= int_finalY){
gotoAndStop("nul");
_root.prevbar_mc.prevholder_mc.gotoAndPlay("down2");
}
and this on the up2 label in clip 2
this._y -=10;
if (this._y <= int_origY2){
gotoAndPlay("nul2");
_root.prevbar_mc.prevbarsteun_mc.gotoAndPlay("up");
}

One small problem though :eek:
if users keep clicking on the buttons, the clips keep going up or down.
Is there a way to prevent this from happening:confused:

Thx again for the help;)

red penguin
11-04-2002, 08:06 PM
Sure. You would just need to change the two frames controlling the movement. A simple else in there'll do the trick. Sorry! An oversight on my part!

//
if (this._y>=int_finalY) {
gotoAndStop("nul");
_root.prevbar_mc.prevholder_mc.gotoAndPlay("down2");
}else{
this._y+=10;
}

friz2002
11-04-2002, 08:10 PM
thx for the help, really appreciate it :D