Results 1 to 2 of 2

Thread: Random movie clip on load

  1. #1
    Join Date
    Sep 2008
    Posts
    48
    Thanks
    0
    Thanked 4 Times in 4 Posts

    Default Random movie clip on load

    Hello, I have this code and file. It works, but I want just one movie clip to play randomly, not two, or three. Please help!

    Code:
    var clips:Array = ["redl_mc", "blue_mc", "green_mc"];
    playRandomMC();
    function playRandomMC() {
    	var index:Number = Math.floor(Math.random()*clips.length);
    	for (var i:Number = 0; i<clips.length; i++) {
    		var mc:MovieClip = _root[clips[i]];
    		if (i == index) {
    			mc._visible = true;
    			mc.play();
    		} else {
    			mc._visible = false;
    			mc.stop();
    		}
    	}
    }

  2. #2
    Join Date
    Oct 2010
    Posts
    75
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Default

    What do you mean by randomly exactly? You dont want it to play as soon as the page loads? Are you picky about how the video plays and what options are available to the user that its playing to (stop pause mute)? What type of file is the video?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •