3 Replies Latest reply on Nov 21, 2011 1:02 PM by Ned Murphy

    Convertion from a code you put into a movie clip into 1 you put into the timeline?

    LukeElChul Level 1

      help i could realy use some help on how to change this conpatible to timeline.

       

      onClipEvent (load) {

      //data you may want to change

      width = 550;

      height = 400;

      speed = 0.1;

      //initial positions

      x_new = Math.random()*width;

      y_new = Math.random()*height;

      }

      onClipEvent (enterFrame) {

      //x movement

      if (x_new>this._x) {

      sign_x = 1;

      } else {

      sign_x = -1;

      }

      dx = Math.abs(x_new-this._x);

      if ((dx>speed) || (dx<-speed)) {

      this._x += sign_x*speed;

      } else {

      x_new = Math.random()*width;

      }

      //y movement

      if (y_new>this._y) {

      sign_y = 1;

      } else {

      sign_y = -1;

      }

      dy = Math.abs(y_new-this._y);

      if ((dy>speed) || (dy<-speed)) {

      this._y += sign_y*speed;

      } else {

      y_new = Math.random()*height;

      }

      }