[flexcoders] Re: Custom UIComponent creating problem

2006-08-15 Thread lostinrecursion
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 flexcoders@yahoogroups.com, 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/
 




Re: [flexcoders] Re: Custom UIComponent creating problem

2006-08-15 Thread Michael Schmalle



Hi,It's not that it is not getting added to the display list, it's that UIComponet does not have a border.If you want something with a border, you either have to create a border skin instance in your extended UIComponent subclass OR subclass container that has a border(which is expensive if your are doing something simple).
Best bet is to create a border skin, size it in updateDisplayList().Peace, MikeOn 8/15/06, lostinrecursion 
[EMAIL PROTECTED] wrote:












  



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 flexcoders@yahoogroups.com, 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;
 			}
 
 			
 		}
 	}



  













-- What goes up, does come down.

__._,_.___





--
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



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___