dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: elastic_problem

  1. #1
    so i have an MC with an elastic move script which works fine- however when i try to apply the script to another MC in the same time line it fails

    the action call is :
    Movieclip.prototype.elasticMove = function(target, accel, convert) {
    step = step * accel + (target - this._x) * convert;
    this._x += step;
    }

    the event handler on the MC is this:

    onClipEvent (enterFrame) {
    elasticMove(_root.newX, 0.6, 0.6);
    }
    onClipEvent (load) {
    _root.newX = 200;

    }

    i have tried renaming the function and the call, say to "elasticMove2" for the other MC but that doesnt work.
    i have tried some simple tests anfd found that you simply cant use the call with two seperate mc's

    anyone have any insight as to why this is or a workaround?

  2. #2
    Senior Member
    Join Date
    Jul 2002
    Posts
    461
    change step >> this.step

    this will put the step variable inside each mc that calls the proto.

    as you have it all mc's calling the proto share the same step variable leading to probs.

    hope that helps

  3. #3

    thanks to gaz_b

    thanks gaz- appreciate it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center