Repository: flex-examples
Updated Branches:
  refs/heads/develop 62c9e522f -> 9343d3911


http://git-wip-us.apache.org/repos/asf/flex-examples/blob/9343d391/tourdeflexmodules/src/viewsource.mxml
----------------------------------------------------------------------
diff --git a/tourdeflexmodules/src/viewsource.mxml 
b/tourdeflexmodules/src/viewsource.mxml
new file mode 100755
index 0000000..82dd971
--- /dev/null
+++ b/tourdeflexmodules/src/viewsource.mxml
@@ -0,0 +1,70 @@
+<?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:VBox xmlns:fx="http://ns.adobe.com/mxml/2009"; 
xmlns:mx="library://ns.adobe.com/flex/mx"
+                usePreloader="false" paddingTop="0" paddingBottom="0" 
paddingLeft="0" paddingRight="0">
+
+       <fx:Script>
+               <![CDATA[               
+                       
+                       public function loadSource(appUrl:String, 
srcUrl:String):void
+                       {
+                               // delete all previously loaded source
+                               tn.removeAllChildren();
+                               
+                               var tabs:Array = new Array();
+                               if (appUrl != null && appUrl != "")
+                               {
+                                       var files:Array = new Array();
+                                       // the first file shown will be the 
mxml source
+                                       if (appUrl.indexOf(".mxml") >= 0 || 
appUrl.indexOf(".as") >= 0) {
+                                               files[0] = appUrl;
+                                       }
+                                       else if (appUrl.indexOf(".swf") == -1) {
+                                               files[0] = appUrl + ".mxml";
+                                       }
+                                       
+                                       if (srcUrl != null && srcUrl != "")
+                                       {
+                                               // other source files are shown 
in the subsequence tabs
+                                               var otherSrc:Array = 
srcUrl.split("&");
+                                               files = files.concat(otherSrc);
+                                       }
+
+                               for (var i:int = 0; i < files.length ; i++)
+                       {
+                                               tabs[i] = new SourceTab();
+                                               tn.addChild(tabs[i]);
+                                               tabs[i].source = files[i];
+                                               tabs[i].app = appUrl;
+                       }
+                               }
+                       }
+                       
+                                               
+                       public function thirdPartyWarning():void
+                       {
+                               tn.removeAllChildren();
+                               tn.addChild(new ThirdPartyTab());
+                       }
+               ]]>
+       </fx:Script>
+
+       <mx:TabNavigator id="tn" width="100%" height="100%" paddingTop="0" 
borderStyle="none" />
+
+</mx:VBox>

Reply via email to