Hi Amy,
Thanks for the help.
I don't really want the other viewstack children involved.  When they are
the carousel seems to initiate correctly.  So I thought I'd set
creationPolicy to none for viewstack and initiate a
createComponentsFromDescriptors.  This is not working though as I get a null
error at the galleries.addEventListener CollectionChange Event.. here is
what the photoservice code looks like.
Any ideas where I go from here?

    public class PhotoService
    {
        private var service:HTTPService;
        private var app:PhotoViewer;

        [Bindable]
        public var galleries:ArrayCollection;

        public function PhotoService(url:String)
        {
            service = new HTTPService();
            service.url = url;
            service.addEventListener(ResultEvent.RESULT, resultHandler);
            service.send();
            galleries = new ArrayCollection([]);
            galleries.addEventListener(CollectionEvent.COLLECTION_CHANGE,
app.views.createComponentsFromDescriptors);
        }

        private function resultHandler(event:ResultEvent):void
        {
            var result:ArrayCollection = event.result.galleries.gallery is
ArrayCollection
                ? event.result.galleries.gallery as ArrayCollection
                : new
ArrayCollection(ArrayUtil.toArray(event.result.galleries.gallery));
            var temp:ArrayCollection = new ArrayCollection();
            var cursor:IViewCursor = result.createCursor();
            while (!cursor.afterLast)
            {
                temp.addItem(new Gallery(cursor.current));
                cursor.moveNext();
            }


            galleries = temp;


        }
    }
}










On Sat, Mar 20, 2010 at 5:13 PM, Amy <amyblankens...@bellsouth.net> wrote:

>
>
>
>
> --- In flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>,
> "cjsteury2" <cra...@...> wrote:
> >
> > Hey Pete,
> >
> > I see you had the same issue I am experiencing today.. and its been 1/2 a
> day so far of pulling out hair.
> >
> > Do you remember how you solved this 3 years ago???
>
> What you have is a race condition where the reset() function in Carousel.as
> assumes that you always have a valid Carousel, but of course the gallery
> property is beling set by a BindSetter that doesn't have anything to bind to
> until the PhotoService resultHandler has populated the photoService's
> galleries property.
>
> If you want to actually fix it, one way is to go into the PhotoService code
> and initialize the galleries variable to new ArrayCollection([new
> ArrayCollection)]);
>
> Not the cleanest solution, but that's kind of what you get when the code is
> too dependent on binding. The Carousel component unfortunately doesn't
> _know_ it's dependent on binding, so it isn't able to swallow up errors
> related to being passed in junk values via binding.
>
> If you want to just work around it, then you can just listen for
> COLLECTION_CHANGE on photoService.galleries, and switch the ViewStack pane
> once the result is received.
>
> HTH;
>
> Amy
>
>  
>

Reply via email to