This content has been marked as final. Show 8 replies
Unfortunately it didn't work.
From the docs I get the impression that invalidateDisplayList is more of a UI thing than an internals thing. IE it marks a UI object as 'dirty' for redrawing later.
I'm reading the code to ViewStack/Container and I'm not sure you want the child descriptors.
Don't you want the Container.getChildAt() method instead? you can also use getChildByName() if you assign a name to the stack component.
I'd been using getChildByName in the past. It works fine with the design time components but not the run time. getChildAt won't work as the array of children in the viewStack doesn't include the panels added at run time. I would get an 'out of bounds' error.
I was using childDescriptors as a way of seeing what was in the viewstack array.
Interestingly enough the $numChildren attribute of the viewstack has the correct value.
"ethr" <firstname.lastname@example.org> wrote in message
> I'd been using getChildByName in the past. It works fine with the design
> components but not the run time. getChildAt won't work as the array of
> in the viewStack doesn't include the panels added at run time. I would get
> 'out of bounds' error.
I think getChildByName really works off of the id, despite the name of the
function. The id of a child created at design time is an integral part of
the object, whereas with one created at runtime it's just sort of "stuck
on", and isn't able to perform all functions of the id created in MXML.
Did you try to set viewstack.createChildrenPolicy="all" ?
By default, viewstack, accordion and the rest, do not create all children components, only the first visible one to save the initialisation time.
Tried it. No go.
I found a few bugs w/re to ViewStack and createChild in JIRA. Looks like it wasn't properly tested before it was shipped.
Here's what Im trying to achieve:
Box with a vertical divider. On the left side is a linkbar and a viewstack with n children on the right. One of the stack components has a datagrid with checkboxes for each linkbar entry. It lets you decide whether or not to display a given linkbar (and thus, a page) when the frame is loaded. I had the code working fine when I was loading all the viewstack components at design time.
So I try to get fancy and make a template. I load some components at design time and others at run time. Now the only components that I can reference (at run time) are those that are preloaded (IE at design).
Its my understanding (albeit limited) that the MXML compiler turns all that XML into actionscript. The trick seems to be discovering how it interprets the design time items vs those that Im trying to add later.
As far as I understand, you are trying to use the dynamic object within the viewstack component.
If this so, you should use events to synchronise object creation and control. I.e. if you create any object in AS, then add this object as a child, you won't be able to access it's properties straight away, you have to wait for creationComplete event at least. If you adding a child to the container, you have to wait for the event "added" (or whatever it is called).
If your thing works when all objects are created from MXML and don't work when you dynamically create them from AS, the first thing you should check - how do you synchronise objects.
Hope this helps.