-
[F8] onClipEvent conversion!!!
I have this code that makes my MC shake! I want to be able to activate it on a button press, but i'm having no luck with the syntax. (i just seems to move once, and not continuiously)
onClipEvent (load) {
//setting initiaion position
cx = this._x;
cy = this._y;
}
onClipEvent (enterFrame) {
//causes the object to be offset
this._x = cx+(Math.random()*5);
this._y = cy+(Math.random()*5);
}
cheers
Rat
-
Senior Member
code: //
function shake(myMc, cx, cy) {
onEnterFrame = function () {
myMc._x = cx+(Math.random()*5);
myMc._y = cy+(Math.random()*5);
};
}
mc.onPress = function() {
shake(this, this._x, this._y);
};
-
cheers
i will give it a go
-
I have another problem with a simliar code, i want to add the following code to a MC that is dynamically attached using code:
PHP Code:
onClipEvent (load) {
_x = 0;
_y = 0;
speed = 5;
}
onClipEvent (enterFrame) {
endX = _root._xmouse;
endY = _root._ymouse;
_x += (endX-_x)/speed;
_y += (endY-_y)/speed*1.5;
updateAfterEvent();
}
I havn't got a clue how to do it!!!
rat
*edit: please use PHP tags for code samples
gparis
Last edited by gparis; 08-31-2007 at 12:44 PM.
-
still not solved this, my code is a mess!!!
it will allow me to get my dynamic attached MC to follow my mouse?
rat
Last edited by ratboy; 09-03-2007 at 04:54 AM.
-
hey i think i fixed it
function follow() {
onEnterFrame = function () {
endY = _ymouse;
_y+= (endY)/3;
updateAfterEvent();
};
}
follow(textBlock);
-
Hey i think i havn't! the above code moved my whole main MC. Doh
although i am close!!
PHP Code:
function follow(MC) {
onEnterFrame = function () {
endY =_root._ymouse;
MC._y= (endY-_y);
updateAfterEvent();
};
}
follow(shadows);
this allows my shadows MC to follow the verticl mouse monement, but i have lost my deceleration effect.
any ideas!
rat
Last edited by ratboy; 09-03-2007 at 06:11 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|