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.
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: