Last night I was doing an application using Flash Builder 4.6. I was stuck in a point about transitions in an iOS application. I could have used an Add-Delete View plan but instead I tried something else. Instead I could have used Add-Delete View plan; I tried another: navigator.pushView(YourViewNameWithoutExtension); Assume we have 2 mxml pages in our application. "iMediaHomeView" and "Facebook" for example.FaceBook.mxml: <?xml version="1.0" encoding="utf-8"?><s:View xmlns:fx="http://ns.adobe.com/mxml/2009"xmlns:s="library://ns.adobe.com/flex/spark"actionBarVisible="true" color="#FF0000" overlayControls="false" tabBarVisible="true"title="Facebook"> <fx:Script> <![CDATA[ function GetBack(){navigator.pushView(iMediaHomeView);} ]]> </fx:Script> <fx:Declarations> <!-- Place non-visual elements (e.g., services, value objects) here --> </fx:Declarations> <s:Button x="25" y="734" label="All Sites" color="#000000"/> <s:Button x="515" y="735" label="Exit" color="#030303"/> <s:Button x="289" y="734" label="Back" color="#000000" click="GetBack();"/></s:View> iMediaHomeView.mxml: <?xml version="1.0" encoding="utf-8"?><s:View xmlns:fx="http://ns.adobe.com/mxml/2009"xmlns:s="library://ns.adobe.com/flex/spark"actionBarVisible="true" color="#FF0000" overlayControls="false" tabBarVisible="true"title="iMedia"> <fx:Script> <![CDATA[ function Show_Facebook(){navigator.pushView(Facebook);} ]]> </fx:Script> <fx:Declarations> <!-- Place non-visual elements (e.g., services, value objects) here --> </fx:Declarations> <s:Image x="177" y="24" width="128" height="128" scaleMode="stretch" smooth="true" smoothingQuality="high" source="assets/facebook.png" click="Show_Facebook_();"/> <s:Button x="515" y="735" label="Exit" color="#030303"/></s:View> Let me show you the output images:As Default iMediaHomeView.mxml file is being displayed according to my application. After we click on Facebook icon it links to my FaceBook view object. When I click on the Back button it again shows my homepage "iMediaHomeView". That way I found a way to wander between views. Hope it will be useful for you, too.
navigator.pushView(YourViewNameWithoutExtension);
Assume we have 2 mxml pages in our application. "iMediaHomeView" and "Facebook" for example.FaceBook.mxml:
<?xml version="1.0" encoding="utf-8"?><s:View xmlns:fx="http://ns.adobe.com/mxml/2009"xmlns:s="library://ns.adobe.com/flex/spark"actionBarVisible="true" color="#FF0000" overlayControls="false" tabBarVisible="true"title="Facebook"> <fx:Script> <![CDATA[ function GetBack(){navigator.pushView(iMediaHomeView);} ]]> </fx:Script> <fx:Declarations> <!-- Place non-visual elements (e.g., services, value objects) here --> </fx:Declarations> <s:Button x="25" y="734" label="All Sites" color="#000000"/> <s:Button x="515" y="735" label="Exit" color="#030303"/> <s:Button x="289" y="734" label="Back" color="#000000" click="GetBack();"/></s:View>
<?xml version="1.0" encoding="utf-8"?><s:View xmlns:fx="http://ns.adobe.com/mxml/2009"xmlns:s="library://ns.adobe.com/flex/spark"actionBarVisible="true" color="#FF0000" overlayControls="false" tabBarVisible="true"title="Facebook">
<fx:Script> <![CDATA[
function GetBack(){navigator.pushView(iMediaHomeView);}
]]> </fx:Script>
<fx:Declarations> <!-- Place non-visual elements (e.g., services, value objects) here --> </fx:Declarations> <s:Button x="25" y="734" label="All Sites" color="#000000"/> <s:Button x="515" y="735" label="Exit" color="#030303"/> <s:Button x="289" y="734" label="Back" color="#000000" click="GetBack();"/></s:View>
<?xml version="1.0" encoding="utf-8"?><s:View xmlns:fx="http://ns.adobe.com/mxml/2009"xmlns:s="library://ns.adobe.com/flex/spark"actionBarVisible="true" color="#FF0000" overlayControls="false" tabBarVisible="true"title="iMedia"> <fx:Script> <![CDATA[ function Show_Facebook(){navigator.pushView(Facebook);} ]]> </fx:Script> <fx:Declarations> <!-- Place non-visual elements (e.g., services, value objects) here --> </fx:Declarations> <s:Image x="177" y="24" width="128" height="128" scaleMode="stretch" smooth="true" smoothingQuality="high" source="assets/facebook.png" click="Show_Facebook_();"/> <s:Button x="515" y="735" label="Exit" color="#030303"/></s:View>
<?xml version="1.0" encoding="utf-8"?><s:View xmlns:fx="http://ns.adobe.com/mxml/2009"xmlns:s="library://ns.adobe.com/flex/spark"actionBarVisible="true" color="#FF0000" overlayControls="false" tabBarVisible="true"title="iMedia">
function Show_Facebook(){navigator.pushView(Facebook);}
]]> </fx:Script> <fx:Declarations> <!-- Place non-visual elements (e.g., services, value objects) here --> </fx:Declarations> <s:Image x="177" y="24" width="128" height="128" scaleMode="stretch" smooth="true" smoothingQuality="high" source="assets/facebook.png" click="Show_Facebook_();"/> <s:Button x="515" y="735" label="Exit" color="#030303"/></s:View>
Let me show you the output images:As Default iMediaHomeView.mxml file is being displayed according to my application.
After we click on Facebook icon it links to my FaceBook view object.
When I click on the Back button it again shows my homepage "iMediaHomeView".
That way I found a way to wander between views.
Hope it will be useful for you, too.
Tabbed Structure in Flash Builder (iPhone) Applications
Build Your Own IPhone RSS Reader in 15 Minutes With Flash Builder
Your welcome :) Thank you for the feedback!
Thanks for good work
Thank you all for your feedbacks! @Mahesh: if we had like button,i'd click on your comment :) yes until Feb 8th :) But i will write as much as possible until that time. @Abhishek: yes,normally before going to army i was interested fully in Microsoft Technologies,later i realised something and began writing in different techs for comparison.That means in the future i will write not only in Microsoft Techs.
thanks for sharing it I hope that you shared as different article......in future
Very useful article. Thanks for sharing.