Hi Janis

Your component looks very different from a common Flex component. Flex
components follow a certain structure to create sub instances and update
their ui. I don't remember the url, but i think you can find some
introductory tutorials about Flex component development at Adobe's website.

Good luck,
Ralf.

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




--
Ralf Bokelberg <[EMAIL PROTECTED]>
Flex & Flash Consultant based in Cologne/Germany
Phone +49 (0) 221 530 15 35

Reply via email to