RE: [flexcoders] Disappearing images in custom cell renderer

2005-05-18 Thread Tim Blair
Manish,

> What happens if you set 'source' directly instead of using 
> binding?  Try it.

Unfortunately, because of the way the data is fetched from the server,
the data required (i.e. the thumbnail URL) may not be back before the
component is initialised, hence the binding.  But your suggestion did
point me in the direction of a fix...

It seems that there was a problem initially setting the source as
effectively a non-existant image and then overwriting that when the
"proper" URL was actually retrieved.  What I ended up doing was not
initially specifying a source for the  tag, but then when the
appropriate asset data had been retrieved from the server, using an
explicit img.load() call to load the thumbnail.

So now the image source gets (re)set when and only when the effective
"source" is both a non-empty string and is different to the current
source.  Seems to be doing the job!

Cheers,

Tim.

--
---
Badpen Tech - CF and web-tech: http://tech.badpen.com/
---
RAWNET LTD - independent digital media agency
"We are big, we are funny and we are clever!"
 New site launched at http://www.rawnet.com/
---
This message may contain information which is legally
privileged and/or confidential.  If you are not the
intended recipient, you are hereby notified that any
unauthorised disclosure, copying, distribution or use
of this information is strictly prohibited. Such
notification notwithstanding, any comments, opinions,
information or conclusions expressed in this message
are those of the originator, not of rawnet limited,
unless otherwise explicitly and independently indicated
by an authorised representative of rawnet limited.
---


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 




Re: [flexcoders] Disappearing images in custom cell renderer

2005-05-17 Thread Manish Jethani
On 5/17/05, Tim Blair <[EMAIL PROTECTED]> wrote:

[...]

>  2. displays correctly, then after a second or so vanishes;
>  3. nothing is displayed.
[...]

>   asset = Asset(oItem);

What happens if you set 'source' directly instead of using binding?  Try it.


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 




[flexcoders] Disappearing images in custom cell renderer

2005-05-17 Thread Tim Blair
What is it with me and images at the moment...?

Anyway, I'm having trouble with displaying thumbnails in a custom cell
renderer within a TileList component.  The code for the cell renderer is
displayed below (AssetThumbnail.mxml) and the line that defines the
TileList is also shown (ThumbnailView.mxml).

When the user clicks on a given item, a search is performed which
populates the aAssetSearch array with the appropriate Asset instances to
display thumbnails for; this is then bound to the TileList as the
dataProvider.  When the list of images are displayed, one of the
following happens:

 1. the thumbnail displays correctly;
 2. displays correctly, then after a second or so vanishes;
 3. nothing is displayed.

My guess is that #3 is actually #2 happening very quickly so the "in
between" redraw doesn't actually happen.  I can often get the missing
images to redisplay by performing a new search and then going back to
the original, at which point the original search's assets have already
been pulled back from the database and cached.  Sometimes this can be
achieved by scrolling the TileList up and down to redraw the appropriate
cells.  Neither of these two methods either works 100% of the time, and
quite often the cells remain blank.

This pointed me towards the thought that there was something strange
going on with the Asset instances that meant they weren't returning the
appropriate URL for the image, or it was being returned and then reset.
However, I tried adding a trace into the dynamic "get" function for the
thumbnail URL (see code for Asset.as below) and all looks fine (i.e. it
returned the URL correctly).

Has anyone got any idea why this may be happening?

Thanks,

Tim.


ThumbnailView.mxml:
---





AssetThumbnail.mxml:



http://www.macromedia.com/2003/mxml";
 width="100%" height="100%" horizontalAlign="center"
 verticalAlign="middle" toolTip="{asset.title}">

  
  
  

  
  
  




Asset.as


[ChangeEvent("thumbURLChanged")]
public function get thumbURL(): String {
return AssetManager.getInstance().getAssetPath(_thumbfile,
   true,
   "thumb");
}
public function set thumbURL(sURL: String): Void {
dispatchEvent( {type:"thumbURLChanged"} );
}


--
---
Badpen Tech - CF and web-tech: http://tech.badpen.com/
---
RAWNET LTD - independent digital media agency
"We are big, we are funny and we are clever!"
 New site launched at http://www.rawnet.com/
---
This message may contain information which is legally
privileged and/or confidential.  If you are not the
intended recipient, you are hereby notified that any
unauthorised disclosure, copying, distribution or use
of this information is strictly prohibited. Such
notification notwithstanding, any comments, opinions,
information or conclusions expressed in this message
are those of the originator, not of rawnet limited,
unless otherwise explicitly and independently indicated
by an authorised representative of rawnet limited.
---


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/