flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmcl...@apache.org
Subject [36/50] [abbrv] git commit: [flex-utilities] [refs/heads/master] - embed XML rather than load at runtime
Date Sat, 23 Aug 2014 04:45:43 GMT
embed XML rather than load at runtime


Project: http://git-wip-us.apache.org/repos/asf/flex-utilities/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-utilities/commit/749af7da
Tree: http://git-wip-us.apache.org/repos/asf/flex-utilities/tree/749af7da
Diff: http://git-wip-us.apache.org/repos/asf/flex-utilities/diff/749af7da

Branch: refs/heads/master
Commit: 749af7dae541a8c34fbded414f2552dc66aaf1a9
Parents: 8ded4b1
Author: Justin Mclean <jmclean@apache.org>
Authored: Mon Aug 18 14:37:30 2014 +1000
Committer: Justin Mclean <jmclean@apache.org>
Committed: Mon Aug 18 14:37:30 2014 +1000

----------------------------------------------------------------------
 .../layouts/CustomLayoutAnimatedExample.mxml    | 26 ++++++++++++--------
 1 file changed, 16 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/749af7da/TourDeFlex/TourDeFlex3/src/spark/layouts/CustomLayoutAnimatedExample.mxml
----------------------------------------------------------------------
diff --git a/TourDeFlex/TourDeFlex3/src/spark/layouts/CustomLayoutAnimatedExample.mxml b/TourDeFlex/TourDeFlex3/src/spark/layouts/CustomLayoutAnimatedExample.mxml
index 9b89803..c8964a0 100644
--- a/TourDeFlex/TourDeFlex3/src/spark/layouts/CustomLayoutAnimatedExample.mxml
+++ b/TourDeFlex/TourDeFlex3/src/spark/layouts/CustomLayoutAnimatedExample.mxml
@@ -20,8 +20,9 @@
 <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
 			   xmlns:s="library://ns.adobe.com/flex/spark" 
 			   xmlns:mx="library://ns.adobe.com/flex/mx" 
-			   applicationComplete="srv.send()" xmlns:local="*" xmlns:layouts="layouts.*"
-			   backgroundColor="0x323232" color="0xFFFFFF">
+			   xmlns:local="*" xmlns:layouts="layouts.*"
+			   backgroundColor="0x323232" color="0xFFFFFF"
+			   initialize="init()">
 	
 	<fx:Style>
 
@@ -39,7 +40,9 @@
 	<fx:Script>
 		<![CDATA[
 			import mx.collections.ArrayCollection;
-			import mx.rpc.events.ResultEvent;
+			import mx.rpc.xml.SimpleXMLDecoder;
+			import mx.rpc.xml.SimpleXMLEncoder;
+			import mx.utils.ArrayUtil;
 			
 			[Bindable]
 			private var items:ArrayCollection;
@@ -59,10 +62,17 @@
 			[Bindable]
 			private var _triband:Boolean = false;
 			
+			[Embed(source="data/catalog.xml", mimeType="application/octet-stream")]
+			private var XMLData:Class;
 			
-			private function resultHandler(event:ResultEvent):void
+			private function init():void
 			{
-				items = event.result.catalog.product as ArrayCollection;
+				var data:XML = XML(new XMLData());
+				var xmlDoc:XMLDocument = new XMLDocument(data);
+                var decoder:SimpleXMLDecoder = new SimpleXMLDecoder(true);
+                var object:Object = decoder.decodeXML(xmlDoc);
+				
+				items = object.catalog.product;
 				filteredItems = new ArrayCollection(items.source);
 				filteredItems.filterFunction = filter;
 			}
@@ -83,11 +93,7 @@
 			
 		]]>
 	</fx:Script>
-	
-	<fx:Declarations>
-		<s:HTTPService id="srv" url="data/catalog.xml" result="resultHandler(event)"/>
-	</fx:Declarations>
-	
+
 	<s:HGroup verticalAlign="middle" paddingLeft="8" left="50" top="5">
 		<s:Label text="Max Price:"/>
 		<s:HSlider id="priceSlider" minimum="0" maximum="1000" snapInterval="100" value="@{_maxPrice}"
change="selectionChange()"/>


Mime
View raw message