emitter.parent?

   Leandro Ferreira

On 4/1/08, Forrest Maready <[EMAIL PROTECTED]> wrote:
>
> The code below has a problem. The **** line within the removeDead function
> is supposed to removeChild on the emitter object.
> I can't for the life of me figure out what the path is- is it
> event.target.parent.removeChild(event.target) or is it parent.removeChild(
> event.target) or what? I've tried everything I can think of to no avail-
> lots of "The supplied DisplayObject must be a child of the caller".
>
> Any ideas? Thank you Flashcoders. May your brightness never dim.
>
>
>
>
> public class Main extends MovieClip
>     {
>
>         var emitter:PEmitter;
>         var pArray:Array;
>
>         public function Main()
>         {
>             stage.addEventListener(MouseEvent.MOUSE_MOVE, createPEmitter);
>         }
>
>         public function createPEmitter(event:MouseEvent)
>         {
>             if (event.buttonDown == true)
>             {
>                 emitter = new PEmitter(event.target.mouseX,
> event.target.mouseY, "circle", 5, 0xFFFF00, 3, 3, 95, 90);
>                 //  PEmitter (PositionX:Number, PositionY:Number,
> spriteType:String, amount:Number, color:uint, velocity:Number,
> velocityRandom:Number, emissionRange:Number, emissionAngle:Number)
>                 addChild(emitter);
>                 emitter.mouseChildren = false;
>                 emitter.addEventListener (Event.ENTER_FRAME, removeDead);
>             }
>         }
>
>         function removeDead(event:Event)
>         {
>             if (emitter.pParticle.pArray.length == 0)
>             {
>                 trace ("No more particles");
>   *****        parent.removeChild(emitter); // THIS LINE NEEDS HELP-- DO
> YOU
> KNOW WHAT PATH WILL REMOVE THE ABOVE EMITTER INSTANCE?
>                 emitter.removeEventListener (Event.ENTER_FRAME,
> removeDead);
>             }
>         }
>
>     }
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to