Hi:

I have a customEvent being dispatched from an  extended
ObjectContainer3D  that I can't listen to on my main.as file, here's
the relevant pieces, any idea what I am doing wrong ??

 public class Box extends ObjectContainer3D
        {

                //class vars
                private var _view:View3D;
                private var _id:String;

                public function Box(view:View3D)
                {
                        _view = view;
                        var cMat:ColorMaterial = new ColorMaterial(0xFFDBA6);
                        var regularCube:Cube = new 
Cube({width:60,height:60,depth:60});
                        regularCube.material = cMat;
                        addChild(regularCube);
                        ownCanvas = true;
                        filters = [new GlowFilter(0x000000,1,5,5,4,1)];
                        useHandCursor = true;
                        mouseEnabled = true;
                        _view.scene.addChild(this);
                        y = -30 ;
                        this._id = "BoxN";

                        addEventListener(MouseEvent3D.MOUSE_DOWN, _onMouseDown);

                }

                private function _onMouseDown(ev:MouseEvent3D):void
                {
                        dispatchEvent(new BoxEvent(BoxEvent.BOXSELECT, _id));
                }




My Custom Event:

package {

   import flash.events.Event;
   import flash.events.*;

        public class BoxEvent extends Event {

      public static const BOXSELECT:String = "boxSelect";

          private var _boxId:String = "none";

                public function get boxId():String {
                return _boxId;
                }

                public function BoxEvent(type:String, boxId:String="none"){
                  super(type, true); // so bubbles in theory are ok
                  _boxId = boxId;

        }

                override public function clone():Event {
                return new BoxEvent(type, _boxId);
                }


   }
}


And on my Main file I have this listener:

stage.addEventListener(BoxEvent.BOXSELECT, boxS);

But my handler dose not get called : (

Any help is mostly appreciated.

K


Reply via email to