Hi, Looking at your code, you might want to try searching the Flex Docs for component creation and component life cycle.
It's a huge no-no what you are doing in the constructor. 1. Never create instances in a constructor(createChildren()). 2. Never call addChild in a constructor (createChildren()). 3. You havn't implemented measure() 4. you haven't implemented updateDisplayList() 5. SInce you are subclassing UIComponent, you have to call sizing on your children. It is not a Container, so it is not doing it for you. IE in updateDisplayList() override imageInstance.setActualSize(imageInstance.getExplicitOrMeasuredWidth(), imageInstance.getExplicitOrMeasuredHeight()); To name a few. Try correcting some of those problems and see what happens. Peace, Mike On 1/15/07, Janis Radins <[EMAIL PROTECTED]> wrote:
Hey people! I already tried to ask in here but no one answered, then I tried flashcoders list and no solution in there as well, so I'm trying one more time, maybe someone can explain where is my problem. I'm trying to make some pretty simple UI component in Flex and it seems like I'm missing something. I think I've read everything I could but I cannt find what is it I'm missing, maybe someone on this list knows wheres the problem. So what I am doing is: 1. I create some pretty simple MXML project just for test with this content <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" xmlns:myComp="components.*" layout="absolute"> <myComp:TestComponent></myComp:TestComponent> </mx:Application> Pretty simple. xmlns:myComp="components.*" defines that components can be found in folder named components in root of project, where I have this file TestComponent.as with following content package components { import mx.core.UIComponent; import mx.controls.Image; import flash.display.Shape; public class TestComponent extends UIComponent { private var imageInstance:Image = null; public function TestComponent() { super(); imageInstance = new Image(); imageInstance.source = "icon.gif"; addChild(imageInstance); trace("TestComponent initialized!"); var shape:Shape = new Shape(); shape.graphics.beginFill(0xFF0000); shape.graphics.drawCircle(50,50,25); addChild(shape); } } } " icon.gif" is bitmap stored in root folder of project. Seems like pretty stright forward and theres nothing to break, but it isnt so. Shape appears, which make me think that component instance is initialized and placed in display list. But I really have bad luck with creating mx.controls.Image i think I tried everything with no luck. There must be something I'm missing, but I have no idea what is it :) Oh, and when I tried to extend some component directly it works, seems like thers no blank components for me! Any help will be apreciated! Jānis
-- Teoti Graphix http://www.teotigraphix.com Blog - Flex2Components http://www.flex2components.com You can find more by solving the problem then by 'asking the question'.

