I think this is pretty easy to do, and I’ve seen others remove a movieClip from the stage, but i can’t seem to implement the code.
my class
package {
import flash.display.MovieClip;
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.motion.Animator;
public class Cloud extends MovieClip {
var cloud_animator:Animator;
function Cloud():void {
}
function remove():void {
if(this.x <= -255 && this.parent)
this.parent.removeChild(this);
}
public function float():void {
var myDate:Date = new Date();
var myTime = myDate.getHours()
var floatTween = new Tween(this, "x", None.easeNone, 640, -400, 8, true);
}
}
}
}
my main timeline code(is there another name for that?)
var cloudTimer:Timer = new Timer(2200);
cloudTimer.addEventListener(TimerEvent.TIMER, makeCloud);
cloudTimer.start();
function makeCloud(evt:TimerEvent):void {
var newCloud:Cloud = new Cloud;
addChild(newCloud);
newCloud.y = Math.random()*50;
newCloud.x = 800;
newCloud.float();
}
var cloudTimer2:Timer = new Timer(3000);
cloudTimer2.addEventListener(TimerEvent.TIMER, makeCloud2);
cloudTimer2.start();
function makeCloud2(evt:TimerEvent):void {
var newCloud:Cloud = new Cloud;
addChild(newCloud);
newCloud.y = Math.random()*50 + 50;
newCloud.x = 800;
newCloud.gotoAndStop(2);
newCloud.float();
}
As you see, I want the movieClip to be deleted once it reaches a certain point. and I’ve tried adding the newCloud.remove() to my stage, but it doesnt seem to work.
if you know how to change the color of the movieclip, that would be also excellent
thanks in advanced!