hey glen

thanks for the response

i've adjusted the layout to include another textfield with a quantity number in the form and for some reason the order seems to have sorted itself out - i've proved this by colouring the _tfItem field and the button overlay like i did before. I haven't changed the order or any of the spelling but it's okay now.

Really not sure what it was but i do appreciate your time

best
a


On 10 Aug 2009, at 09:20, Glen Pike wrote:

Have you tried disabling the TextField's mouse input? mouseEnabled = false or something. You can also set mouseChildren = false on a container to switch off inputs for all the child sprites.

Glen

Allandt Bik-Elliott (Receptacle) wrote:
hey guys

this is probably a silly bug but i've got a very strange occurance

i've got a method that is supposed to create a textfield with an invisible button on top but, even tho the traces come out correctly, i can't seem to stop the textfield obscuring the button if they're added to the same sprite. I'd rather know why that was rather than simply creating another sprite to sit the button in

here's the method

       private function createItem():void
       {
           var w:Number     = _nWidth - (BasketItem.PADDING * 2);
_tfItem = AssetFactory.createTextField(0, 0, w, 20);
           _tfItem.autoSize     = TextFieldAutoSize.LEFT;
           _tfItem.wordWrap    = true;
           _tfItem.x            = BasketItem.PADDING;
           _tfItem.background = true;
           _tfItem.backgroundColor = 0xFFFFFF;
_sprHitArea = AssetFactory.createButtonOverlay(0, 0, _nWidth); _sprHitArea.addEventListener(MouseEvent.CLICK, itemClickHandler, false, 0, true);
                      _sprItemLayer.addChild(_tfItem);
           _sprItemLayer.addChild(_sprHitArea);
trace("i" + _sprItemLayer.getChildIndex(_tfItem)); // traces as i0 trace("ha" + _sprItemLayer.getChildIndex(_sprHitArea)); // traces as ha1
       }

the AssetFactory.createTextField method is here - AssetFactory is a static class that i use to create a lot of the common items throughout my ria

public static function createTextField(nX:Number = 0, nY:Number = 0, nWidth:Number = 100, nHeight:Number = 100):TextField
       {
           var tf:TextField     = new TextField();
           tf.x                 = nX;
           tf.y                 = nY;
           tf.width             = nWidth;
           tf.height             = nHeight;
           tf.multiline         = true;
           tf.embedFonts     = true;
           tf.selectable         = false;
           tf.antiAliasType     = AntiAliasType.ADVANCED;
           tf.sharpness         = 200;
           tf.styleSheet         = SiteData.instance.cssStyle;
                      return tf;
       }

and here is the AssetFactory.createButtonOverlay method

public static function createButtonOverlay(nX:Number = 0, nY:Number = 0, nWidth:Number = 100, nHeight:Number = 100):Sprite
       {
           var sp:Sprite         = new Sprite();
           sp.graphics.beginFill(0xff9900, 0);
           sp.graphics.drawRect(nX, nY, nWidth, nHeight);
           sp.graphics.endFill();
           sp.buttonMode         = true;
                      return sp;
       }

i've set the background of the textfield to white and the button overlay to orange so i can see what is overlapping what and the white seems to be on top of the orange even though their indices indicate that the textfield is below the button

i'm very confused about this as it's a fairly simple operation

thanks in advance
a




_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to