Forgive me, but are you adding the Component to the Display List before you want to see it? Any objects which you want to be visual must be explicitly added to the Display List if they are custom drawn.
See DisplayList on ASDoc. HTH -Kenny --- In [email protected], "sinacapho" <[EMAIL PROTECTED]> wrote: > > Dear all, > i have the followig problem , i have using AS3 to created a > custom component (extends from UIComponent) , i find that the custom > component cannot display on the screen. But if the component extends > from HBox , it will show correctly . Can someone tell me why? > The code is attached. > > thx > capho > > // Mxml > > <?xml version="1.0" encoding="utf-8"?> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" > xmlns:gp="test_comp.*"> > <mx:Panel width="100%" height="100%"> > <gp:test_item/> > </mx:Panel> > </mx:Application> > > // ActionScript file > > package test_comp{ > > import mx.core.UIComponent; > import mx.controls.Button; > import mx.containers.HBox; > > public class test_item extends HBox{ > > private var item_button:Button; > > public function test_item(){ > super(); > } > > override protected function createChildren():void { > > super.createChildren(); > > if (!item_button){ > item_button = new Button(); > item_button.label = "As"; > addChild(item_button); > } > > } > > override protected function measure():void{ > super.measure(); > measuredWidth = measuredMinWidth = 410; > measuredHeight = measuredMinHeight = 30; > } > > > } > } > -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

