This is an automated email from the ASF dual-hosted git repository.

yishayw pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/develop by this push:
     new b96bd56  FileReference example
b96bd56 is described below

commit b96bd56695bf5c0fc4c140c0a4c256a173de3edd
Author: DESKTOP-RH4S838\Yishay <[email protected]>
AuthorDate: Sun Feb 16 18:07:49 2020 +0200

    FileReference example
---
 examples/mxroyale/FileReference/HelloWorld.as3proj | 116 +++++++++++++++++++++
 examples/mxroyale/FileReference/build.xml          |  55 ++++++++++
 examples/mxroyale/FileReference/pom.xml            |  61 +++++++++++
 .../src/main/royale/FileReference.mxml             |  70 +++++++++++++
 4 files changed, 302 insertions(+)

diff --git a/examples/mxroyale/FileReference/HelloWorld.as3proj 
b/examples/mxroyale/FileReference/HelloWorld.as3proj
new file mode 100644
index 0000000..1512e3c
--- /dev/null
+++ b/examples/mxroyale/FileReference/HelloWorld.as3proj
@@ -0,0 +1,116 @@
+<?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.
+
+-->
+<project>
+  <output>
+    <movie disabled="False"/>
+    <movie platform="Flash Player"/>
+    <movie version="11"/>
+    <movie width="800"/>
+    <movie fps="60"/>
+    <movie height="600"/>
+    <movie background="#FFFFFF"/>
+    <movie path="bin-debug/FileReference.swf"/>
+    <movie input=""/>
+  </output>
+  &lt;!-- Other classes to be compiled into your SWF --&gt;
+  <jsOutput>
+    <option path=""/>
+  </jsOutput>
+  <classpaths>
+    <class path="src/main/royale"/>
+  </classpaths>
+  <moonshineResourcePaths></moonshineResourcePaths>
+  <moonshineNativeExtensionPaths></moonshineNativeExtensionPaths>
+  <build>
+    <option verboseStackTraces="False"/>
+    <option customSDK=""/>
+    <option additional="+configname=flex"/>
+    <option linkReport=""/>
+    <option optimize="False"/>
+    <option antBuildPath="build/build.xml"/>
+    <option showActionScriptWarnings="True"/>
+    <option compilerConstants=""/>
+    <option loadConfig=""/>
+    <option showBindingWarnings="True"/>
+    <option staticLinkRSL="False"/>
+    <option showUnusedTypeSelectorWarnings="True"/>
+    <option locale=""/>
+    <option strict="True"/>
+    <option showDeprecationWarnings="True"/>
+    <option useNetwork="True"/>
+    <option allowSourcePathOverlap="False"/>
+    <option useResourceBundleMetadata="True"/>
+    <option benchmark="False"/>
+    <option warnings="True"/>
+    <option accessible="False"/>
+    <option es="False"/>
+  </build>
+  <mavenBuild>
+    <option commandLine=""/>
+    <option settingsFilePath=""/>
+    <option mavenBuildPath=""/>
+    <actions>
+      <action actionName="Build" action="install"/>
+      <action actionName="Clean" action="clean"/>
+      <action actionName="Clean and Build" action="clean install"/>
+      <action actionName="Exploded" action="war:exploded"/>
+    </actions>
+  </mavenBuild>
+  <includeLibraries></includeLibraries>
+  <libraryPaths></libraryPaths>
+  <externalLibraryPaths></externalLibraryPaths>
+  <rslPaths></rslPaths>
+  <intrinsics>
+    <element path="Library/AS3/frameworks/Flex4"/>
+    <element path="Library\AS3\frameworks\Flex4"/>
+  </intrinsics>
+  <library>
+    
+    
+  </library>
+  <compileTargets>
+    <compile path="src/main/royale/FileReference.mxml"/>
+  </compileTargets>
+  <hiddenPaths></hiddenPaths>
+  <preBuildCommand>null</preBuildCommand>
+  <postBuildCommand alwaysRun="False">null</postBuildCommand>
+  <trustSVNCertificate>False</trustSVNCertificate>
+  <options>
+    <option testMovieCommand=""/>
+    <option isPrimeFacesVisualEditor="False"/>
+    <option defaultBuildTargets=""/>
+    <option isExportedToExistingSource="False"/>
+    <option showHiddenPaths="False"/>
+    <option visualEditorExportPath=""/>
+    <option testMovie=""/>
+  </options>
+  <moonshineRunCustomization>
+    <option deviceSimulator="null"/>
+    <option urlToLaunch=""/>
+    <option launchMethod="Simulator"/>
+    <option projectType="2"/>
+    <option targetPlatform="2"/>
+    <option customUrlToLaunch=""/>
+    <deviceSimulator>null</deviceSimulator>
+    <certAndroid>null</certAndroid>
+    <certIos>null</certIos>
+    <certIosProvisioning>null</certIosProvisioning>
+  </moonshineRunCustomization>
+</project>
diff --git a/examples/mxroyale/FileReference/build.xml 
b/examples/mxroyale/FileReference/build.xml
new file mode 100644
index 0000000..df3c60a
--- /dev/null
+++ b/examples/mxroyale/FileReference/build.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0"?>
+<!--
+
+  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.
+
+-->
+
+
+<project name="filereference" default="main" basedir=".">
+    <property name="ROYALE_HOME" location="../../.."/>
+    <property name="example" value="FileReference" />
+    
+    <property file="${ROYALE_HOME}/env.properties"/>
+    <property environment="env"/>
+    <property file="${ROYALE_HOME}/build.properties"/>
+    <property name="ROYALE_HOME" value="${ROYALE_HOME}"/>
+    <property name="config_arg" value="flex"/>
+
+    <include file="${basedir}/../../build_example.xml" />
+    
+    <target name="main" depends="clean,build_example.compile" 
description="Clean build of ${example}">
+    </target>
+    
+    <target name="clean">
+        <delete dir="${basedir}/bin" failonerror="false" />
+        <delete dir="${basedir}/bin-debug" failonerror="false" />
+        <delete dir="${basedir}/bin-release" failonerror="false" />
+        <delete dir="${basedir}/target" failonerror="false" />
+    </target>
+
+    <target name="examine" depends="build_example.get.browser">
+        <property name="which" value="debug" />
+        <echo message="Make sure label appears."/>
+        <exec executable="${browser}" dir="${basedir}/bin-${which}" 
failonerror="true">
+            <arg value="${basedir}/bin-${which}/${example}.html"/>
+        </exec>
+        <exec executable="${browser}" dir="${basedir}/bin/js-${which}" 
failonerror="true">
+            <arg value="${basedir}/bin/js-${which}/index.html"/>
+        </exec>
+    </target>
+
+</project>
diff --git a/examples/mxroyale/FileReference/pom.xml 
b/examples/mxroyale/FileReference/pom.xml
new file mode 100644
index 0000000..9fb2f64
--- /dev/null
+++ b/examples/mxroyale/FileReference/pom.xml
@@ -0,0 +1,61 @@
+<?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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.royale.examples</groupId>
+    <artifactId>examples-mxroyale</artifactId>
+    <version>0.9.7-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>FileReference-MXRoyale</artifactId>
+  <version>0.9.7-SNAPSHOT</version>
+  <packaging>swf</packaging>
+
+  <name>Apache Royale: Examples: MXRoyale: FileReference</name>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.royale.compiler</groupId>
+        <artifactId>royale-maven-plugin</artifactId>
+        <extensions>true</extensions>
+        <configuration>
+          <mainClass>FileReference.mxml</mainClass>
+          <targets>${royale.targets}</targets>
+          <debug>false</debug>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.royale.framework</groupId>
+      <artifactId>BasicTheme</artifactId>
+      <version>0.9.7-SNAPSHOT</version>
+      <type>swc</type>
+      <scope>theme</scope>
+      <classifier>js</classifier>
+    </dependency>
+  </dependencies>
+
+</project>
diff --git a/examples/mxroyale/FileReference/src/main/royale/FileReference.mxml 
b/examples/mxroyale/FileReference/src/main/royale/FileReference.mxml
new file mode 100644
index 0000000..b3efb50
--- /dev/null
+++ b/examples/mxroyale/FileReference/src/main/royale/FileReference.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:Application xmlns:fx="http://ns.adobe.com/mxml/2009";
+                   xmlns:mx="library://ns.apache.org/royale/mx"
+                   width="600" height="400" >
+       <!-- to do: layout="absolute" minWidth="955" minHeight="600" -->
+       <fx:Script>
+       <![CDATA[
+               import mx.events.FlexEvent;
+               import mx.net.FileReference;
+               import org.apache.royale.net.URLRequest;
+               import org.apache.royale.events.Event;
+               import mx.events.MouseEvent;
+
+               private var uploadURL:URLRequest;
+               private var file:FileReference;
+
+               private function clickHandler(event:MouseEvent):void
+               {
+                   uploadURL = new URLRequest();
+                   uploadURL.url = 
"http://www.[yourDomain].com/yourUploadHandlerScript.cfm";;
+                   file = new FileReference();
+                   file.addEventListener(Event.SELECT, selectHandler);
+                   //file.addEventListener(IOErrorEvent.IO_ERROR, 
ioErrorHandler);
+                   //file.addEventListener(ProgressEvent.PROGRESS, 
progressHandler);
+                   file.addEventListener(Event.COMPLETE, completeHandler);
+                   file.browse();
+               }
+
+               private function selectHandler(event:Event):void {
+                   var file:FileReference = FileReference(event.target);
+                       trace("selectHandler: name=" + file.name + " URL=" + 
uploadURL.url);
+                   file.upload(uploadURL);
+               }
+
+//             private function ioErrorHandler(event:IOErrorEvent):void {
+//                 trace("ioErrorHandler: " + event);
+//             }
+               //
+//             private function progressHandler(event:ProgressEvent):void {
+//                 var file:FileReference = FileReference(event.target);
+//                 trace("progressHandler: name=" + file.name + " 
bytesLoaded=" + event.bytesLoaded + " bytesTotal=" + event.bytesTotal);
+//             }
+
+               private function completeHandler(event:Event):void {
+                   trace("completeHandler: " + event);
+               }
+
+       ]]>
+       </fx:Script>
+       <mx:Button label="Test FileReference" click="clickHandler(event)"/>
+        
+</mx:Application>

Reply via email to