A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Increment by frame UNTIL defined point

  1. #1
    3D kiwi
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    95

    Increment by frame UNTIL defined point

    I guess what I'm trying to learn is a function that will go from frame to frame untill it reaches a defined point. something like WHILE i (which is the current frame of some_mc) is less than 10 (or whatever) go to nextframe and when it reaches 10.... do whatever.

  2. #2
    Uses MX 2004 Pro Quixx's Avatar
    Join Date
    Nov 2004
    Location
    U.S.
    Posts
    877
    You could do something like the following, where the box MC checks it's current frame against the frame number you want it to stop on (20). When it reaches frame 20, the MC stops playing and the onEnterFrame event handler is deleted.

    Code:
    box.onEnterFrame = function() {
    	if (this._currentframe == 20) {
    		this.stop();
    		delete this.onEnterFrame;
    	}
    };

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