incubator-flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p...@apache.org
Subject svn commit: r1370275 - in /incubator/flex/trunk/mustella/tests/genericloader: ./ genericLoad.mxml
Date Tue, 07 Aug 2012 14:24:10 GMT
Author: pent
Date: Tue Aug  7 14:24:10 2012
New Revision: 1370275

URL: http://svn.apache.org/viewvc?rev=1370275&view=rev
Log:
Mustella submission

Added:
    incubator/flex/trunk/mustella/tests/genericloader/
    incubator/flex/trunk/mustella/tests/genericloader/genericLoad.mxml

Added: incubator/flex/trunk/mustella/tests/genericloader/genericLoad.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/genericloader/genericLoad.mxml?rev=1370275&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/genericloader/genericLoad.mxml (added)
+++ incubator/flex/trunk/mustella/tests/genericloader/genericLoad.mxml Tue Aug  7 14:24:10
2012
@@ -0,0 +1,140 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+-->
+<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" 
+	paddingLeft="0" paddingRight="0" paddingTop="0" paddingBottom="0"
+	layout="absolute"  
+	height="375"
+	width="500"
+	applicationComplete="setAppEnd()" >
+
+
+	<mx:SWFLoader id="ldr" complete="subappLoaded(event)" init="show(event)" ioError="show(event)"
securityError="show(event)"/>
+
+	<mx:Script>
+	<![CDATA[
+	/**
+		In conjunction with Runner, this loads test swfs. 
+		Runner is invoked with a shell_swf argument
+		(which should be mustella.dir + genericLoad.swf),
+		it launches this swf, which calls Runner, asking for the nextSwf to load.
+		
+		The response from Runner is a url with a swf, such as
+		file:///c|my.swf or
+		http://localhost/my.swf
+
+
+	**/
+
+
+	import flash.net.URLLoader;
+	import flash.net.URLRequest;
+
+
+        private var urlLoader:URLLoader = null;
+        private var frontURL:String = null;
+        private var domain:String = null;
+
+
+        public function setAppEnd():void 
+        {
+
+                /// we call Runner for a swf to run. Call within the domain
+	        var tmp:String = root.loaderInfo.url;
+                frontURL = tmp.substring (0, tmp.indexOf (":"));
+                domain = tmp.substring (tmp.indexOf (":")+3);
+                domain = domain.substring (0, domain.indexOf ("/"));
+
+                var reqStr:String = "http://localhost:9999/nextSwf";
+
+		if (frontURL == "http")
+		{
+			reqStr = "http://" + domain + ":9999/nextSwf";
+		}
+
+
+
+		trace ("genericLoad request: "+ reqStr);
+
+                var req:URLRequest = new URLRequest(reqStr);
+                urlLoader = new URLLoader();
+                urlLoader.addEventListener("complete", completeHandler);
+                urlLoader.addEventListener("ioerror", ioerrorHandler);
+                urlLoader.addEventListener("securityError", ioerrorHandler);
+                urlLoader.load(req);
+		
+
+
+        }
+        private function show(event:Event):void
+	{
+		trace ("genericLoad: " + event);
+
+	}
+
+        private function completeHandler(event:Event):void
+        {
+                var data:String = urlLoader.data;
+		trace ("genericLoad: data to load: " + data);
+		ldr.source = data;
+
+
+        }
+
+        public function ioerrorHandler(event:Event):void 
+	{
+		// hosed
+		trace ("Error fetching the swf name to load: " +event);
+
+	}
+
+		public function subappLoaded(event:Event):void
+		{
+			show(event);
+			callLater(oneLater);
+		}
+
+		public function oneLater():void
+		{
+			trace("oneLater");
+			callLater(twoLater);
+		}
+
+		public function twoLater():void
+		{
+			trace("twoLater");
+			StyleManager.mx_internal::stylesRoot = null;
+			callLater(threeLater);
+		}
+
+		public function threeLater():void
+		{
+			trace("threeLater");
+			callLater(fourLater);
+		}
+
+		public function fourLater():void
+		{
+			trace("fourLater");
+		}
+	]]>
+	</mx:Script>
+		
+
+</mx:Application>



Mime
View raw message