A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: This Randomizer Script wont work!! Please Help!

  1. #1
    Restarting from Scratch
    Join Date
    Feb 2001
    Location
    Sacramento, CA
    Posts
    236
    Timermask = (Random (2) + 1);
    if (Timermask = 1) {
    tellTarget ("_root/Quickmask") {
    gotoAndPlay ("Play");
    }
    } else if (Timermask = 2) {
    tellTarget ("_root/Slowmask") {
    gotoAndPlay ("Play");
    }
    } else if (Timermask = 3) {
    tellTarget ("_root/Smallmask") {
    gotoAndPlay ("Play");
    }
    }

    It repeatedly accesses _root/Quickmask All I can think of is that somehow I set the Random function up wrong and it is just picking 1 over and over again.

  2. #2
    Senior Member
    Join Date
    Sep 2000
    Location
    Melbourne, Australia
    Posts
    274
    hi,

    it should very almost work

    1.
    your 'if' statements need to use the flash5 syntax '==' not '='

    2. (not crucial)
    while wer'e updating to f5,
    you should also get rid of the tell targets (you don't need these anymore - use dot syntax instead...)

    3. (not important at all )
    personally, I'd change your frame labels, I just have a thing against using defined function names etc for variables and other settings - it can get confusing and sometimes come back to bite you in the arse.

    Code:
    
    Timermask = (Random (2) + 1); 
    if (Timermask == 1) { 
    _root.Quickmask.gotoAndPlay ("Playmark"); 
    } else if (Timermask == 2) { 
    _root.Slowmask.gotoAndPlay ("Playmark"); 
    } else if (Timermask == 3) { 
    _root.Smallmask.gotoAndPlay ("Playmark"); 
    }
    hope this helps

    glenn

  3. #3
    Restarting from Scratch
    Join Date
    Feb 2001
    Location
    Sacramento, CA
    Posts
    236

    Scripting in Flash 5

    Hmmm... thanks for pointing out the == format. I will try it out and post a reply. I have been having a little trouble adjusting to Flash 5's scripting environment. This is probably a pretty stupid question, but... How is it that I enter the new dot address format instead of Tell Target? Do I have to click on something special? I cant seem to get a cursor unless I use Tell Target.

    Thanks for your help
    John

  4. #4
    Senior Member
    Join Date
    Sep 2000
    Location
    Melbourne, Australia
    Posts
    274
    hi, you must be authoring in 'normal' mode

    in the top right of the actionscript pane, select ummm... I've forgotten what it's called either expert or advanced and then you can type anything you like

    cheers,
    glenn

  5. #5
    Restarting from Scratch
    Join Date
    Feb 2001
    Location
    Sacramento, CA
    Posts
    236

    Post Randomizer Script Problems! Can you figure it out?

    Ok so why is this not working?

    Code:
    Timermask = (random(3)+1);
    if (Timermask == 1) {
    	duplicateMovieClip ("_root.Slowmask","Slowmaskclone", 4);
    	_root0.Slowmaskclone.gotoAndPlay ("Go"); 
        } else if (Timermask == 2) {
    	duplicateMovieClip ("_root.Bigmask","Bigmaskclone", 4);
    	_root0.Bigmaskclone.gotoAndPlay ("Go");
        } else if (Timermask == 3) {
    	duplicateMovieClip ("_root.Quickmask", "Quickmaskclone", 4);
    	_root0.Quickmaskclone.gotoAndPlay ("Go"); 
        }
    gotoAndStop ("Stop");
    I am trying to make 3 clips that will play randomly and wont disapear when another clip of the same kind is also played.

    johnziebro@yahoo.com

  6. #6
    Restarting from Scratch
    Join Date
    Feb 2001
    Location
    Sacramento, CA
    Posts
    236

    In Addition

    Another thing I forgot to mention:

    The movie clips being duplicated are blank on their first frame and labeled "Stop". Their second frame is where I want to play from. It is labeled "Go".

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