A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Prototype question

Threaded View

  1. #1
    Senior Member Adam14's Avatar
    Join Date
    Feb 2004
    Location
    Ontario Canada
    Posts
    1,116

    Prototype question

    I was reading about prototype last night, and thought I'd give it my first try. Now, I have a question...there are 8 instances of a MC on the stage, named bar1-bar8...and I have them growing, in succession, in _xscale...can anyone tell me why the code below makes each bar grow quicker than the last:
    code:

    onLoad = function () {
    _root.i = 1;
    _root.speed = 10;
    };
    MovieClip.prototype.bargrow = function() {
    if (_root["bar"+i]._xscale<=200) {
    _root["bar"+i]._xscale += _root.speed;
    }
    };
    _root["bar"+i].onEnterFrame = function() {
    _root["bar"+i].bargrow();
    if (_root["bar"+i]._xscale>=100) {
    i++;
    }
    };


    if this is really simple, and I look stupid, can I say my girlfriend wrote it? <just don't tell her I said that>

    thanks, and I've attached a sample of the file if you want to see it.
    Adam
    Attached Files Attached Files

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