Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 08-10-2011, 08:23 AM   #1
Fitzy55
Registered User
 
Join Date: Dec 2007
Posts: 14
Default Flex Mobile Dynamic PopViews??

Hi Guys Thanks for your help in advance!!
I'm trying to dynamically load views. The view Names are stored in a xml file and i would like to be able to pass the name into the pushView() method so that I can load different views depending on what the user selects from the list.
Appreciate your help guys :-)
Here is what I have.



Code:
	<fx:Script>
		<![CDATA[
			import flash.utils.getDefinitionByName;
			
			import mx.collections.ArrayCollection;
			import mx.rpc.events.ResultEvent;
			
			import spark.events.IndexChangeEvent;
			import spark.transitions.SlideViewTransition;
			import spark.transitions.SlideViewTransitionMode;
			import spark.transitions.ViewTransitionDirection;

			
			[Bindable]
			protected var myXml:ArrayCollection;
			
			protected function getXmlData_resultHandler(event:ResultEvent):void
			{
				myXml = event.result.xmldata.section;
				
				
			}
			
			protected function mainList_changeHandler(event:IndexChangeEvent):void
			{
				
				//trace(mainList.selectedItem.sectionName);
				
				
				var viewName:Class = mainList.selectedItem.sectionName;
				var slideTrans:SlideViewTransition = new SlideViewTransition(); 
				slideTrans.direction = ViewTransitionDirection.LEFT; 
				slideTrans.mode = SlideViewTransitionMode.UNCOVER;* //or COVER and PUSH modes
				slideTrans.duration = 500;
				navigator.pushView(viewName, mainList.selectedItem, null, slideTrans);

			}
			
		]]>
	</fx:Script>
	<fx:Declarations>
		<!-- Place non-visual elements (e.g., services, value objects) here -->
		<s:HTTPService url="xml/xmldata.xml" id="getXmlData" result="getXmlData_resultHandler(event)"/>
	</fx:Declarations>
	<s:Image left="0" top="0" width="100%" height="300"  smooth="true"
			 smoothingQuality="default" source="images/feature.jpg" fillMode="clip"/>
	<s:List id="mainList" dataProvider="{myXml}" change="mainList_changeHandler(event)" left="0" right="0" top="299" bottom="0" labelField="sectionTitle">
			<s:itemRenderer>
				<fx:Component>
				<s:IconItemRenderer iconFunction="getIconURL" iconWidth="100" iconHeight="100" height="110" verticalAlign="top">
						<fx:Script>
							<![CDATA[
									protected function getIconURL(item:Object):String{
										return "icons/" + item.sectionIcon;
									}
							]]>
						</fx:Script>
Fitzy55 is offline   Reply With Quote
Old 08-10-2011, 11:39 PM   #2
drkstr
Flexpert
 
drkstr's Avatar
 
Join Date: Sep 2006
Location: Seattle, WA: USA
Posts: 1,587
Default

I think you forgot to ask a question...

What problem are you having that you would like to solve?
drkstr is offline   Reply With Quote
Old 12-13-2011, 02:03 AM   #3
kongoon
Registered User
 
Join Date: Dec 2011
Posts: 2
Default

i've some problem...
kongoon is offline   Reply With Quote
Old 12-13-2011, 03:16 AM   #4
kongoon
Registered User
 
Join Date: Dec 2011
Posts: 2
Thumbs up

i think this will help.....
Code:
protected function myList_changeHandler(event:IndexChangeEvent):void{
				var RSSItem:Object = myList.dataProvider.getItemAt(event.newIndex);

				var action:Object = myList.selectedItem;
				switch (action.id)
				{
					
					case "1":
						navigator.pushView(Thairath, RSSItem);
						break;
					
					
				}
kongoon is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:40 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.