Quantcast
Channel: Adobe Community: Message List
Viewing all articles
Browse latest Browse all 90000

Re: Instances disappearing

$
0
0

yes, this would work:

 

package {

    import flash.display.MovieClip;

    import flash.events.Event;

  

    public class theClass extends MovieClip {

 

        var arrayA: Array = new Array(MC1, MC2, MC3, MC4, MC5, MC6); //<- where these are class names

        var containerM: MovieClip;

        var Speed: int = 7

 

        public function theClass() {

            containerM = new arrayA[int(Math.random() * 3)];

            this.addChild(containerM);

            addEventListener(Event.ENTER_FRAME, eFrame);

        }

 

        private function eFrame(event: Event): void {

            this.x -= Speed;

            if(this.x < 0 - this.width) {

                removeEventListener(Event.ENTER_FRAME, eFrame);

                if(this.parent) {

                    this.parent.removeChild(this);

containerM=null

                }

            }

 

        }

    }

}

 

// p.s. please mark helpful/correct responses.


Viewing all articles
Browse latest Browse all 90000


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>