Clearing array in movie clip

In frame 1 one presses a button and an array ("array 1") of
11 jpgs load into a movie clip "_root.overview".
On frame 2 when another button is pressed another array
("array2") loads into the same movie clip "_root.overview". The
only problem is that the second array has one less image than the
first array and the extra image remains persistent if one toggles
back.
Is there a way to clear an array before reloading another in
the same clip. I tried unloadMovie but that unloads everything. I
need a way to refresh the array each time it is clicked.
Thanks

Clearing out the array isn't going to get you anywhere. You
need to first
unload the movies you loaded in. You should be using
MovieClipLoader class,
along with its unloadClip method.
You say you're loading images into an overview clip - how are
you loading in
the movies?
Also, why is clearing out everything (with unloadMovie) bad?
You load in new
images anyway right?
Dave -
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/

Similar Messages

  • Building an array of movie clips

    Hi
    I have a main document class and an array class (amongst others).
    I am not sure how to build the array though. Below is my attempt up to now. But I get the following error code.
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
        at LetterArray/initLetters()
        at LetterArray()
        at BugGoopFSGame() //This is my main document class.
    What am I doing wrong?
    Thanks
    Charine
    //in main document class
    public var letterArray:LetterArray = new LetterArray(stage);
    //in array class
    package
        import flash.display.MovieClip;
        import flash.events.Event;
        import flash.events.MouseEvent;
        import flash.display.Stage;
        public class LetterArray extends MovieClip
            private var _stage:Stage;
            /*The following are movie clips that need to go into an array so that they can be manipulated togehter.
            Their classes A, F, G, H, I, N, O, S  and T were all dynamically created by flash.*/
    //Do I even need these here?
            public var a:A;
            public var f:F;
            public var g:G;
            public var h:H;
            public var i:I;
            public var n:N;
            public var o:O;
            public var s:S;
            public var t:T;
             public function LetterArray(s:Stage)
                _stage = stage;
                initLetters();
            private function initLetters():void
                var LetterArray:Array = new Array[a,f,g,h,i,n,o,s,t];
    //rest not relevant

    You declare a bunch of objects but you do not instaintiate them.
    public var a:A;  // declare but does not yet exist
    public var a:A = new A();   // declared and exists

  • Need help returning correct name from a code created movie clip

    Hello. I am an AS3 n00b with hopefuly a simple question I am designing a simple game in flash. This code creates an array of movie clips and asigns a picture to each one. It is a map screen. What I need is when I click on one of the created movie clips, I need it to return either the index of the clip in the array or the name of the clip. Basicaly anything I can use to tell them apart in the code. Here is the code:
    import flash.display.MovieClip;
    var MapLoader:Array = new Array();
    var strJPGext:String = ".jpg";
    var intContTileNumber:int;
    var strContTilePath:String;
    var intDistStartX:int = 63;
    var intDistStartY:int = 64;
    var intDistMultiplyY:int = 0;
    var intDistMultiplyX:int = 0;
    var intDistCount:int = 0;
    var MapSquare:Array = new Array();
    for (var i:int = 0; i < 729; i++)
             //var MapSquare:MovieClip = new MovieClip();
            MapSquare.push (new MovieClip());
            MapSquare[i].x = intDistStartX + (intDistMultiplyX * 30);
            MapSquare[i].y = intDistStartY + (intDistMultiplyY * 30);
            MapSquare[i].name = "MapSquare" + i ;
            addChild(MapSquare[i]);
            intContTileNumber = i;
            MapLoader.push (new Loader);
            strContTilePath = intContTileNumber + strJPGext;
            MapLoader[i].load(new URLRequest(strContTilePath));
            MapSquare[i].addChild(MapLoader[i]);
            intDistCount++;
            intDistMultiplyX++;
            if (intDistCount > 26){
            intDistCount = 0;
            intDistMultiplyX = 0;
            intDistMultiplyY++;
    stage.addEventListener(MouseEvent.CLICK, reportClick);
    function reportClick(event:MouseEvent):void
        trace("movieClip Instance Name = " + event.target.name);   
    Now all this works fine, it creates the map and assigns the correct picture and places them in the correct X,Y position and it is the correct grid of 27x27 squares. The problem is with the name, when I click on the movie clip, it returns "Instance2" or "Instance5" or whatever. It starts with 2 and then increases each number by 3 for each clip, so the first one is 2, then 5 then 8 and so on. This is no good. I need it to return the name that I assigned it
    . If I put the code in trace(MapSquare[1]) it will return the name "MapSquare1" so I know the name was assigned, but it isnt returning.
    Please assist
    Thanks,
    -red

    Thanks for the resopnse,
    I know I dont really need the name, I just need the index number of the array, but I cant figure out how to get the index name without specificaly coding for it. That is why in the listener event I use event.target.name because I dont know what movie clip is being clicked until it has been clicked on. Basically when a movie clip is clicked it needs to return which index of the array was clicked.
    I could do it this way:
    MapSquare[0].addEventListener(
      MouseEvent.MOUSE_UP,
      function(evt:MouseEvent):void {
        trace("I've been clicked!");
    MapSquare[1].addEventListener(
       MouseEvent.MOUSE_UP,
       function(evt:MouseEvent):void {
         trace("I've been clicked!");
    MapSquare[2].addEventListener(
       MouseEvent.MOUSE_UP,
       function(evt:MouseEvent):void {
         trace("I've been clicked!");
    ... ect
    but that is unreasonable and it kind of defeats the purpose of having the array in the first place. The code that each movie clip executes is the same, eventualy that index will be passed into a database and the data at that primary key will be retrieved and returned to the program. So I just need to know, when one of those buttons is clicked, which one was clicked and what is its index in the array.
    I am a VB programer and in VB this is very easy, the control array automatically sends its own index into the function when one of the buttons is clicked. It seems simple enough, I just dont know how to do it in action script.
    Thanks again,
    -red

  • Movie clip not visible

    I the code below I want to add the following array of movie clips: activeLevelofTilesArray
    After I added the code below the swf plays with the following error:
    ReferenceError: Error #1069: Property [object S],[object T],...etc.
    not found on builtin.as$0.MethodClosure and there is no default value.
        at WordArray/startTileTimer()
        at WordArray/activeLevelofTiles()
        at WordArray/tileGenerator()
        at WordArray/levelGenerator()
        at WordArray()
        at wordText/initWordText()
        at flash.display::DisplayObjectContainer/addChild()
        at BugGoopFSGame/startTimer()
    I can also not see the movie clips.
    To try to trouble shoot this I ran a trace statement successfully and I turned off any graphics that might be in front of it. Why can't I see my movieclips and how do I fix error 1069?
    package
        import flash.display.*;
        import flash.text.TextField;
        import flash.events.Event;   
        import flash.utils.Timer;
        import flash.events.*;
        import flash.events.MouseEvent;
        import flash.media.Sound;
        import flash.media.SoundChannel;
        public  dynamic class WordArray extends MovieClip
                    public var wordtext:wordText =  new wordText;
                    var activeWordArray:Array;
                    var activeLevelofTenWordsArray:Array;
                   var activeLevelofTilesArray:Array;
                    public var letterArray:LetterArray;
                    var tileTimer = new Timer(500,384);
            //Movie clips of letter tiles to be used
            public var a:A = new A();
            public var f:F = new F();
            public var g:G = new G(); //etc. for all mc's
            private var wordArray:WordArray;
            private var letterTiles:Array = [a,f,g..etc];
                                  private var  lettersL01:Array = [a,a,f,f,f,g,g,h,h,i,i,n,n,n,o,o,o,o,s,s,t,t,t];
                                  private var  lettersL02:Array = [th,th,  //etc for all levels..
                                public var letterLevels:Array = [lettersL01,lettersL02,lettersL03,lettersL04,lettersL05,lettersL06,lettersL07,lettersL08, lettersL09,lettersL10,
                                                                                 lettersL11,lettersL12,lettersL13,lettersL14,lettersL15,lettersL16,lettersL17,lettersL18,l ettersL19,lettersL20,
                                                                                 lettersL21,lettersL22,lettersL23,lettersL24,lettersL25,lettersL26,lettersL27,lettersL28,l ettersL29,lettersL30];
    public var  wordsL1W1:Array = ["a"];  //etc for all words
    public var  wordsL01:Array = [wordsL1W1,...etc for all levels];
    public var wordLevels:Array = [wordsL01,wordsL02,...etc. for entire word array]
                    private var tf:TextField;
                    // ***constructor code
                    public function WordArray(_tf:TextField)
                        tf = _tf;
                        levelGenerator();
                    function levelGenerator():void
                        //**To get next level of 10 words
                        if(wordLevels.length>0)
                            activeLevelofTenWords();
                            tileGenerator();
                        else
                        //Game is complete
                    function activeLevelofTenWords():void
                        // na
                    function tileGenerator():void
                        if(letterLevels.length>0)
                                activeLevelofTiles();
                        else
                                //Game is complete
                        function activeLevelofTiles():void
                            activeLevelofTilesArray = letterLevels.shift();
                            shuffleTiles(activeLevelofTilesArray);
                            startTileTimer();
                        function shuffleTiles(a:Array)
                            //works perfectly
                        function startTileTimer():void
                                tileTimer.start();
                               trace(activeLevelofTilesArray);  // show in output pannel without errors
                                activeLevelofTilesArray.x = 399;
                                activeLevelofTilesArray.y= 30;
                                addChild[activeLevelofTilesArray];    //can not see these in swf ***these show in output pannel with an error code ReferenceError: Error #1069: Property [object F],[object O],[object F],...etc
                                trace("Letters should run"); //this shows in output pannel
    //rest not applicable..

    Hi Ned,
    Thanks, I moved the shuffle function out of activeLevelofTiles like you said and it still works. Yippeeeee
    I have 3 more issues that I need to sort out:
    I'm not doing this whole tile business correctly. As you predicted - If I trace the tile_index value I see only one tile eg. [object a]. It gives me a different one every time so I know the suffle function still works. I need for it to shuffle through the entire active level *3 so that "the tiles fall from the sky" individually generated by the timer that I have built. I guess I have to add it to an event handler.
    Although the trace (activeLevelofTilesArray[tile_index]); worked, I still can not see even the one object generated in the swf file - I think this will solve itself when issue 3 is solved
    After I descovered issues 1 and 2 above, I attempted to declare the tile_index variable outside of the loop. I must have done it wrong or incompletely because I get the following error messages on all the lines I used tile_index:
                             1120: Access of undefined property tile_index.
    Below is the code now:
    function tileIndex():void   //this must be wrong because it gives me that error code and as you predicted only gives one value (I want te whole lot times 3)
                                    for (var i: Number  =0; i < activeLevelofTilesArray.length*3; i++)
                                var tile_index = (i%activeLevelofTilesArray.length);
                        function activeLevelofTiles():void
                            activeLevelofTilesArray = letterLevels.shift();
                            shuffleTiles(activeLevelofTilesArray);
                                tileTimer.start();
                                trace(activeLevelofTilesArray);
                                activeLevelofTilesArray[tile_index].x = 399;
                                activeLevelofTilesArray[tile_index].y= 30;
                                addChild (activeLevelofTilesArray[tile_index]);  //maybe the addChild will work (issue 2) when the tile_index problem is solved
                                trace("Letters should run");
                                trace (activeLevelofTilesArray[tile_index]);

  • Accessing an Array in a duplicated movie clip

    I have a movie clip that has a script declaration of:
    var myCGroup:Array = Array();
    in the first frame.
    (I've also tried var myCGroup:Array; var myCGroup:Array = new
    Array(); and var myCGroup:Array = []; )
    I duplicate this movie clip multiple times. I'm having
    trouble targeting the variable myCGroup from elsewhere in the
    timeline. Other non-array variables that are declared in the same
    place are fully accessible.
    The only code I've been able to write that writes to this
    variable is:
    eval(targetThumb).myCGroup = prodFlush[2].childNodes;
    which actually takes the childnodes and creates an array with
    them.
    However, reading them back out from a separate function later
    is impossible:
    trace("colors to target =====" +
    eval(masterProds[sm]).myCGroup);
    returns nothing. I can read and write to other variables from
    the same function using the same targeting.
    (yes, materProds[sm] == targetThumb)
    Also, the following code results in an undefined array:
    // for(cg=0;cg<cGroupArray.length;cg++){
    eval(targetThumb).myCGroup.push(cGroupArray[cg].firstChild.nodeValue);
    // trace("time: " + cg + " || adding this color group " +
    cGroupArray[cg].firstChild.nodeValue + " to product: "+ targetThumb
    + "===== " + eval(targetThumb).myCGroup)
    Is this a bug, or a documented local vs. global variable
    option that I'm unaware about regarding arrays?
    Any other thoughts? I'm at my wits end.
    Thanks in advance.
    -r

    question[i] =  questionSet.getString(i);Try:
    question[i] =  questionSet.getString(1);Or better still:
    question[i] =  questionSet.getString("QUESTION");or "ANSWER" for the anser record set.
    ResultSet.getString(int) looks up the value in a column (starting at index 1) in a result set.
    getString(String) looks up the value in a column by column name.

  • Removing movie clips in arrays

    Hi there
    I have this code in my Flash file:
    for(bubble in bubbleArray){
         bubbleArray[bubble]._y -= 3;
         if(bubbleArray[bubble]._y < 370){
              bubbleArray[bubble].removeMovieClip();
    I'm wondering, when I remove the movie clips should I also be popping them from the array?
    I have an onEnterFrame function that attaches the movie clips and pushes them into the array, so I'm worried that if I don't pop them the array will continue to increase in size and slow down the movie. Is this the case, or will they be automatically removed from the array by the removeMovieClip() method above?

    Looks like I spoke too soon. I imagined that removing them from the array would be easy, but I'm struggling.
    The movie clip that is removed from its parent clip and should be removed from the array will not always be the first element in the array, and I'll need to remove multiple clips at a time. I've put in a trace action to trace the length of my array, and after about ten seconds it contains about 2500 elements, most of which have already been removed using the removeMovieClip() method. I'm worried this will slow down the movie.
    So to clarify: How can I remove these elements from my array when I remove them from the stage?
    I tried to include something like:
    while(bubbleArray[0] == undefined){
         bubbleArray.shift();
    but it caused Flash Player to freeze up. Also, if I trace bubbleArray[0] it is only "undefined" before something is pushed into the array. Once the clip has been removed from the stage, the trace just returns a blank line, not "undefined".
    I'd appreciate any help.
    Here is all my code:
    stop();
    splash.stop();
    var i:Number;
    var j:Number = 0;
    var minBubbles:Number = 10;
    var maxBubbles:Number = 20;
    var bottomBubbleLimit:Number = 0;
    var topBubbleLimit:Number = 1;
    var bubbleNumber:Number;
    var bubbleX:Number;
    var bubbleY:Number;
    var bubbleScale:Number;
    var bubbleMinScale:Number = 30;
    var bubbleMaxScale:Number = 100;
    var fewerBubbles:Number;
    var ring:String;
    var ringArray:Array = [ringAnimation.ring1, ringAnimation.ring2];
    var bubbleArray:Array = [];
    ringAnimation.onEnterFrame = function(){
        for(ring in ringArray){
            if(ringArray[ring]._y > 370){
                bubbleNumber = (minBubbles + (Math.random() * (maxBubbles - minBubbles)));
                for(i = 0; i < bubbleNumber; i++){
                    bubbleX = ((ringArray[ring]._x - (ringArray[ring]._width / 2)) + (Math.random() * ringArray[ring]._width));
                    bubbleY = ((ringArray[ring]._y - (ringArray[ring]._height / 2)) + (Math.random() * ringArray[ring]._height));
                    bubbleScale = bubbleMinScale + (Math.random() * (bubbleMaxScale - bubbleMinScale));
                    ringAnimation.attachMovie("bubble", "bubble" + String(j), this.getNextHighestDepth(), {_x:bubbleX, _y:bubbleY, _xscale:bubbleScale, _yscale:bubbleScale});
                    bubbleArray.push(ringAnimation["bubble" + String(j)]);
                    j++;
        for(bubble in bubbleArray){
            bubbleArray[bubble]._y -= 3;
            if(bubbleArray[bubble]._y < 370){
                bubbleArray[bubble].removeMovieClip();
        trace(bubbleArray.length);
        if(ringAnimation._currentFrame == 6){
            splash.gotoAndPlay(1);
        }else if(ringAnimation._currentFrame == 12){
            splash.gotoAndPlay(1);
    fewerBubbles = setInterval(reduceBubbles, 600);
    function reduceBubbles(){
        if(minBubbles > bottomBubbleLimit){
            minBubbles--;
        if(maxBubbles > topBubbleLimit){
            maxBubbles--;
        if(minBubbles == bottomBubbleLimit && maxBubbles == topBubbleLimit){
            clearInterval(fewerBubbles);

  • OOP and movie clips in arrays

    I have a number of movieclips in a game that needs to all appear at a certain x;y co-ordinate at the same alpha value and move at a dynamically produced path and basically have the same behaviour up to a point. Flash has created links to .as files for eachEach movie clip.
    I want to put them all in an array to code once. My question - Must this array be in the main class .as file or can I have a seperate .as file written especially for this array.
    Thanks
    Charine
    Facebook: buggoop

    you can pass a reference from your main class to your array class. eg,
    // in document class
    var arrayClass:ArrayClass=new ArrayClass(stage);
    // ArrayClass
    package{
    public class ArrayClass{
    private var _stage:Stage;
    public function ArrayClass(s:Stage){
    _stage=stage;
    dowhatever();
    private function dowhatever():void{

  • Is there a way to clear ALL event listeners, stop all movie clips, etc?

    Is there a syntax for this?
    I have a movie that has 15 frames. Each frame has embedded movie clips within movie clips, tons of animations and event listeners. None is needed except when they are on the stage, on the frame. However, the animations continue even when the frame is left.
    For instance, I have a frame that has a dynamically rendered animation of leaves falling from a tree. When the frame is left, the leaves continue to fall.
    There are many instances of this type of thing happening.
    Ideally, I would love to just be able to clear everything when a new frame is loaded, since none of the animations or event listeners need to carry over from one frame to another.
    Is there a way to do this without the thousands of lines of code it would take to manually remove every single animation and event listener and sound, etc, from the stage?
    Thanks so much!!
    Amber

    you have to manually do that.
    or, you could convert each frame to a swf.  load each swf when needed and, if you're publishing for fp 10+, you can apply unloadAndStop() to kill all streams in the loaded swf and ready those assets for gc.

  • Using an array to assign movie clips to buttons

    Thanks in advance for any help you can give me!!
    I've got 5 movie clip buttons.  When a user rolls over a button, I want one movie clip to play. When a user clicks on that button, an alternate movie clip plays. I'm trying to use an array to assign certain movie clips to certain buttons and actions, but I'm not doing something quite right. I can get one button to work correctly, but then am having issues getting the other buttons to work.
    Here is the code I have:
    var currentPage:MovieClip;
    var currentScreen:MovieClip;
    var prevPage:MovieClip;
    var currentButton:MovieClip;
    var arrNavigation:Array = [{button:m1_mcButton, page:m1_mc, screen:s1_mc},
       {button:m2_mcButton, page:m2_mc, screen:s2_mc}]
    for(var i=0;i<arrNavigation.length;i++){
    arrNavigation[i].button.buttonMode=true;
    arrNavigation[i].button.addEventListener(MouseEvent.ROLL_OVER, onButtonOver);
    arrNavigation[i].button.addEventListener(MouseEvent.ROLL_OUT, onButtonOut);
    arrNavigation[i].button.addEventListener(MouseEvent.CLICK, onButtonClick);
    function onButtonOver(e:MouseEvent):void
    for(i=0;i<arrNavigation.length;i++) {
    if(arrNavigation[i].button == e.currentTarget)
    currentPage = arrNavigation[i].page;
    currentPage.gotoAndStop("over");
    function onButtonOut(e:MouseEvent):void{
    currentPage.gotoAndStop("out");
    function onButtonClick(e:MouseEvent):void{
    for(i=0;i<arrNavigation.length;i++) {
    if(arrNavigation[i].button == e.currentTarget)
    currentScreen = arrNavigation[i].screen;
    arrNavigation[i].screen.gotoAndPlay("over");

    if your buttons are movieclips, use:
    var currentPage:MovieClip;
    var currentScreen:MovieClip;
    var prevPage:MovieClip;
    var currentButton:MovieClip;
    var arrNavigation:Array = [{button:m1_mcButton, page:m1_mc, screen:s1_mc},
       {button:m2_mcButton, page:m2_mc, screen:s2_mc}]
    for(var i=0;i<arrNavigation.length;i++){
    arrNavigation[i].button.buttonMode=true;
    arrNavigation[i].button.addEventListener(MouseEvent.ROLL_OVER, onButtonOver);
    arrNavigation[i].button.addEventListener(MouseEvent.ROLL_OUT, onButtonOut);
    arrNavigation[i].button.addEventListener(MouseEvent.CLICK, onButtonClick);
    arrNavigation[i].button.ivar=i;
    function onButtonOver(e:MouseEvent):void
    currentPage = arrNavigation[e.currentTarget.ivar].page;
    currentPage.gotoAndStop("over");
    function onButtonOut(e:MouseEvent):void{
    currentPage.gotoAndStop("out");
    function onButtonClick(e:MouseEvent):void{
    currentScreen = arrNavigation[e.currentTarget.ivar].screen;
    currentScreen.gotoAndPlay("over");

  • 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.

  • Actionscript 2.0 clear all movie clips

    I need to figure out how, when you roll over a movie clip, it clears all previous clips showing and then plays its clip

    eh that may not be possible, but what the set up is each tooltip is its own layer with the clips pasted in.
    In each clip theres about 5 layers that are involved with the animate. My code to activate it is
    on(rollover){
              gotoAndPlay(2);}
    that triggers the animation. then theres a simple "close" button that just plays everything in reverse.

  • Movie clip stops playing for no reason

    I am making a banner that has multiple movie clips sharing the same area, creating different rainbow effects when different areas (invisible buttons) are moused over.
    First of all I couldn't figure out if there was a way to have one invisible button over the whole area that changed to a different colored effect with each mouse over (first mouse over the black and whites would change to reds, second would change it to blues, third would change it to browns, etc.). Since I couldn't figure this out I settled on creating three buttons covering a third of the banner each, so when the mouse passes over one button it changes to reds, over another button it changes to blues, over the third it changes to browns.
    The effects are movie clips where each frame has another stripe changing color so it goes in a wave effect from one to the next, and then goes back to white and black in the same manner.  The first frame of each movie clip I had to turn into a nested movie clip so I could turn the alpha to 0, since I was going to have these color effect movie clips on top of one another in the main timeline on different layers, and so you could see the effect even if that color layer wasn't on top. I used the same nested movie clip with zero alpha for the first frame of each color effect clip (reds movie clip, blues movie clip, etc), so I dont' know if that's an issue.
    Anyway, it seemed to work fine for a while, but after working on it for a while longer (and not getting any further since I removed most of the changes I made), now when I test the movie the mouse over does not seem to work correctly. It works fine, seemingly, for the first time I mouse over each button, but in order to have it work again I have to mouse over the button twice, and then it will pause randomly during a part of the clip and I have to move my mouse back over for the movie clip to continue.
    I can't tell if this is because of the overlapping movie clips, or because my buttons are messed up, or if my actionscript is messed up, or if the timeline has to be longer, or what. Currently the timeline is 55 frames, the same as each movie clip.
    I put a movieclip_instance.stop(); command in the first frame of the main timeline, is there a better way to do this? Should I put the stop command in the movie clip itself?
    Here is a section of my AS in the main timeline, this is my first time programming ever, in any language, and trying to learn from the internet is more difficult than I thought it would be.
    redmovie.stop();
    red_btn.addEventListener(MouseEvent.ROLL_OVER, playRed);
    function playRed(event:MouseEvent):void
              redmovie.play();

    I am not sure of what the problem is, so I don't know if this will help or not.  One thing I might suggest is that you use gotoAndPlay(1) instead of play().  That way, if your movieclip is in the middle of playing it won't continue but will start from the beginning.
    You could use one button to have the different movieclips play in sequence if you prefer that.  You would just need to have some form of counter that keeps track of which is the next to play. Somethin like...
    var mcCounter:uint = 0; // start at 0 since an array is being used to identify which movieclip to play
    var mcs:Array = new Array(redmovie, bluemovie, brownmovie);
    only_btn.addEventListener(MouseEvent.ROLL_OVER, playMC);
    function playMC(event:MouseEvent):void
             mcs[mcCounter].play();                  // tell the current mc to play
             mcCounter += 1;                            // increment for the next mc
             if(mcCounter == 3) mcCounter = 0;  // reset the counter if it exceeds the array

  • How can you make movie clips partially visible?

    Okay, so this sounds simple, but I'm tottally lost... I'm a thirteen year old boy that has been using Flash for a little over 3 years. I program video games. I recently embarked on a game where one of the modes is to be split screen, player one gets the top half, player 2 the bottom. The promblem with this is that my game is based off of a moving background, where inorder to keep the main character centered the background moves instead of them. Becsause of this,when setting up split screen, the screen on the upper layer takes over the bottom because there would be more showing then there would be in the game: Parts would be off screen. I was wondering if there was anyway that using hitTest(s) (or some other method) you could make a movie clip partially visible/ invisible. I know the code for making something invisible when touching something else. But I was wondering if there was a way to make only the part of the movie clip touching another movie (it would have its alpha turned off... let's say it's a hitBox) or only the part of the movie clip touching the hitBox visible, invisible. Another way of looking at this is that I want a movie clip to be a small box, but inside I want their to be a huge picture. I want to make it so that when you move the picture different parts are viewable in this little box. And to make this as clear as I can... : I want to make a circle that I'll call the magnifying glass. I want to make an invisible picture that can be moved using code (I know that part). I want it so that when part of the picture is under the magnifying glass it's visible, not the hole thing, jus that circular area. Another reason I'd like to have this promblem solved is for a moving water effect. I want to make a movie clip and tween showing a square of rushing water, but without putting anything over parts of it (other than a hitBox) I want to make only a squiggly line of that water box visible. Thank you so much! =D I really hope you guys know! =D P.S. I also am currently using the trial of CS4, if that helps anything. But if it's only possible in AS3, then it's impossible to me because I use AS2 conservatively.

    Thanks... but I think you've misunderstood my question. I suppose magnifying glass wouldn't be the right word... I just wanted to explain that I want only the part of one mc touching another mc to be visible. I hope this isn't confusing. I have no need to enlarge an image. I want to make a movie clip only partially visible. Check out the fla.

  • How do I remove a the contents of a movie clip created using loadClip?

    I have a Flash site that loads specific SWFs into a movie
    clip called "content_mc" based on a button click. I do this using
    the "loadClip" method. I then remove (I thought) the SWF from the
    movie clip with "unloadClip" and replace it with a new SWF using
    "loadClip." All seemed to be working fine, but now I see that
    scripts from a SWF that I thought I unloaded are still running.
    I'm sure this is due to my lack of understanding of what
    "loadClip" and "unloadClip" are doing. And there certainly may be a
    better way to do what I want to do... but such is life. What is the
    method to delete a the contents of a movie completely from memory?
    or is there a better way to do what I want to do?
    Thanks for your help,
    David

    Nope you understand more or less correctly. unloadClip takes
    away the contents that loadClip placed. However there are certain
    things that don't go away.
    My guess is that you have some setIntervals. Those must be
    cleared (clearInterval) before you do the unloadClip.
    Or perhaps you have set up some listeners? Again those must
    be removed.

  • How do I create a play button for movie clip using AS3

    Hello.
    Bit new to this and have been searching the adobe forums and google. I am trying to create a button that will play an imported MovieClip.
    I have a movie clip that I've imported into it's own layer (Layer1) Frame 1.  I've given the MovieClip an instance name of foundationMovie.
    I've created a button and have that on its own layer(Layer2) above layer1, it is also in Frame 1.
    I've added a
    stop (); action to layer2
    The video is not set to autoplay.
    I want the video to start playing when the viewer clicks the button.  I know I've got to put some kind of event listener using AS3 in my timeline somewhere.
    I've found some code and I've been trying to work with it.  I'm sure I've mutilated it beyond usability but this is what I've got.
    stop ();
    player.addEventListener(MouseEvent.CLICK,play);
    function play(event:MouseEvent)
    gotoAndPlay("foundationMovie");
    If someone could point me the right direction or help me with my code I would really appreciate it.  Thanks.

    First, you need to clear up what you are working with... a movieclip and a video are usually entirely different things.
    Next, your code may get you started on your way with some changes.   You shouldn't use "play" as a function name due to there already being a play() method/function in Flash.
    If the movieclip is a movieclip and has an instance name of "foundationMovie", and your button has an instance name of "player" then the following adjusted code would normally work...
    stop ();
    player.addEventListener(MouseEvent.CLICK,playMovie);
    function playMovie(event:MouseEvent)
         foundationMovie.play();

Maybe you are looking for

  • I only wanted to restore my settings but i ended up restoring everything (i.e. all data got deleted), how can i get my pictures and books back?

    How can i return my phone back to what it was 10 minutes ago and no i haven't backed up my phone since last year so i do a restore from what i have in my computer, this will only return my phone back to what it was a year ago. please help.

  • Exchange 2013 CU3 Databases only activate on one mailbox server

    Hi, guys I have two Exchange 2013 CU3 Mailbox servers installed, one DAG, 5 databases, each has one copy. I found that if I activated three databases on Mailboxserver1 or Mailboxserver2, then after a few hours, all databases will  be activated on the

  • Re-using old phones

    There is more computing power in even a basic mobile than was used to put man on the moon (they mostly used slide rules). It occurs to me that they could be put to use in a variety of applications as remote controlling or monitoring devices.  Indeed,

  • Pacman mirrorlist

    Hi, I've a problem with pacman, it failed retrieving file from any mirror... first I had ftp://archlinux.puzzle.ch but once it doesn't work anymore, so I tried other mirrors in the mirrorlist sorted with rankmirrors. But with any mirror I've tested I

  • Create photo books using Shutterfly

    This question was posted in response to the following article: http://help.adobe.com/en_US/photoshopelements/using/WS287f927bd30d4b1f561c711e12e28a900cc- 7ff1.html