Thanks Meinte,

I appreciate your input very much!!
I did some more playing around and noticed that width and height are
overridden when MC content is set to another value.
And also another issue is that I am not able to trigger every single item on
my stage (see listeners)

To show you what I did, here my class:

package  
{
        import flash.display.MovieClip;
        import flash.display.Shape;
        import flash.events.MouseEvent;
        
        public class MC_Test extends MovieClip
        {
                
                public function MC_Test() 
                {
                        init();
                        
                }
                
                private function init():void
                {
                        var mc:MovieClip = new MovieClip();
                        mc.name = "mc";
                        /////////////////////////////////
                        //MovieClip sets width and height primairaly to its
content, so it is 0 because its empty
                        mc.width = 500;
                        mc.height = 500;
                        trace("zonder content "+mc.width); //0
                        
                        var mcInside:MovieClip = new MovieClip();
                        mcInside.name = "mcInside";
                        
                        var s:Shape = new Shape();
                        s.name = "s";
                        s.graphics.beginFill(0xFF0000);
                        s.graphics.lineStyle(2, 0x000000);
            s.graphics.drawRect(0, 0, 300, 300);
            s.graphics.endFill();
                        mcInside.addChild(s);
                        mc.addChild(mcInside);
                        addChild(mc);
                        
                        //Place these settings beneith de mc.width and
mc.height, notice the difference
                        //////////////////////////
                        mcInside.width = 200;
                        mcInside.height = 200;

                        //////////////////////////
                        mc.width = 500;
                        mc.height = 500;
                        
                        trace("met content = "+mc.width);//500
                        trace("s.width = "+s.width);//302
                        trace("mcInside.width = " + mcInside.width);//200
                        
                        
                        //mc.mouseChildren = false;
                        mc.addEventListener(MouseEvent.MOUSE_OVER, over);
                        s.addEventListener(MouseEvent.MOUSE_OVER, over);
                        mcInside.addEventListener(MouseEvent.MOUSE_OVER,
over);
                        
                }               
                
                private function over(e:MouseEvent):void 
                {
                        trace(e.target.name);
                }               
                
        }
        
}n/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to