You can’t do new Thumbnail() because it’s a visual component.  You would need to do something like createChild.  However with a TileList the proper way of doing this is the cellRenderer, so that’s what I’d do.

 

Matt

 


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com]
Sent: Friday, April 15, 2005 8:42 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] problem with TileList

 

Thanks Kristopher,

i was trying with img.source so i did that mistake. I have already done the correction but the problem is that i  don't see images yet. I see the items added to TileList and they're selectable but with no image in it.  If  i use cellRenderer and dataProvider of TileList everything's ok.

Duccio

 

----- Original Message -----

Sent: Friday, April 15, 2005 5:09 PM

Subject: RE: [flexcoders] problem with TileList

 

Duccio,

 

I think the problem is this line:

 

  img.load=data.thumb;

 

You are using "load" as if it were a settable property, but it is actually a method of the the Image class and would therefore be used with the following syntax:

 

  img.load(data.thumb)

 

Alternately, you could set the "source" property of the img object to achieve the same result:

 

  img.source = data.thumb

 

Kris

 

--

 

Kristopher Schultz

Developer

 

Resource Interactive

p: 614.410.2123

 

 


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Duccio
Sent: Friday, April 15, 2005 8:01 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] problem with TileList

Hi,

i am studying  the Foto viewer example.  I have a problem loading images in a TileList, seems like no image loads. If  i use cellRenderer and dataProvider of TileList everything's ok. Here is the source code:

 

Application intialize

function initApp() {
 albumSrv.send();

 

}

 

function albumSrvResult(event) {
 album=albumSrv.result.album;
 photoCount=album.photo.length;
 list.selectedIndex=0;
 currentPhoto=album.photo[list.selectedIndex];
 
 var thumb:Thumbnail;

 

 for (var i=0; i<photoCount; i++) {
  thumb=new Thumbnail();
  thumb.setValue(i, album.photo[i]);
  list.addItem(thumb); //the TileList
  
   } 
}

<?xml version="1.0" encoding="utf-8"?>

 

Thumbnail.mxml

<mx:VBox xmlns:mx="http://www.macromedia.com/2003/mxml"
    vScrollPolicy="off"
    hScrollPolicy="off"
    borderStyle="none"
    horizontalAlign="center">
    <mx:Script>
        var data: Object;

 

        function setValue(str: String, item: Object) {
            if (data == item) return;
            if (item==undefined) {
                visible = false;
                return;
            } else {
                img.visible = false;
                data="">     img.load=data.thumb;
    img.visible=true;
                visible=true;
    
    mx.core.Application.alert("data thumb :" +data.thumb);
            }
        }
  function setWidth(width: Number) {
  //mx.core.Application.alert("testProperty :" +width);
   img.width=width;
        }

 


    </mx:Script>
 
    <mx:Image id="img" />

 

</mx:VBox>


No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.11 - Release Date: 14/04/2005

 



Yahoo! Groups Links

Reply via email to