Thanks From: Tracy Spratt
[mailto:[EMAIL PROTECTED] Just jumping in here, but selectedChild
is/wants a reference to the actual container component in the view stack.
So unless you have a reference to the container in the data property of the
item, this won’t work. What Matt is saying is that if the data property
contains the “id” for the viewstack component, then you can usethe
bracket notation to get a reference to the actual object. this[“myComponentId”] is
saying “return the property of this(the application or component) that is
named “myComponentId””. It is esentially the same as saying
eval(“myComponentId”) So selectedChild =
this[“myComponentId”] is getting a ref to the real child component. From: Rob
[mailto:[EMAIL PROTECTED] Hi Matt, Thanks for the reply…what you coded
is (I think) exactly what I did, but doesn’t work. An example of
what I have is: function x(event:Object):Void
viewStack.selectedChild=event.target.selectedItem.data; } The function is called on a list change
event, and the dataProvider for the list has the data property set to the id of
a container in the viewstack. TIA for any info. From: Matt Chotin
[mailto:[EMAIL PROTECTED] The selectedChild is a reference to the
actual object that you would find at the selectedIndex. So what is the data
that you have that will help you determine which object you want to
select? If each element of the dataProvider is the id of the child (this
means that every child of your ViewStack has an id), you could simply do
myViewStack.selectedChild = this[data]. Not sure what you’re trying to
really do here. From: Rob
[mailto:[EMAIL PROTECTED] Ok, I’ve been coding too long
today…I need to take a data attribute from a dataProvider and cast into
an Object that can be used in the statement
ViewStack.selectedChild=object…I know this is easy but am having some
brain-pain at the moment…TIA for any info. Regards. From: Rob [mailto:[EMAIL PROTECTED]
Oops…it appears I have to use the
data attribute to create a new object and use that…nevermind J From: Rob
[mailto:[EMAIL PROTECTED] Hi, Just curious…the MM docs indicate that setting of the
ViewStack.selectedChild can only be done in AS and not in MXML; however, it
appears from the MM example and my tests that the reverse is true… I have a script that is attempting to set the selectedChild
to a value that matches the id attribute of one of the ViewStack’s but it
doesn’t work….the ViewStack.selectedIndex works
great...what’s up with the selectedChild? viewStack.selectedChild=event.target.selectedItem.attributes.data; TIA for any info. Regards.
|