Let me clarify, it appears that you can't attach images to UIcomponents!
In this case, the canvas shows up ,but not the Image. And i know the Image attach works in a plain old Application tag function:

    public class Carousel extends UIComponent
    {

        function Carousel() {
            trace( "\n *** Carousel()");
            var pic:Image = new Image();
            pic.source = "assets/SG_ID_LoneTree.jpg";   
            addChild( pic );
            trace( "pic: "+pic );
           
            var c:Canvas = new Canvas();
                c.width = 200;
                c.height = 150;
                c.setStyle( "backgroundColor", 0xDDDDDD );
                c.setStyle( "borderStyle", "solid" );   
                           
                addChild( c );          
        }
}

On 7/14/06, slangeberg <[EMAIL PROTECTED]> wrote:
I have an image that loads fine, when attaching it to main application (mxml):

            var pic:Image = new Image();
            pic.source = "assets/SG_ID_LoneTree.jpg";  
            addChild( pic );

However, it doesn't show up in my UIComponent class, which will currently display a colored Canvas:

    public class CarouselItem extends UIComponent
    {
        public var angle:Number;
        public var depth:int;
        //public var speed:Number;
       
        public var item:DisplayObject;
        public var refItem:DisplayObject;
       
       
        function CarouselItem( item:DisplayObject ) {           
            this.item = addChild( item );
        }
    }

And in my main app I call:

<mx:Script>
    <![CDATA[
        import mx.controls. Image;
        import mx.containers.Canvas ;
        import com.cpile.carousel.*;
       
        function start():void {

            for( var i:int = 0; i<5; i++ )
            {
                var c:Canvas = new Canvas();
                c.width = 200;
                c.height = 150;
                c.setStyle( "backgroundColor", 0xDDDDDD );
                c.setStyle( "borderStyle", "solid" );   
                           
                menu.addItem( c );
            }       
            var pic:Image = new Image();
            pic.source = "assets/SG_ID_LoneTree.jpg";            
       
            menu.addItem ( pic );
          
        }
    ]]>
</mx:Script>
    <comps:Carousel id="menu" />

: : ) Scott



--

: : ) Scott __._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to