A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: gotoAndPlay random frame in timeline

  1. #1
    Member
    Join Date
    Nov 2002
    Posts
    68

    gotoAndPlay random frame in timeline

    Hello I am wondering if anyone has a script to share that would randomly target 5 different frames in the timeline of a movie. I have created a 4 different effects to some text. Rather than have the movie play through the same sequence I'd like to be able to target different frames so that you can randomise the order of the effects.
    Anyone know of a way to accomplish this?
    Thanks
    Steve

  2. #2
    Senior Member Robb@exo's Avatar
    Join Date
    Jun 2003
    Location
    Canada
    Posts
    1,540
    Hey, this code has the use of a button, but that could be eliminated if you wanted. Mc1 was a 4 frame mc with a stop(); set on each frame.

    PHP Code:
    btn1.onRelease = function() {
        
    mc1.gotoAndStop(getRandomLabel());
        
    trace(getRandomLabel());
    };
    function 
    getRandomLabel():Number {
        var 
    labels:Array = new Array(1234);
        var 
    index:Number Math.floor(Math.random()*labels.length);
        return 
    labels[index];

    HTH. Cheers.
    Wile E. Coyote - "Clear as mud?"

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