I made a stupid typo in the original post. Sorry for that.

Here is source which can compile and run. Hope someone can explain
what I am doing wrong.

- Thomas Hagen


<?xml version="1.0" encoding="utf-8"?>
<mx:Application  xmlns:mx="http://www.adobe.com/2006/mxml";
applicationComplete="appComplete();" layout="absolute" xmlns:ns1="*"
xmlns:ns2="Components.*">

        <mx:Script>
        <![CDATA[
                
                        import mx.controls.Image;
                        
                        [Bindable]
                        [Embed(source="./myPic.jpg")]
                        public var myPic1:Class;

                        [Bindable]
                        public var myPic2:Image = new Image();

                private function appComplete() : void
                {
                                myPic2.source = "./myPic.jpg";
                                
                        }
        ]]>

    </mx:Script>

        <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml";>
                <mx:TabNavigator>
                        <mx:Canvas label="Works!">
                                <mx:TileList>
                                        <mx:dataProvider>
                                                <mx:Array>
                                                        <mx:Object 
label="Label" icon="{myPic1}" />
                                                </mx:Array>
                                        </mx:dataProvider>
                                </mx:TileList>
                        </mx:Canvas>                    
                        <mx:Canvas label="Does not work!">
                                <mx:TileList>
                                        <mx:dataProvider>
                                                <mx:Array>
                                                        <mx:Object 
label="Label" icon="{myPic2}" />
                                                </mx:Array>
                                        </mx:dataProvider>
                                </mx:TileList>
                        </mx:Canvas>                    
                </mx:TabNavigator>
        </mx:Canvas>
        
</mx:Application>



--- In flexcoders@yahoogroups.com, "Thomas Hagen Johansen" <[EMAIL PROTECTED]>
wrote:
>
> This works:
> 
> [Embed(source="./myPic.jpg")]
> public var myPic:Class;
> 
> ...
> 
> <mx:TileList>
>   <mx:dataProvider>
>     <mx:Array>
>       <mx:Object label="Blah" icon="{myPic}" />
>     </mx:Array>
>   </mx:dataProvider>
> </mx:TileList>
> 
> ----------------------------------------------------------
> 
> This does not work:
> 
> public var myPic:Image = new Image();
> myImage.source = "./myPic.jpg";
> 
> ...
> 
> <mx:TileList>
>   <mx:dataProvider>
>     <mx:Array>
>       <mx:Object label="Blah" icon="{myPic}" />
>     </mx:Array>
>   </mx:dataProvider>
> </mx:TileList>
> 
> Anyone knows why this does not work?
> 
> Thank you very much in advance!
> 
> 
> - Thomas Hagen
>



Reply via email to