dcsimg
A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: Play Randomly Movie Clips

Hybrid View

  1. #1
    Senior Member
    Join Date
    Nov 2002
    Location
    Ecuador
    Posts
    28

    i know nothing about random...

    i used this code...
    Code:
    random = Number(random(9))+1;
    tellTarget ("/mc" add random)
    gotoAndPlay(1);
    }
    then this one...
    Code:
    r=int(Math.random()*9)+1;
    _root["mc"+r].gotoAndPlay(1);
    }
    im using 79 movieclips...they are tiny sqares but they all are different...

    i need to play the animation that each square has (change color) without pressing any button...the first code worked pasting it into a button...but second one dindnt worked....

    ah!...and with the first code...i can only play randomly the first 9 MC...and then comes and error of level_0
    Last edited by ContactoCreatvo; 12-10-2002 at 11:31 AM.
    [contacto creativo]

  2. #2
    HELP>>>ACTIONSCRIPT DICTIONARY
    Join Date
    Feb 2000
    Location
    In the Present Moment
    Posts
    1,041
    Learn dot syntax, it is much easier and will most likely fix up this problem.

    Code:
    r=int(Math.random()*9)+1;//do not use random as a var name.. it is a reserved word in Flash
    _root["mc"+r].gotoAndPlay(1);
    Good Luck!
    Antibody
    "Our deepest fear is not that we are inadequate.
    Our deepest fear is that we are powerful beyond measure." - N. Mandela

  3. #3
    Senior Member
    Join Date
    Nov 2002
    Location
    Ecuador
    Posts
    28
    i paste the code you gave me...
    didnt worked..

    nothing happens....
    [contacto creativo]

  4. #4
    HELP>>>ACTIONSCRIPT DICTIONARY
    Join Date
    Feb 2000
    Location
    In the Present Moment
    Posts
    1,041
    I need to see the .fla. You haven't provided enough information on how your movie works and the location you are placing this code.

    You are only going to get movies 1-10 to play because you're random code is only picking numbers between 1 and 10.

    Are the movieclips named mc1 ~ mc79 and are they sitting on the _root timeline? or are they inside of another movieclip?

    Where are you placing this code in relation to those movieclips?

    Please provide your .fla file so that I can help you further.

    Good Luck!
    Antibody
    "Our deepest fear is not that we are inadequate.
    Our deepest fear is that we are powerful beyond measure." - N. Mandela

  5. #5
    Senior Member
    Join Date
    Nov 2002
    Location
    Ecuador
    Posts
    28
    You are only going to get movies 1-10 to play because you're random code is only picking numbers between 1 and 10.
    im sending the .fla

    Are the movieclips named mc1 ~ mc79 and are they sitting on the _root timeline? or are they inside of another movieclip?
    yeap...they are named mc1 ~ mc79 and are sitting on the _root

    Where are you placing this code in relation to those movieclips?
    im placing the code in a keyframe...

    what i need to do is that each square starts the animation randomly so it will look like christmas lights...i cleared the keyframe with the actions

    thanx!
    Attached Files Attached Files
    [contacto creativo]

  6. #6
    HELP>>>ACTIONSCRIPT DICTIONARY
    Join Date
    Feb 2000
    Location
    In the Present Moment
    Posts
    1,041
    Okay in the .fla that you provided, add this code to frame one of the _root:

    Code:
    _root.onEnterFrame=function(){
    	r=int(Math.random()*17)+1;
    	_root["mc"+r].play();
    	};
    Is this what you are after?
    Antibody
    "Our deepest fear is not that we are inadequate.
    Our deepest fear is that we are powerful beyond measure." - N. Mandela

  7. #7
    Senior Member
    Join Date
    Nov 2002
    Location
    Ecuador
    Posts
    28
    yeah!!
    i was trying to do that

    thanx again!
    [contacto creativo]

  8. #8
    HELP>>>ACTIONSCRIPT DICTIONARY
    Join Date
    Feb 2000
    Location
    In the Present Moment
    Posts
    1,041
    Cool

    Glad to help out.
    Antibody
    "Our deepest fear is not that we are inadequate.
    Our deepest fear is that we are powerful beyond measure." - N. Mandela

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