fixed few issue and updated state code
diff --git a/TourDeFlex/TourDeFlex3/src/formatters/PhoneFormatterExample.mxml b/TourDeFlex/TourDeFlex3/src/formatters/PhoneFormatterExample.mxml
index 532afef..99c90d2 100755
--- a/TourDeFlex/TourDeFlex3/src/formatters/PhoneFormatterExample.mxml
+++ b/TourDeFlex/TourDeFlex3/src/formatters/PhoneFormatterExample.mxml
@@ -46,7 +46,7 @@
<mx:PhoneNumberValidator id="pnVal" source="{phone}" property="text"
allowedFormatChars=""/>
- <fx:Declarations>
+ </fx:Declarations>
<mx:Panel title="PhoneFormatter Example" width="75%" height="75%"
paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10">
diff --git a/TourDeFlex/TourDeFlex3/src/formatters/ZipCodeFormatterExample.mxml b/TourDeFlex/TourDeFlex3/src/formatters/ZipCodeFormatterExample.mxml
index 003a111..7151f69 100755
--- a/TourDeFlex/TourDeFlex3/src/formatters/ZipCodeFormatterExample.mxml
+++ b/TourDeFlex/TourDeFlex3/src/formatters/ZipCodeFormatterExample.mxml
@@ -45,7 +45,7 @@
<mx:ZipCodeFormatter id="zipFormatter" formatString="#####-####"/>
<mx:ZipCodeValidator id="zcVal" source="{zip}" property="text" allowedFormatChars=""/>
- <fx:Declarations>
+ </fx:Declarations>
<mx:Panel title="ZipCodeFormatter Example" width="75%" height="75%"
paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10">
diff --git a/TourDeFlex/TourDeFlex3/src/printing/PrintDataGridExample.mxml b/TourDeFlex/TourDeFlex3/src/printing/PrintDataGridExample.mxml
index aeb1bdf..375068b 100755
--- a/TourDeFlex/TourDeFlex3/src/printing/PrintDataGridExample.mxml
+++ b/TourDeFlex/TourDeFlex3/src/printing/PrintDataGridExample.mxml
@@ -23,6 +23,7 @@
<fx:Script>
<![CDATA[
+ import mx.core.FlexGlobals;
import mx.printing.*;
import mx.collections.ArrayCollection;
import FormPrintView;
@@ -62,7 +63,7 @@
if (printJob.start()) {
// Create a FormPrintView control as a child of the current view.
var thePrintView:FormPrintView = new FormPrintView();
- Application.application.addChild(thePrintView);
+ FlexGlobals.topLevelApplication.addChild(thePrintView);
//Set the print view properties.
thePrintView.width=printJob.pageWidth;
@@ -111,7 +112,7 @@
}
}
// All pages are queued; remove the FormPrintView control to free memory.
- Application.application.removeChild(thePrintView);
+ FlexGlobals.topLevelApplication.removeChild(thePrintView);
}
// Send the job to the printer.
printJob.send();
diff --git a/TourDeFlex/TourDeFlex3/src/states/StatesExample.mxml b/TourDeFlex/TourDeFlex3/src/states/StatesExample.mxml
index cfa6e29..291784a 100755
--- a/TourDeFlex/TourDeFlex3/src/states/StatesExample.mxml
+++ b/TourDeFlex/TourDeFlex3/src/states/StatesExample.mxml
@@ -21,48 +21,36 @@
<!-- Define one view state, in addition to the base state.-->
<mx:states>
- <mx:State name="Register">
- <mx:AddChild relativeTo="{loginForm}" position="lastChild">
- <mx:target>
- <mx:FormItem id="confirm" label="Confirm:">
- <mx:TextInput/>
- </mx:FormItem>
- </mx:target>
- </mx:AddChild>
- <mx:SetProperty target="{loginPanel}" name="title" value="Register"/>
- <mx:SetProperty target="{loginButton}" name="label" value="Register"/>
- <mx:SetStyle target="{loginButton}"
- name="color" value="blue"/>
- <mx:RemoveChild target="{registerLink}"/>
- <mx:AddChild relativeTo="{spacer1}" position="before">
- <mx:target>
- <mx:LinkButton id="loginLink" label="Return to Login" click="currentState=''"/>
- </mx:target>
- </mx:AddChild>
- </mx:State>
+ <mx:State name="default" />
+ <mx:State name="register" />
</mx:states>
<!-- Define a Panel container that defines the login form.-->
- <mx:Panel title="Login" id="loginPanel"
+ <mx:Panel title="Login" title.register="Register" id="loginPanel"
horizontalScrollPolicy="off" verticalScrollPolicy="off"
paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10">
<mx:Text width="100%" color="blue"
text="Click the 'Need to Register?' link to change state. Click the 'Return to Login' link to return to the base state."/>
- <mx:Form id="loginForm" >
+ <mx:Form id="loginForm">
<mx:FormItem label="Username:">
<mx:TextInput/>
</mx:FormItem>
<mx:FormItem label="Password:">
<mx:TextInput/>
</mx:FormItem>
+ <mx:FormItem id="confirm" label="Confirm:" includeIn="register">
+ <mx:TextInput/>
+ </mx:FormItem>
</mx:Form>
<mx:ControlBar>
<mx:LinkButton id="registerLink" label="Need to Register?"
- click="currentState='Register'"/>
+ click="currentState='register'" excludeFrom="register"/>
+ <mx:LinkButton id="loginLink" label="Return to Login" click="currentState='default'"
+ includeIn="register" />
<mx:Spacer width="100%" id="spacer1"/>
- <mx:Button label="Login" id="loginButton"/>
+ <mx:Button label="Login" label.register="register" color.register="blue" id="loginButton" />
</mx:ControlBar>
</mx:Panel>
</mx:Application>
\ No newline at end of file
diff --git a/TourDeFlex/TourDeFlex3/src/states/TransitionExample.mxml b/TourDeFlex/TourDeFlex3/src/states/TransitionExample.mxml
index 358e9f8..0f22f95 100755
--- a/TourDeFlex/TourDeFlex3/src/states/TransitionExample.mxml
+++ b/TourDeFlex/TourDeFlex3/src/states/TransitionExample.mxml
@@ -21,30 +21,13 @@
<!-- Define one view state, in addition to the base state.-->
<mx:states>
- <mx:State name="Register">
- <mx:AddChild relativeTo="{loginForm}" position="lastChild">
- <mx:target>
- <mx:FormItem id="confirm" label="Confirm:">
- <mx:TextInput/>
- </mx:FormItem>
- </mx:target>
- </mx:AddChild>
- <mx:SetProperty target="{loginPanel}" name="title" value="Register"/>
- <mx:SetProperty target="{loginButton}" name="label" value="Register"/>
- <mx:SetStyle target="{loginButton}"
- name="color" value="blue"/>
- <mx:RemoveChild target="{registerLink}"/>
- <mx:AddChild relativeTo="{spacer1}" position="before">
- <mx:target>
- <mx:LinkButton id="loginLink" label="Return to Login" click="currentState=''"/>
- </mx:target>
- </mx:AddChild>
- </mx:State>
+ <mx:State name="default" />
+ <mx:State name="register" />
</mx:states>
<mx:transitions>
<!-- Define the transition from the base state to the Register state.-->
- <mx:Transition id="toRegister" fromState="*" toState="Register">
+ <mx:Transition id="toRegister" fromState="default" toState="register">
<mx:Sequence targets="{[loginPanel, registerLink, confirm, loginLink, spacer1]}">
<mx:RemoveChildAction/>
<mx:SetPropertyAction target="{loginPanel}" name="title"/>
@@ -56,9 +39,8 @@
</mx:Transition>
<!-- Define the transition from the Register state to the base state.-->
- <mx:Transition id="toDefault" fromState="Register" toState="*">
- <mx:Sequence targets="{[loginPanel, registerLink,
- confirm, loginLink, spacer1]}">
+ <mx:Transition id="toDefault" fromState="register" toState="default">
+ <mx:Sequence targets="{[loginPanel, registerLink, confirm, loginLink, spacer1]}">
<mx:RemoveChildAction/>
<mx:SetPropertyAction target="{loginPanel}" name="title"/>
<mx:SetPropertyAction target="{loginButton}" name="label"/>
@@ -70,26 +52,31 @@
</mx:transitions>
<!-- Define a Panel container that defines the login form.-->
- <mx:Panel title="Login" id="loginPanel"
+ <mx:Panel title="Login" title.register="Register" id="loginPanel"
horizontalScrollPolicy="off" verticalScrollPolicy="off"
paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10">
<mx:Text width="100%" color="blue"
text="Click the 'Need to Register?' link to change state. Click the 'Return to Login' link to return to the base state."/>
- <mx:Form id="loginForm" >
+ <mx:Form id="loginForm">
<mx:FormItem label="Username:">
<mx:TextInput/>
</mx:FormItem>
<mx:FormItem label="Password:">
<mx:TextInput/>
</mx:FormItem>
+ <mx:FormItem id="confirm" label="Confirm:" includeIn="register">
+ <mx:TextInput/>
+ </mx:FormItem>
</mx:Form>
<mx:ControlBar>
<mx:LinkButton id="registerLink" label="Need to Register?"
- click="currentState='Register'"/>
+ click="currentState='register'" excludeFrom="register"/>
+ <mx:LinkButton id="loginLink" label="Return to Login" click="currentState='default'"
+ includeIn="register" />
<mx:Spacer width="100%" id="spacer1"/>
- <mx:Button label="Login" id="loginButton"/>
+ <mx:Button label="Login" label.register="register" color.register="blue" id="loginButton" />
</mx:ControlBar>
</mx:Panel>
</mx:Application>
\ No newline at end of file
diff --git a/TourDeFlex/TourDeFlex3/src/validators/CreditCardValidatorExample.mxml b/TourDeFlex/TourDeFlex3/src/validators/CreditCardValidatorExample.mxml
index cfedf81..c541e43 100755
--- a/TourDeFlex/TourDeFlex3/src/validators/CreditCardValidatorExample.mxml
+++ b/TourDeFlex/TourDeFlex3/src/validators/CreditCardValidatorExample.mxml
@@ -23,15 +23,15 @@
import mx.controls.Alert;
</fx:Script>
- <!-- Define model for the credit card data. -->
- <mx:Model id="creditcard">
- <card>
- <cardType>{cardTypeCombo.selectedItem.data}</cardType>
- <cardNumber>{cardNumberInput.text}</cardNumber>
- </card>
- </mx:Model>
-
- <fx:Declarations>
+ <fx:Declarations>
+ <!-- Define model for the credit card data. -->
+ <fx:Model id="creditcard">
+ <card>
+ <cardType>{cardTypeCombo.selectedItem.data}</cardType>
+ <cardNumber>{cardNumberInput.text}</cardNumber>
+ </card>
+ </fx:Model>
+
<mx:CreditCardValidator id="ccV"
cardTypeSource="{creditcard}" cardTypeProperty="cardType"
cardNumberSource="{creditcard}" cardNumberProperty="cardNumber"
@@ -39,7 +39,7 @@
cardTypeListener="{cardTypeCombo}"
cardNumberListener="{cardNumberInput}"
valid="Alert.show('Validation Succeeded!');"/>
- <fx:Declarations>
+ </fx:Declarations>
<mx:Panel title="CreditCardValidator Example" width="75%" height="75%"
paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10">
@@ -48,11 +48,11 @@
<mx:FormItem label="Card Type">
<mx:ComboBox id="cardTypeCombo">
<mx:dataProvider>
- <mx:Object label="American Express" data="American Express"/>
- <mx:Object label="Diners Club" data="Diners Club"/>
- <mx:Object label="Discover" data="Discover"/>
- <mx:Object label="MasterCard" data="MasterCard"/>
- <mx:Object label="Visa" data="Visa"/>
+ <fx:Object label="American Express" data="American Express"/>
+ <fx:Object label="Diners Club" data="Diners Club"/>
+ <fx:Object label="Discover" data="Discover"/>
+ <fx:Object label="MasterCard" data="MasterCard"/>
+ <fx:Object label="Visa" data="Visa"/>
</mx:dataProvider>
</mx:ComboBox>
</mx:FormItem>
diff --git a/TourDeFlex/TourDeFlex3/src/validators/EmailValidatorExample.mxml b/TourDeFlex/TourDeFlex3/src/validators/EmailValidatorExample.mxml
index 006c1db..bd1d3cb 100755
--- a/TourDeFlex/TourDeFlex3/src/validators/EmailValidatorExample.mxml
+++ b/TourDeFlex/TourDeFlex3/src/validators/EmailValidatorExample.mxml
@@ -27,7 +27,7 @@
<mx:EmailValidator source="{email}" property="text"
trigger="{myButton}" triggerEvent="click"
valid="Alert.show('Validation Succeeded!');"/>
- <fx:Declarations>
+ </fx:Declarations>
<mx:Panel title="EmailValidator Example" width="75%" height="75%"
paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10">
diff --git a/TourDeFlex/TourDeFlex3/src/validators/StringValidatorExample.mxml b/TourDeFlex/TourDeFlex3/src/validators/StringValidatorExample.mxml
index 982a141..8e28f64 100755
--- a/TourDeFlex/TourDeFlex3/src/validators/StringValidatorExample.mxml
+++ b/TourDeFlex/TourDeFlex3/src/validators/StringValidatorExample.mxml
@@ -30,7 +30,7 @@
minLength="4" maxLength="20"
trigger="{myButton}" triggerEvent="click"
valid="Alert.show('Validation Succeeded!');"/>
- <fx:Declarations>
+ </fx:Declarations>
<mx:Panel title="StringValidator Example" width="75%" height="75%"
paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10">