Re: SPAM-LOW: [flexcoders] Custom Component not visible on stage
I've had similar problems when creating AS3 components. Look into updateDisplayList. I believe you also have to make sure that your custom component has a width and height specified. You can always dig through the canvas code to figure out why that works, and use that info to figure out why yours doesn't. droponrcll wrote: I have created a custom AS component DragObject based on Canvas. The idea is that ultimately users will be able to put whatever they want inside this ontainer and it will handle most of the code of drag and drop for them. However, when I put another (100 x 100) Canvas inside this component just to test it out, the width and height of my component are 0, so it doesn't show up on stage. I used the super() method in my constructor, so I expected my component to behave like a Canvas in that it should automatically be sized around its children. Here is the AS for my class: package elearning { import mx.containers.Canvas; public class DragObject extends Canvas { public function DragObject() { super(); } private var _desc:String = Untitled Draggable Object; public function get desc():String{ return _desc; } public function set desc(descTxt:String):void{ _desc=descTxt; } override public function toString():String{ return(DragObject + _desc); } } } Thanks! -- Jeffry Houser, Technical Entrepreneur, Software Developer, Author, Recording Engineer AIM: Reboog711 | Phone: 1-203-379-0773 -- My Company: http://www.dot-com-it.com My Podcast: http://www.theflexshow.com My Blog: http://www.jeffryhouser.com
Re: SPAM-LOW: [flexcoders] Custom Component not visible on stage
--- In flexcoders@yahoogroups.com, Jeffry Houser [EMAIL PROTECTED] wrote: I've had similar problems when creating AS3 components. Look into updateDisplayList. I believe you also have to make sure that your custom component has a width and height specified. You can always dig through the canvas code to figure out why that works, and use that info to figure out why yours doesn't. The component really needs to size itself around its children, so I need to find a way to do it without specifying a width and height. My class is extending Canvas, so it should be using all Canvas's methods already, right?
Re: SPAM-LOW: [flexcoders] Custom Component not visible on stage
I'm really talking from a stance of someone who doesn't fully grok how this works yet. With that disclaimer... In my experience, making a component display is not as simple as extending it and calling super() in the constructor. Size it around your children makes sense. Figure out how Canvas does it, and you should be able to figure out why yours isn't working. Or access the children to figure out the size of your custom component. droponrcll wrote: --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com, Jeffry Houser [EMAIL PROTECTED] wrote: I've had similar problems when creating AS3 components. Look into updateDisplayList. I believe you also have to make sure that your custom component has a width and height specified. You can always dig through the canvas code to figure out why that works, and use that info to figure out why yours doesn't. The component really needs to size itself around its children, so I need to find a way to do it without specifying a width and height. My class is extending Canvas, so it should be using all Canvas's methods already, right? -- Jeffry Houser, Technical Entrepreneur, Software Developer, Author, Recording Engineer AIM: Reboog711 | Phone: 1-203-379-0773 -- My Company: http://www.dot-com-it.com My Podcast: http://www.theflexshow.com My Blog: http://www.jeffryhouser.com