Normally you do not put display objects in the array collection, just
data, then the renderer creates the display object to display the data.

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of samdafi
Sent: Thursday, January 10, 2008 7:06 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Binding an arraycollection of Loaders

 

Hello,

I'm just learning flex and am trying to make a simple gallery app that
grabs albums from a feed. Here's a brief description:

ModelLocator has an
-Album has
--Photos, an ArrayCollection of
---Photo, has a
----thumbnailLoader, a loader that contains a
-----Bitmap

There is a list of galleries, and upon selecting one, the album is
populated with photos and a viewstate containing this TileList is set
to current:

<mx:TileList id="thumbTile" dataProvider="{model.album.photos}"
change="switchPhoto(thumbTile.selectedIndex)">
<mx:itemRenderer>
<mx:Component>
<mx:Image source="{data.thumbnailLoader.content}"/> <!--the problem
is here -->
</mx:Component>
</mx:itemRenderer>
</mx:TileList>

On loading the first album, everything works just fine. After going
back to the initial viewstate, clearing the ArrayCollection, and
repopulating it, I get an error when switching the viewstate to show
another album (or the same one a second time):

ArgumentError: Error #2025: The supplied DisplayObject must be a child
of the caller.
at flash.display::DisplayObjectContainer/removeChild()
(I don't recognize any of the code in the call stack, and make no
calls to removeChild() myself)

If I remove the binding in the itemRenderer, the rest of the app works
but there are no longer thumbnails in my tilelist. Does this sound
familiar to anybody?

I realize it's a little vague without more code, but there's a lot of
it and I'm a beginner so I want to test the waters first...

Thanks!

 

Reply via email to