Assuming that theory is correct, do you have an idea how I should fix 
it?  I've got a band-aid in place, which is to set 
creationPolicy="none" and then at the end of populating the array, 
call createComponentsFromDescriptors() on the ViewStack, but there's 
three problems with that:

1)  I'm loading everything at once instead of taking advantage of 
deferred instantiation to only load what's needed.

2)  I'm violating best practices by having my Cairngorm Command class 
manipulate the view directly.

3)  It feels icky.

--- In [email protected], "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> Oh hey, it might be that the SWFLoader is sized based on its 
content and
> in "all" its content has size of 0.  In "queued" it might be sized
> correctly.
> 
>  
> 
> ________________________________
> 
> From: [email protected] 
[mailto:[EMAIL PROTECTED] On
> Behalf Of ibid049
> Sent: Thursday, June 14, 2007 1:30 PM
> To: [email protected]
> Subject: [flexcoders] Re: Help Request : Deferred Instantiation and
> Bound SWFLoader
> 
>  
> 
> Yes, these are still not showing up long after the time it would 
take 
> to get them from the server. I understand the asynchronous bit. 
> Also, running the swf in debug mode shows that downloadedBytes == 
> totalBytes, so I'm sure it's done loading. Plus, like I said, 
> setting creationPolicy="queued" makes them show up (but not 
> creationPolicy="all"). I'm pretty sure it's some kind of timing 
> issue, like something to do with calling 
> createComponentsFromDescriptors() before the databinding classes 
have 
> updated the underlying dataprovider. 
> 
> But I might be talking out of my butt. There's a lot of "magic" 
> going on here under the hood that I don't understand.
> 
> --- In [email protected] <mailto:flexcoders%
40yahoogroups.com>
> , "Alex Harui" <aharui@> wrote:
> >
> > Yes, of course, but I'm not sure what's going on with repeater 
> bindings
> > and async loading.
> > 
> > 
> > 
> > ________________________________
> > 
> > From: [email protected] <mailto:flexcoders%
40yahoogroups.com>
> 
> [mailto:[email protected] <mailto:flexcoders%
40yahoogroups.com>
> ] On
> > Behalf Of Gordon Smith
> > Sent: Thursday, June 14, 2007 12:54 PM
> > To: [email protected] <mailto:flexcoders%
40yahoogroups.com> 
> > Subject: RE: [flexcoders] Re: Help Request : Deferred 
Instantiation 
> and
> > Bound SWFLoader
> > 
> > 
> > 
> > I tested locally. But shouldn't his SWFs eventually appear?
> > 
> > 
> > 
> > - Gordon
> > 
> > 
> > 
> > ________________________________
> > 
> > From: [email protected] <mailto:flexcoders%
40yahoogroups.com>
> 
> [mailto:[email protected] <mailto:flexcoders%
40yahoogroups.com>
> ] On
> > Behalf Of Alex Harui
> > Sent: Thursday, June 14, 2007 10:57 AM
> > To: [email protected] <mailto:flexcoders%
40yahoogroups.com> 
> > Subject: RE: [flexcoders] Re: Help Request : Deferred 
Instantiation 
> and
> > Bound SWFLoader
> > 
> > Remember that SWFLoading is asynchronous in server environments. 
> Not
> > sure Gordon tested locally or remotely. In an asynch environment, 
> the
> > swf will not complete loading and have its stuff available until 
> much
> > later, after a COMPLETE event (not creationComplete).
> > 
> > ________________________________
> > 
> > From: [email protected] <mailto:flexcoders%
40yahoogroups.com>
> 
> [mailto:[email protected] <mailto:flexcoders%
40yahoogroups.com>
> ] On
> > Behalf Of ibid049
> > Sent: Thursday, June 14, 2007 9:07 AM
> > To: [email protected] <mailto:flexcoders%
40yahoogroups.com> 
> > Subject: [flexcoders] Re: Help Request : Deferred Instantiation 
and
> > Bound SWFLoader
> > 
> > By the way, I can "fix" the problem by setting 
> > creationPolicy="queued" on the TabNavigator, or by setting it 
> > to "none" and then manually calling 
createComponentsFromDescriptors 
> > after the array is populated. But that band-aid short-circuits 
> > deffered instantiation, which I don't want to do.
> > 
> > Also interesting is that creationPolicy="all" does not fix the 
> > problem. This is why I was thinking it had something to do with 
the 
> > timing of defferred instantiation vs. the bindings or something. 
It 
> > almost acts like createComponentsFromDescriptors() is getting 
> called 
> > before the array is populated in the init() method, and then 
future 
> > calls to createComponentsFromDescriptors() don't fire or 
something.
> > 
> > --- In [email protected]
> <mailto:flexcoders%40yahoogroups.com>  <mailto:flexcoders%
> 40yahoogroups.com>
> > , "Gordon Smith" <gosmith@> wrote:
> > >
> > > Your code worked for me. I pasted it into a new FlexBuilder 
> > project, and
> > > I made three different SWFs -- screen1.swf, screen2.swf, and 
> > screen3.swf
> > > -- and put them in the same project folder. When I ran the app 
I 
> saw
> > > each SWF as I clicked the tabs. Perhaps all three of your SWFs 
are
> > > copies of the same SWF?
> > > 
> > > BTW, your 10-line init() method can be condensed into
> > > screens = new ArrayCollection(
> > > [ { incSWF: "screen1.swf" }, { incSWF: "screen2.swf" }, { 
> > incSWF:
> > > "screen3.swf" } ]);
> > > 
> > > - Gordon
> > > 
> > > ________________________________
> > > 
> > > From: [email protected]
> <mailto:flexcoders%40yahoogroups.com>  <mailto:flexcoders%
> 40yahoogroups.com>
> > 
> > [mailto:[email protected]
> <mailto:flexcoders%40yahoogroups.com>  <mailto:flexcoders%
> 40yahoogroups.com>
> > ] On
> > > Behalf Of ibid049
> > > Sent: Wednesday, June 13, 2007 12:36 PM
> > > To: [email protected] <mailto:flexcoders%
40yahoogroups.com>
> <mailto:flexcoders%
> 40yahoogroups.com> 
> > > Subject: [flexcoders] Help Request : Deferred Instantiation and 
> > Bound
> > > SWFLoader
> > > 
> > > 
> > > 
> > > Please forgive the intrusion of contacting you directly, but I 
> saw 
> > > you post several times on a related topic in the flexcoders 
> mailing 
> > > list, and - after not receiving a response to my own query on 
the 
> > > list, thought you might be able to save me hours of wall-to-
head-
> > > banging with just a few seconds worth of advice.
> > > 
> > > It seems that a viewStack component that contains a SWFLoader 
is 
> > not 
> > > successfully loading the SWF of the second and further panes. 
> > > Frankly, I can't believe that's the case, because surely 
someone 
> > else 
> > > would have noticed this. I assume it's an elementary error on 
my 
> > > part.
> > > 
> > > The following mxml demonstrates the problem. I'm binding the 
> > > repeater to an ArrayCollection of filenames that should be used 
> as 
> > a 
> > > source for SWFLoaders inside the Repeater. This only loads the 
> > first 
> > > pane, even when clicking on the second or third pane. 
> > > 
> > > I must be doing this in either a wrong or non-standard way. Is 
> > there 
> > > any way you could point to an easier way to accomplish what I'm 
> > > trying to do here?
> > > 
> > > <?xml version="1.0" encoding="utf-8"?>
> > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml
> <http://www.adobe.com/2006/mxml> 
> > <http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> 
> 
> > > <http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml>
> <http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> > 
> > " 
> > > layout="absolute" creationComplete="init()">
> > > <mx:Script>
> > > <![CDATA[
> > > import mx.controls.Alert;
> > > import mx.collections.ArrayCollection;
> > > 
> > > [Bindable] public var screens:ArrayCollection;
> > > 
> > > public function init():void {
> > > screens = new ArrayCollection();
> > > var firstScreen:Object = new Object();
> > > var secondScreen:Object = new Object
> > > ();
> > > var thirdScreen:Object = new Object();
> > > firstScreen.incSWF = 'screen1.swf';
> > > secondScreen.incSWF = 'screen2.swf';
> > > thirdScreen.incSWF = 'screen3.swf';
> > > screens.addItem(firstScreen);
> > > screens.addItem(secondScreen);
> > > screens.addItem(thirdScreen);
> > > }
> > > 
> > > ]]>
> > > </mx:Script>
> > > <mx:TabNavigator id="ScreenStack" top="22" left="0" 
> > > right="0" bottom="0">
> > > <mx:Repeater id="AppRepeater" 
> > > dataProvider="{screens}">
> > > <mx:Canvas id="AppCanvas" 
> > > width="100%" height="100%">
> > > <mx:SWFLoader 
> > > id="ScreenLoader" source="{AppRepeater.currentItem.incSWF}" 
> > > width="100%" height="100%"/> 
> > > </mx:Canvas>
> > > </mx:Repeater>
> > > </mx:TabNavigator>
> > > </mx:Application>
> > >
> >
>


Reply via email to