Janis, I think you need to make the path to the icon gif relative to the component file. So, if your component file is in "root/components" and icon.gif is in "root/" then the path needs to be:
imageInstance.source = "../icon.gif"; BTW, there is a good list for Flex coders here: http://tech.groups.yahoo.com/group/flexcoders/ HTH -Jim -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Janis Radins Sent: Wednesday, January 10, 2007 12:37 PM To: [email protected] Subject: [Flashcoders] Some AS3 components troubles Hey people! 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.aswith 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 _______________________________________________ [email protected] To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com

