Skip to main content
Participant
November 29, 2008
Question

I want to change movie clip script to frame script

  • November 29, 2008
  • 2 replies
  • 268 views
I want to change
below this script into frame.So what i can do?
quote:


"
onClipEvent(load){
xvel=10;
yvel=10;
}
onClipEvent(enterFrame){
xpos=Stage.width/2;
ypos=Stage.height/2;

_x=xpos;

if(_y<ypos){
_y+=yvel;
}
if(_y>ypos){
_y-=yvel;
}

} "

This topic has been closed for replies.

2 replies

phoecxanAuthor
Participant
December 1, 2008
Thank Bro
I really thank to you :)
Ned Murphy
Legend
November 29, 2008
If xvel and yvel and xpos and ypos are constant values, then you can assign them outside of the onClipEvent calls.

The _x and _y properties need to be associated with an object, as in myMC._x = ...., even if they are still within the myMC object, you are better off indcating what they belong to (this._x, etc)

For the enter frame aspect, use the following for the frame version... where 'this' could be whatever object it is assigned for

this.onEnterFrame = function () {
// your repetitively active code
if(_y<ypos){
_y+=yvel;
}
if(_y>ypos){
_y-=yvel;
}
}