(Help!) moving MC script
2 posts
Page 1 of 1
well, i only have one simple problemi cant figure a script to move one movieclip to another movieclip by the push of a button, lets say... space.
heres a example of the script i cant make work
thanks
heres a example of the script i cant make work
Code: Select all
but it does not work, if anyone knows what im doing wrong, please help me.onClipEvent(EnterFrame){
if(Key.isDown(Key.SPACE)){
this._x = clip._x
this._y = clip._y
}
}
thanks

The code you are using is almost right. The problem is your not telling were the movie clip is in the hierarchy. To fix it you need to add _root. to go to the top of the hierarchy then put the instance name of the movie clip next.
this is the modified code
hoped this helped cooll; !
this is the modified code
Code: Select all
this code is on the movie clip that is going to be moved. One more thing I usually prefer to put the code on one frame to keep it localized. Here is how that is done
onClipEvent (enterFrame) {
if (Key.isDown(Key.SPACE)) {
this._x = _root.MovieClip2._x;
this._y = _root.MovieClip2._y;
}
}
Code: Select all
onEnterFrame = function () {
if (Key.isDown(Key.SPACE)) {
_root.MovieClip1._x = _root.MovieClip2._x;
_root.MovieClip1._y = _root.MovieClip2._y;
}
};
hoped this helped cooll; !
2 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023