A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: stop movie on certain frame in timeline??

  1. #1
    Senior Member
    Join Date
    Jan 2004
    Posts
    141

    stop movie on certain frame in timeline??

    Hi.

    I wondered if there is a way of generating a random number on frame one (say, 23), then play the movie and it stop on frame 23??

    Thanks.

  2. #2
    Senior Member jbum's Avatar
    Join Date
    Feb 2004
    Location
    Los Angeles
    Posts
    2,920
    Here's one way to do it. It assumes the movie in question is called 'mc'.

    code:



    mc.frameToStop = 1+random(mc._totalframes);

    mc.onEnterFrame = function()
    {
    if (this._currentframe == this.frameToStop)
    {
    stop();
    }
    }

    mc.play();


  3. #3
    Senior Member
    Join Date
    Jan 2004
    Posts
    141
    wehay, perfect jbum. Thanks.

  4. #4
    Senior Member
    Join Date
    Jan 2004
    Posts
    141
    Hi jbum.

    I used the script, and it generates the random frame fine, but the movie doesn't stop!!

    I tried changing it to 'dice1.stop();' but that didn't work either. Any idea why?

    Thanks.

  5. #5
    Senior Member
    Join Date
    Jan 2004
    Posts
    141
    sorry....where 'dice1' is used in place of 'mc'.

    In frame 1, I have dice1.stop();

    and then in a button, I have:

    Code:
    on (release) {
    	dice1.frameToStop = 1+random(dice1._totalframes);
    	this.onEnterFrame = function()
    	{
    	if (dice1._currentframe == this.frameToStop)
            {
                    stop();
            }
    	}
    	dice1.play();
    }
    it just playes the movie over and over and over again.......

  6. #6
    Junior Member
    Join Date
    Jan 2004
    Location
    Florida
    Posts
    20
    Try changing this.onEnterFrame to dice.onEnterFrame...
    I'm not an expert on flash but it looks like you are doing the onEnterFrame function on a button rather then the movie clip you are attempting to stop
    -Jshpro2

    visit my website at www.onlycheaters.com

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