In Beta 3, target is changed to relativeTo:
<mx:AddChild relativeTo ="{v1}">
From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of rama satoskar
Sent: Friday, May 26, 2006 9:44 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] View states
problem in beta3
hi all,
is there a problem in the following code
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
>
<!-- The Application class states property defines the
view
states. -->
<mx:states>
<!-- Flex enters the newButton
state when you click button b1 -->
<mx:State
name="newButton">
<!-- Add
a Button child control to the v1 VBox control. -->
<mx:AddChild target="{v1}">
<mx:Button label="New Button" />
</mx:AddChild>
<!--
Disable the "Add a Button" button to prevent adding
more than
one button. -->
<mx:SetProperty target="{b1}" name="enabled"
value="false" />
</mx:State>
</mx:states>
<!-- The application's child controls define the base
state. -->
<mx:VBox id="v1">
<mx:Button id="b1"
label="Add a Button"
click="currentState='newButton'"/>
<!-- clicking the following
button returns Flex to the bas
state. -->
<mx:Button label="Remove
Added Button" click="currentState=''"/>
</mx:VBox>
</mx:Application>
i seem to get a error each time saying:
Error: Cannot add a child that is already parented.
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
YAHOO! GROUPS LINKS
|