PDA

View Full Version : moving a MC



buddylee
July 30th, 2003, 01:06 AM
Ok, should be simple, but it has been a long time since I have coded. I have a MC with the instance name of "price". When I click another MC that says "Competetors", I want "price" to move over left 50, and then up 60. I have tried everything I could remember but it has not been working. Can someone please explain to me how to make this one fluid motion. Anything....

Thanks guys

upuaut
July 30th, 2003, 01:36 AM
for a transitioned movement

actionscript on mc price


onClipEvent(load){
this.trip=false;
xdiff= -50;
ydiff= -60;
}
onClipEvent(enterFrame){
if(this.trip){
if(this._y!=ydiff){
_y--);
}
if(this._x!=xdiff){
_x--;
}
}
}

then on the competitors mc you have


on(mouseDown){
if(_xmouse>this._x&&_xmouse<this._x+this._width&&_ymouse>this._y&&_ymouse<this._y+this._height){
price.trip=true;
}
}

buddylee
July 30th, 2003, 11:02 AM
I think I see what you are trying to do here, but it is giving me some errors...


Scene=Scene 1, Layer=Text, Frame=1: Line 9: ';' expected
_y--);

Scene=Scene 1, Layer=Text, Frame=1: Line 15: Unexpected '}' encountered
}

Scene=Scene 1, Layer=Text, Frame=1: Line 1: Invalid mouse event specified.
on(mouseDown){

Scene=Scene 1, Layer=Text, Frame=1: Line 2: Statement must appear within on/onClipEvent handler
if(_xmouse>this._x&&_xmouse<this._x+this._width&&_ymouse>this._y&&_ymouse<this._y+this._height){

Scene=Scene 1, Layer=Text, Frame=1: Line 5: Unexpected '}' encountered
}

radicaljugnu
July 30th, 2003, 11:13 AM
try this on the mc. this is actually easing motion, but its easier than normal motion

onClipEvent(load){
x=_x
y=_y
finalxpos=-60
finalypos=-50
finalxpos2=x+finalxpos
finalypos2=y+finalypos
}
onClipEvent(enterFrame){
_x+=(finalxpos2-_x)/5
_y+=(finalypos2-_y)/5
}

buddylee
July 31st, 2003, 09:41 AM
I cant seem to get any of this to work. Is there any way we could have a Do While loop. Maybe like...


Do _root.myprice._x -=5{
While()_root._x >=50


Something similar to that?