Random Movie Clips loop

Hey there.
I have a question about randomizing Movie Clips:
I am attaching an example where 12 movie clips will be called
into stage.
(movieA1, movieA2, movieA3....)
I am trying to create a situation where instead of triggering
"movieA1" and so on, the code will trigger:
movieA1 OR movieB1
movieA2 OR movieB2
movieA3 OR movieB3 and so on......
can anyone help here with how to apply it?
Thanks!
note that the attached code triggers AllMovies (MovieA's),
MovieB's are not in code yet, only in the library, because I am not
sure how to code such a thing.
adamlewen

All I posted was a replacement to the corresponding
attachMovie portion of your code... as you had in your first post.
If I've made a correct allowance for the wrapping it should be in
the 6th line of code beginning with
var Movie:MovieClip = _root["Movie"+i] =holder.attachMovie
etc
What I suggested is only making a change to the first
parameter to include a
B or no B in the library ID that's requested by the
holder.attachMovie part.
The way its set up (if you use this changed attachMovie) it
will randomise each time that makeAllMovies is called.
If I was doing something like this I'd be inclined to set up
the holder clips once. And then load the randomised content clips
inside on the setInterval call to something like your makeAllMovies
function. I also think you'd need to use removeMovieClip for
previously attached content clips before attaching each time as I
don't think it just replaces ("overwrites") the old one. I've seen
other posts where if you attachMovie the same library item with the
same name in the same holder clip, you end up with 2 instances
(flash apparently appends a number to one of them each time). If
this is indeed the situation and happened each time, it would
probably cause some problems.
Don't know if that helps. Kglad or others may have more
insight in this area where I've indicated uncertainty.

Similar Messages

  • Selecting a random movie clip from array

    I know this should be easy, but I can't seem to make it work. All I want is for the variable currentPage to select randomly from an array so that every time the page loads, it displays a different currentPage.
    This is what I have so far:
    var myImages:Array = new Array("outsource_mc","solutions_mc","staff_mc");
    var randomImages:Array = [];
    var randomCount:Number = 1;
    var r:Number;
    for (var i = 0; i<randomCount; i++) {
    r = Math.floor(Math.random()*myImages.length);
    randomImages[randomImages.length] = myImages.splice(r, 1);
    trace(randomImages);
    currentPage = the random movie clip;
    Thank-you for any help!!

    Anytime you want to see what something is, use the trace() function... it is an essential code design tool that outputs whatever you ask it to in the Output window....  trace(currentPage);
    For the code I showed currentPage would have been one of the instance name String values from the array.  If you had taken the quotes off of the names in the array, it would be a reference to the actual instance.
    As far as the new code you show, I don't know what you are trying to do, nor what it is not doing that you expect it to, but the last two lines have no relationship to the lines preceding it.

  • Random movie clips

    Thanks for reading my post. I have a script that
    randomly displays a movie clip of a logo. As shown below:
    function showLogo(){
    var rndNum:Number = Math.round(Math.random()*11);
    this.attachMovie("logo" + rndNum, "logo1_mc",
    this.getNextHighestDepth(), {_x:0, _y:0});
    setInterval(showLogo(),1000);
    It seems to be working. But, I still have two problems.
    1. The moviclips stay on the stage after a new clip called.
    2. I'd like to have the movieclips fade in then out.
    My questions:
    1. setInterval() doesn't seem to be called. The online change
    in the interval between logos comes from the length of the main
    timeline. How do I get it to work?
    2. How do I remove a movieclip from the stage? Do I apply it
    to the moveclp being shown? Or the moviclip calling the function?
    3.How does the _alpha function work?
    I'm new to doing this. So, I thank you for your patience in
    advance.

    If you want alpha fades, you need to tween the alpha values.
    One way to do this is with the Tween Class:
    http://www.adobe.com/devnet/flash/articles/tweening_05.html
    And your code is a little off. Here's the corrected code:

  • Captivate movie clips looping in Flash

    I've read the discussions on the forum, but nothing seems to
    be able to stop a captivate 2 movie clip from looping when brought
    into Flash. I exported the captivate movie with the default values,
    converted it to a movie clip in Flash8 so I could resize it,
    brought the movie clip into the Flash movie by dragging it to the
    stage. Everything looks great, but I can't stop the clip from
    looping. Stop commands placed within the movie clip seem to have no
    effect nor do commands put on the main timeline.
    Thanks for the help.

    Hi there
    Hopefully someone here will have an answer for you. In the meantime you might also wish to post this question in the forums for Acrobat.
    Click here to visit the Acrobat forums
    Cheers... Rick
    Click here for Adobe Certified Captivate and RoboHelp HTML Training
    Click here for the SorcerStone Blog
    Click here for RoboHelp and Captivate eBooks

  • Button Movie Clips Loops Ad Nauseum

    Greetings
    I have a button that is a movie clip that is set up with animations triggered with MOUSE_OVER and MOUSE_OUT event listeners.  The glitch is that once the mouse is over the button ... each ensuing pixel that the mouse is moved, loops the animation again.  That probably didn't make a whole lot of sense, so I posted the file on my test site (http://www.savagepixels.com/test/test.html).  You have to drag your mouse slowly across the button to see this. The bottom part of the button works as I'd expect.  When you roll over the text at the bottom of the button, everything functions as it should.  The looping problem starts when you roll over the image portion of the button.  For some reason it considers each consecutive pixel rolled over to be a new event and consequently triggers the "over" animation again.
    The code I have is below.  I've commented out the MOUSE_OUT function for now.  There is also a screenshot at the above link of my Layers palette for the button clip in question.  I put a "stop" label at each frame that has an action so you see the actions used.
    Thanks for helping!
    oneBedButton_mc.buttonMode = true;
    oneBedButton_mc.addEventListener(MouseEvent.MOUSE_OVER, overEffect);
    //oneBedButton_mc.addEventListener(MouseEvent.MOUSE_OUT, outEffect);
    function overEffect (e:MouseEvent)
        oneBedButton_mc.gotoAndPlay("over");
    function outEffect (e:MouseEvent)
        oneBedButton_mc.gotoAndPlay("out");

    That was helpful. I had one of images in the button movie clip that wasn't a movie-clip type symbol ... it was just a static .png image.  Once I converted that into a movie clip, the repetitious looing went away.
    There is still some weirdness if you refresh that same link ... (http://www.savagepixels.com/test/test.html) if you roll over the lower part of the button where the text "One Bedroom + Study" is, and then move your mouse up over the image portion, the whole MOUSE_OVER event gets triggered again.  This is weird because there are no actions whatsover in the button movie clip except a few stop(); keyframes.  It treats the image as a separate button.  Any ideas on what is causing that event to be triggered in this way?

  • Random location for a random movie clip

    I have various movie clips which I need to appear in one of
    four locations randomly. I need the movie clip to also be random. I
    also need more than one movie clip on stage at the same time. I
    believe the following needs to be used:
    Math.random
    duplicateMovieClip
    I also believ that the method needs to be generic. Apart from
    that I am stuck.
    Any help/ideas are appreciated.
    Hope my question makes sense?

    good point. to be honest thinking about it I dont really know
    why
    I have four movie clips, which the user controls called
    user1
    user2
    user3
    user4.
    In addition I have 6 additional movie clips which I need to
    appear and move (randomly) in one of four locations (based on a
    standard stage size):
    locations 1 (start position)
    x co-ordiantes 138.3
    y co-ordiantes 62.8
    locations 2 (start position)
    x co-ordiantes 549.3
    y co-ordiantes 53.8
    locations 3 (start position)
    x co-ordiantes 137.3
    y co-ordiantes 156.8
    locations 4 (start position)
    x co-ordiantes 543.3
    y co-ordiantes 147.8
    locations 1 (finish position)
    x co-ordiantes 291.3
    y co-ordiantes 162.8
    locations 2 (finish position)
    x co-ordiantes 397.3
    y co-ordiantes 162.8
    locations 3 (finish position)
    x co-ordiantes 280.3
    y co-ordiantes 257.8
    locations 4 (finish position)
    x co-ordiantes 400.3
    y co-ordiantes 258.9
    The maximum number of movie clips moving between the two
    positions at once should be 6. Ideally more than one from one
    location
    I would also like the speed at which they move to be
    different.
    The idea is that if a colission occurs between any one of the
    moving movie clips and the avatar(user 1-4) then points are added.
    Hope this helps.
    Thanks
    ******************

  • Movie Clip Loop

    I have some quite nice clips that I would like to use as screen savers.
    So can I make them into a loop?-chatch

    HI Bengt, Thanks for your help. Unfortunately I still haven't got it to work. I did as you advised, but when I clicked on the new QT folder, I got the message "contains no picture". As one can put music in loops, I would have thought there was an easy way to put film clips in loops!
    Anyway, Thanks again-chatch

  • Movie clip looping...

    and looping, and...
    running logic 8 rewired to reason 4.0.1.
    when i run a QT video clip in logic, the clip repeats automatically, altho looping is off (on both apps).
    any idea how to stop this from happening??
    thanx!

    anyone?
    clip will stop if i set end point to BEFORE the end of the clip, but i need to get to the end!
    any ideas would be great...!

  • How to link from a movie clip to main timeline?

    My problem first appeared very simple, but I have spent a
    while on it and can't think how to solve it. I must say that I am
    very much an amateur in designing in Flash and ActionScript.
    I created a movie clip containing an embedded video and a
    sound clip. In the main timeline I inserted the movie clip into a
    keyframe. When I found the movie clip didn't play, I discovered
    that the only way of making it play was to place a Stop action in
    the keyframe of the movie clip, and also set the whole movie to
    loop. The Stop action stopped the whole movie from looping, but
    instead made the movie clip loop. If the keyframe is on frame 456,
    how do I make it advance onto frame 457 once the movie clip has
    finished running?
    I've tried various ways around the problem, including placing
    a button inside the movie clip to Go to and Play frame 457, but
    instead it plays frame 457 in the movie clip.
    Can anyone help me with this please?

    Hello,
    You need to tell flash the "target" you want to play. If not
    specified
    it will think it is the target you are calling from which in
    your case
    is the movie clip.
    So to go back and play one level up would be:
    _parent.gotoAndPlay(457);
    If the movie clip was inside another movie clip then it would
    be:
    _parent._parent.gotoAndPlay(457);
    or you can just referent the root of the movie directly:
    _root.gotoAndPlay(457);
    Search the help file for timeline target and you should find
    more about it.
    Incubusguy wrote:
    > My problem first appeared very simple, but I have spent
    a while on it and can't
    > think how to solve it. I must say that I am very much an
    amateur in designing
    > in Flash and ActionScript.
    >
    > I created a movie clip containing an embedded video and
    a sound clip. In the
    > main timeline I inserted the movie clip into a keyframe.
    When I found the movie
    > clip didn't play, I discovered that the only way of
    making it play was to place
    > a Stop action in the keyframe of the movie clip, and
    also set the whole movie
    > to loop. The Stop action stopped the whole movie from
    looping, but instead made
    > the movie clip loop. If the keyframe is on frame 456,
    how do I make it advance
    > onto frame 457 once the movie clip has finished running?
    >
    > I've tried various ways around the problem, including
    placing a button inside
    > the movie clip to Go to and Play frame 457, but instead
    it plays frame 457 in
    > the movie clip.
    >
    > Can anyone help me with this please?
    >
    >

  • Accessing movie clip from flash swf file

    I have the situation where in flash i created a simple
    animated movie clip with few stop() commands on timeline. Movie
    clip consists of simple animatio played on roll over and on roll
    out which is controlled using actionscript. I loaded movie clip
    into flash using [embed] tag but actionscript code is stripped,
    there is no stop() action so movie clip loops continously. I guess
    that's normal behaviour for embedded flash swf files but i would
    like to know is there a way to still achieve that? Can i load swf
    some other way with its actionscript and then control movie clip
    from flex?

    You need the FLA's to open in Flash.
    You could download the free trial of a flash decompiler
    (www.sothink.com). The free trial won't give you actionscript, but
    it will give you all of the art in the swf.

  • How to detect  collssion for random or Duplicated movie clips

    Hey guys .. i am back with set of query..till now .. key
    press movement a rocket (mc) is moving left right up down in a
    defined stage area. and i am able to generate some fire balls
    randomize falling from top. this is just i am duplicating the movie
    clip(fireball_mc) .... now i want incase or when the rocket (mc)
    touch the fire ball programm shold detect the collsion and generate
    a score board. well for this i have tried a script for two movie
    clips ... wchich is working but ..i don know or i m not gettng the
    logic how to detect the collission for duplicated movie clips...
    well i m just giving the script for oinly 2 movie clips
    coliding...can any one tell me how to do it with randmize or
    duplkicated mcs??
    for 2 movie clip ...
    _root.mc1.onEnterFrame = function() {
    if(this.hitTest(_root.egg)) {
    _root.result="Oh no..... we are dead";
    } else {
    _root.result="we are going fine";
    (this is happening ..but let me know how can i get the same
    result for ranndom mcs)
    hope someone can help me out ...
    i appriciate ur valuable time to read this..
    thanking you

    Hey thx for ur suggestion...but as i said m very much new to
    actionscript (more designer) so i don have much idea... most of the
    things i m doing for this game i m going through lots of references
    then i tried to understand te codes m implmenting them to my
    need..can u explain me little more about arrays u haves asked for
    loops u asked me to use the hittest function..please /.. i will be
    greatfull to u... thx

  • Dynamic text in looping movie clip

    Hi,
    I am looping a movie clip which has a dynamic text box. I
    need to call data from XML and place the same in the Dynamic text
    box as per the duplicated movie clip. how do i do that.
    Thanks,
    Ayush

    on (release) {
    _parent.frontFields.topTextArch.ph2TopTextBrush._visible =
    false;
    That is the script attached to my button. I can see the text
    flash for a second when I push the button but it does'nt go away
    because the looping movie clip just continually goes back to the
    first frame and makes the ph2TopTextBrush text field visible again.
    I think I know what your saying. Your saying to attach a
    script to the first frame of the looping movie clip that would
    check to see which of the 3 dynamic text fields are visible. That
    would be perfect but I'm not sure how to do it.
    What would the script that I place on my button look like?
    What would the script in the first frame of the looping movie clip
    look like?

  • Looping Background Movie Clip

    Hi i am having trouble with having a looping background movie
    clip on the bottom layer of my flash project. I have it on the
    bottom layer in the first frame, above it i have some menus fading
    in and it seems as though once it gets to this scene, it just plays
    the movie clip over and over and never goes to the 2nd frame of my
    scene. Is there anyway to have a looping background movie clip
    inside of flash 8?
    Thank you in advance,
    Tyler

    You can use a variable to keep count of how many times you loop, and until it exceeds a particulr value (2 or 3) you execute a setTimeout() call that waits for however long you want to delay and then tells the movieclip to gotoAndPlay(1).
    So in the first frame you would establish the counting variable...
    var count;
    if(count == undefined){ // only set it to 0 once
    count = 0;
    and in the last frame you would do your incrementing and control....
    stop();
    count += 1;
    if(count < 3){
    setTimeout(waitABit, 2000); // call function in 2 secs
    function waitABit(){
    gotoAndPlay(1);

  • Movie Clip is not looping AHH

    So I got this video that is streaming from the server on the stage (starting a new movie clip). I then have a mask over it to create a diamond shaped movie clip. However, once I take it into the main timeline and export as movie...when I view it--it is not looping...it's only playing once. Any ideas on what's going on? THANKS!

    I found the answer via http://www.kristenstephenson.net/?p=333&cpage=1#comment-259. Working code:
    import fl.video.VideoEvent;
    ksvid.autoRewind = true; // fl_video being the name of the video component
    ksvid.addEventListener(VideoEvent.AUTO_REWOUND, doLoop);
    function doLoop(e:VideoEvent):void
    e.target.play();
    The only difference from her way of placement was that because I have the f4v as a progressive download in a movie clip as a flash playback with a mask (*pheww)...I had to make a cuepoint at the end of the video and then place the actionscript within the movie clip as its own layer.
    SUCCESS!

  • Looping a movie clip a specific number of times in Flash

    Does anyone know how to get a movie clip to loop a specific number of times in Flash? I know how to stop a movie clip from looping by using the this.stop (); command by placing the command in a separate Action Script layer, in a keyframe, inside of the movie clip's timeline. This allows the movie clip to play through once and then stop. But I need for the movie clip to loop more than once, maybe 2 or 3 times, and then go back to the main timeline. Does anyone know the code for this?
    Also, is it possible to place a pause (I'm guessing, maybe by using a timer of some type?) between the loops, so that the movie will pause a couple of seconds before it loops again and then stop? Please note I do not need the movie clip to stop when there's an event like a rollover or anything. I just need it to play a couple of times, pause between plays and then stop and go back to the main timeline. Please let me know if anyone can help.
    Thanks,
    Sarah
    P.S. Is there a good, easy to use, reference book anyone can recommend for creating specific things in Flash using Action Script? Do you guys have a favorite for beginners like me?

    You can use a variable to keep count of how many times you loop, and until it exceeds a particulr value (2 or 3) you execute a setTimeout() call that waits for however long you want to delay and then tells the movieclip to gotoAndPlay(1).
    So in the first frame you would establish the counting variable...
    var count;
    if(count == undefined){ // only set it to 0 once
    count = 0;
    and in the last frame you would do your incrementing and control....
    stop();
    count += 1;
    if(count < 3){
    setTimeout(waitABit, 2000); // call function in 2 secs
    function waitABit(){
    gotoAndPlay(1);

Maybe you are looking for