Camera example uses AIR on AS side and requires FP11.4/AIR3.4
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/599b6e05 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/599b6e05 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/599b6e05 Branch: refs/heads/develop Commit: 599b6e05ab20771c133b1b9ac9ddc26980114c87 Parents: b83027c Author: Alex Harui <aha...@apache.org> Authored: Tue May 6 00:16:53 2014 -0700 Committer: Alex Harui <aha...@apache.org> Committed: Tue May 6 00:16:53 2014 -0700 ---------------------------------------------------------------------- .../CordovaCameraExample-app.xml | 252 +++++++++++++++++++ examples/CordovaCameraExample/build.xml | 32 ++- .../src/CordovaCameraExample.mxml | 3 + .../CordovaCameraExample/src/MyInitialView.mxml | 2 +- examples/build_example.xml | 87 +++++++ 5 files changed, 374 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/599b6e05/examples/CordovaCameraExample/CordovaCameraExample-app.xml ---------------------------------------------------------------------- diff --git a/examples/CordovaCameraExample/CordovaCameraExample-app.xml b/examples/CordovaCameraExample/CordovaCameraExample-app.xml new file mode 100644 index 0000000..27f8042 --- /dev/null +++ b/examples/CordovaCameraExample/CordovaCameraExample-app.xml @@ -0,0 +1,252 @@ +<?xml version="1.0" encoding="utf-8" standalone="no"?> +<!-- + + 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. + +--> +<application xmlns="http://ns.adobe.com/air/application/4.0"> + +<!-- Adobe AIR Application Descriptor File Template. + + Specifies parameters for identifying, installing, and launching AIR applications. + + xmlns - The Adobe AIR namespace: http://ns.adobe.com/air/application/3.8 + The last segment of the namespace specifies the version + of the AIR runtime required for this application to run. + + minimumPatchLevel - The minimum patch level of the AIR runtime required to run + the application. Optional. +--> + + <!-- A universally unique application identifier. Must be unique across all AIR applications. + Using a reverse DNS-style name as the id is recommended. (Eg. com.example.ExampleApplication.) Required. --> + <id>org.apache.flexjs.cordovacamera</id> + + <!-- Used as the filename for the application. Required. --> + <filename>Apache FlexJS Cordova Camera Example</filename> + + <!-- The name that is displayed in the AIR application installer. + May have multiple values for each language. See samples or xsd schema file. Optional. --> + <name>Apache FlexJS Cordova Camera Example</name> + + <!-- A string value of the format <0-999>.<0-999>.<0-999> that represents application version which can be used to check for application upgrade. + Values can also be 1-part or 2-part. It is not necessary to have a 3-part value. + An updated version of application must have a versionNumber value higher than the previous version. Required for namespace >= 2.5 . --> + <versionNumber>0.0.1</versionNumber> + + <!-- A string value (such as "v1", "2.5", or "Alpha 1") that represents the version of the application, as it should be shown to users. Optional. --> + <!-- <versionLabel></versionLabel> --> + + <!-- Description, displayed in the AIR application installer. + May have multiple values for each language. See samples or xsd schema file. Optional. --> + <!-- <description></description> --> + + <!-- Copyright information. Optional --> + <copyright>Copyright 2013 The Apache Software Foundation.</copyright> + + <!-- Publisher ID. Used if you're updating an application created prior to 1.5.3 --> + <!-- <publisherID></publisherID> --> + + <!-- Settings for the application's initial window. Required. --> + <initialWindow> + <!-- The main SWF or HTML file of the application. Required. --> + <!-- Note: In Flash Builder, the SWF reference is set automatically. --> + <content>CordovaCameraExample.swf</content> + + <!-- The title of the main window. Optional. --> + <!-- <title></title> --> + + <!-- The type of system chrome to use (either "standard" or "none"). Optional. Default standard. --> + <!-- <systemChrome></systemChrome> --> + + <!-- Whether the window is transparent. Only applicable when systemChrome is none. Optional. Default false. --> + <!-- <transparent></transparent> --> + + <!-- Whether the window is initially visible. Optional. Default false. --> + <!-- <visible></visible> --> + + <!-- Whether the user can minimize the window. Optional. Default true. --> + <!-- <minimizable></minimizable> --> + + <!-- Whether the user can maximize the window. Optional. Default true. --> + <!-- <maximizable></maximizable> --> + + <!-- Whether the user can resize the window. Optional. Default true. --> + <!-- <resizable></resizable> --> + + <!-- The window's initial width in pixels. Optional. --> + <!-- <width></width> --> + + <!-- The window's initial height in pixels. Optional. --> + <!-- <height></height> --> + + <!-- The window's initial x position. Optional. --> + <!-- <x></x> --> + + <!-- The window's initial y position. Optional. --> + <!-- <y></y> --> + + <!-- The window's minimum size, specified as a width/height pair in pixels, such as "400 200". Optional. --> + <!-- <minSize></minSize> --> + + <!-- The window's initial maximum size, specified as a width/height pair in pixels, such as "1600 1200". Optional. --> + <!-- <maxSize></maxSize> --> + + <!-- The initial aspect ratio of the app when launched (either "portrait" or "landscape"). Optional. Mobile only. Default is the natural orientation of the device --> + + <!-- <aspectRatio></aspectRatio> --> + + <!-- Whether the app will begin auto-orienting on launch. Optional. Mobile only. Default false --> + + <!-- <autoOrients></autoOrients> --> + + <!-- Whether the app launches in full screen. Optional. Mobile only. Default false --> + + <!-- <fullScreen></fullScreen> --> + + <!-- The render mode for the app (either auto, cpu, gpu, or direct). Optional. Default auto --> + + <!-- <renderMode></renderMode> --> + + <!-- Whether or not to pan when a soft keyboard is raised or lowered (either "pan" or "none"). Optional. Defaults "pan." --> + <!-- <softKeyboardBehavior></softKeyboardBehavior> --> + <autoOrients>false</autoOrients> + <fullScreen>false</fullScreen> + <visible>true</visible> + </initialWindow> + + <!-- We recommend omitting the supportedProfiles element, --> + <!-- which in turn permits your application to be deployed to all --> + <!-- devices supported by AIR. If you wish to restrict deployment --> + <!-- (i.e., to only mobile devices) then add this element and list --> + <!-- only the profiles which your application does support. --> + <!-- <supportedProfiles>desktop extendedDesktop mobileDevice extendedMobileDevice</supportedProfiles> --> + <supportedProfiles>extendedDesktop desktop</supportedProfiles> + + <!-- The subpath of the standard default installation location to use. Optional. --> + <installFolder>Apache Flex</installFolder> + + <!-- The subpath of the Programs menu to use. (Ignored on operating systems without a Programs menu.) Optional. --> + <programMenuFolder>Apache Flex</programMenuFolder> + + <!-- The icon the system uses for the application. For at least one resolution, + specify the path to a PNG file included in the AIR package. Optional. --> + <icon> + <image16x16>assets/icons/16.png</image16x16> + <image29x29>assets/icons/29.png</image29x29> + <image32x32>assets/icons/32.png</image32x32> + <image36x36>assets/icons/36.png</image36x36> + <image48x48>assets/icons/48.png</image48x48> + <image57x57>assets/icons/57.png</image57x57> + <image72x72>assets/icons/72.png</image72x72> + <image114x114>assets/icons/114.png</image114x114> + <image128x128>assets/icons/128.png</image128x128> + </icon> + + <!-- Whether the application handles the update when a user double-clicks an update version + of the AIR file (true), or the default AIR application installer handles the update (false). + Optional. Default false. --> + <!-- <customUpdateUI></customUpdateUI> --> + + <!-- Whether the application can be launched when the user clicks a link in a web browser. + Optional. Default false. --> + <!-- <allowBrowserInvocation></allowBrowserInvocation> --> + + <!-- Listing of file types for which the application can register. Optional. --> + <!-- <fileTypes> --> + + <!-- Defines one file type. Optional. --> + <!-- <fileType> --> + + <!-- The name that the system displays for the registered file type. Required. --> + <!-- <name></name> --> + + <!-- The extension to register. Required. --> + <!-- <extension></extension> --> + + <!-- The description of the file type. Optional. --> + <!-- <description></description> --> + + <!-- The MIME content type. --> + <!-- <contentType></contentType> --> + + <!-- The icon to display for the file type. Optional. --> + <!-- <icon> + <image16x16></image16x16> + <image32x32></image32x32> + <image48x48></image48x48> + <image128x128></image128x128> + </icon> --> + + <!-- </fileType> --> + <!-- </fileTypes> --> + + <!-- iOS specific capabilities --> + <!-- <iPhone> --> + <!-- A list of plist key/value pairs to be added to the application Info.plist --> + <!-- <InfoAdditions> + <![CDATA[ + <key>UIDeviceFamily</key> + <array> + <string>1</string> + <string>2</string> + </array> + <key>UIStatusBarStyle</key> + <string>UIStatusBarStyleBlackOpaque</string> + <key>UIRequiresPersistentWiFi</key> + <string>YES</string> + ]]> + </InfoAdditions> --> + <!-- A list of plist key/value pairs to be added to the application Entitlements.plist --> + <!-- <Entitlements> + <![CDATA[ + <key>keychain-access-groups</key> + <array> + <string></string> + <string></string> + </array> + ]]> + </Entitlements> --> + <!-- Display Resolution for the app (either "standard" or "high"). Optional. Default "standard" --> + <!-- <requestedDisplayResolution></requestedDisplayResolution> --> + <!-- </iPhone> --> + + <!-- Specify Android specific tags that get passed to AndroidManifest.xml file. --> + <!--<android> --> + <!-- <manifestAdditions> + <![CDATA[ + <manifest android:installLocation="auto"> + <uses-permission android:name="android.permission.INTERNET"/> + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> + <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> + <uses-feature android:required="true" android:name="android.hardware.touchscreen.multitouch"/> + <application android:enabled="true"> + <activity android:excludeFromRecents="false"> + <intent-filter> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> + </intent-filter> + </activity> + </application> + </manifest> + ]]> + </manifestAdditions> --> + <!-- Color depth for the app (either "32bit" or "16bit"). Optional. Default 16bit before namespace 3.0, 32bit after --> + <!-- <colorDepth></colorDepth> --> + <!-- </android> --> + <!-- End of the schema for adding the android specific tags in AndroidManifest.xml file --> + +</application> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/599b6e05/examples/CordovaCameraExample/build.xml ---------------------------------------------------------------------- diff --git a/examples/CordovaCameraExample/build.xml b/examples/CordovaCameraExample/build.xml index d8c19ae..3713c19 100644 --- a/examples/CordovaCameraExample/build.xml +++ b/examples/CordovaCameraExample/build.xml @@ -23,6 +23,10 @@ <property name="FLEXJS_HOME" location="../.."/> <property name="example" value="CordovaCameraExample" /> + <!-- this project needs AIR 3.4 FP 11.4 --> + <property name="swf.version" value="17" /> + <property name="playerglobal.version" value="11.4" /> + <property file="${FLEXJS_HOME}/env.properties"/> <property environment="env"/> <property file="${FLEXJS_HOME}/build.properties"/> @@ -30,16 +34,42 @@ <property name="FALCON_HOME" value="${env.FALCON_HOME}"/> <property name="FALCONJX_HOME" value="${env.FALCONJX_HOME}"/> <property name="GOOG_HOME" value="${env.GOOG_HOME}"/> + <property name="AIR_HOME" value="${env.AIR_HOME}"/> + + + <condition property="adl" value="adl.exe"> + <os family="windows"/> + </condition> + + <condition property="adl" value="adl"> + <os family="mac"/> + </condition> + <condition property="runtime" value="win"> + <os family="windows"/> + </condition> + + <condition property="runtime" value="mac"> + <os family="mac"/> + </condition> + <include file="${basedir}/../build_example.xml" /> - <target name="main" depends="clean,build_example.compile,build_example.compilejs" description="Clean build of ${example}"> + <target name="main" depends="clean,build_example.compileair,build_example.compilejsair" description="Clean build of ${example}"> </target> <target name="clean"> + <echo>playerglobal.version = ${playerglobal.version}</echo> <delete dir="${basedir}/bin" failonerror="false" /> <delete dir="${basedir}/bin-debug" failonerror="false" /> <delete dir="${basedir}/bin-release" failonerror="false" /> </target> + <target name="run"> + <exec executable="${AIR_HOME}/bin/${adl}" dir="${basedir}/bin-debug" failonerror="true"> + <arg value="-runtime" /> + <arg value="${AIR_HOME}/runtimes/air/${runtime}" /> + <arg value="${basedir}/bin-debug/${example}-app.xml" /> + </exec> + </target> </project> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/599b6e05/examples/CordovaCameraExample/src/CordovaCameraExample.mxml ---------------------------------------------------------------------- diff --git a/examples/CordovaCameraExample/src/CordovaCameraExample.mxml b/examples/CordovaCameraExample/src/CordovaCameraExample.mxml index c77e690..8d76281 100644 --- a/examples/CordovaCameraExample/src/CordovaCameraExample.mxml +++ b/examples/CordovaCameraExample/src/CordovaCameraExample.mxml @@ -30,4 +30,7 @@ <basic:initialView> <local:MyInitialView /> </basic:initialView> + <basic:beads> + <basic:MixinManager /> + </basic:beads> </basic:Application> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/599b6e05/examples/CordovaCameraExample/src/MyInitialView.mxml ---------------------------------------------------------------------- diff --git a/examples/CordovaCameraExample/src/MyInitialView.mxml b/examples/CordovaCameraExample/src/MyInitialView.mxml index 6eeeeca..319ff54 100644 --- a/examples/CordovaCameraExample/src/MyInitialView.mxml +++ b/examples/CordovaCameraExample/src/MyInitialView.mxml @@ -60,7 +60,7 @@ limitations under the License. <basic:TextButton text="From Photo Library" x="20" y="20" click="onFromPhotoLibrary()" /> <basic:TextButton text="Snap Picture" x="20" y="55" click="snapPicture()" /> - <basic:Label id="output" x="20" y="110" /> + <basic:Label id="output" x="20" y="110" width="400"/> <basic:Image id="image" x="20" y="200" width="200" height="200" /> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/599b6e05/examples/build_example.xml ---------------------------------------------------------------------- diff --git a/examples/build_example.xml b/examples/build_example.xml index d0a9705..caa6739 100644 --- a/examples/build_example.xml +++ b/examples/build_example.xml @@ -74,6 +74,54 @@ </copy> </target> + <target name="compileair" description="Compiles ${example}"> + <echo message="Compiling ${example}.swf"/> + <echo message="FLEX_HOME: ${FLEX_HOME}"/> + + <!-- Load the <compc> task. We can't do this at the <project> level --> + <!-- because targets that run before flexTasks.jar gets built would fail. --> + <taskdef resource="flexTasks.tasks" classpathref="lib.path"/> + <!-- + Link in the classes (and their dependencies) for the MXML tags + listed in this project's manifest.xml. + Also link the additional classes (and their dependencies) + listed in FlexJSUIClasses.as, + because these aren't referenced by the manifest classes. + Keep the standard metadata when compiling. + Include the appropriate CSS files and assets in the SWC. + Don't include any resources in the SWC. + Write a bundle list of referenced resource bundles + into the file bundles.properties in this directory. + --> + <mxmlc fork="true" + file="${basedir}/src/${example}.mxml" + output="${basedir}/bin-debug/${example}.swf"> + <jvmarg line="${mxmlc.jvm.args}"/> + <arg value="+flexlib=${basedir}/frameworks" /> + <arg value="+configname=air" /> + <arg value="-debug" /> + <arg value="-target-player=${playerglobal.version}" /> + <arg value="-swf-version=${swf.version}" /> + <arg value="-compiler.mxml.children-as-data" /> + <arg value="-compiler.binding-value-change-event=org.apache.flex.events.ValueChangeEvent" /> + <arg value="-compiler.binding-value-change-event-kind=org.apache.flex.events.ValueChangeEvent" /> + <arg value="-compiler.binding-value-change-event-type=valueChange" /> + <arg value="+playerglobal.version=${playerglobal.version}" /> + <arg value="+env.PLAYERGLOBAL_HOME=${env.PLAYERGLOBAL_HOME}" /> + </mxmlc> + + <copy todir="${basedir}/bin-debug"> + <fileset dir="${basedir}/src"> + <include name="*.png" /> + </fileset> + </copy> + <copy todir="${basedir}/bin-debug"> + <fileset dir="${basedir}"> + <include name="*-app.xml" /> + </fileset> + </copy> + </target> + <target name="compileas" description="Compiles ${example}"> <echo message="Compiling ${example}.swf"/> <echo message="FLEX_HOME: ${FLEX_HOME}"/> @@ -157,6 +205,45 @@ </fail> </target> + <target name="compilejsair" description="Cross-compiles ${example}"> + <echo message="Compiling ${example}.js"/> + <echo message="FLEX_HOME: ${FLEX_HOME}"/> + <echo message="FALCONJX_HOME: ${FALCONJX_HOME}"/> + <echo message="GOOG_HOME: ${GOOG_HOME}"/> + + <java jar="${FALCONJX_HOME}/lib/mxmlc.jar" resultProperty="errorCode" + fork="true"> + <jvmarg line="${mxmlc.jvm.args}"/> + <jvmarg line="-Dflexlib=${FLEXJS_HOME}/frameworks}"/> + <arg value="+flexlib=${FLEXJS_HOME}/frameworks" /> + <arg value="+configname=air" /> + <arg value="-debug" /> + <arg value="-compiler.mxml.children-as-data" /> + <arg value="-compiler.binding-value-change-event=org.apache.flex.events.ValueChangeEvent" /> + <arg value="-compiler.binding-value-change-event-kind=org.apache.flex.events.ValueChangeEvent" /> + <arg value="-compiler.binding-value-change-event-type=valueChange" /> + <arg value="+playerglobal.version=${playerglobal.version}" /> + <arg value="+env.PLAYERGLOBAL_HOME=${env.PLAYERGLOBAL_HOME}" /> + <arg value="-js-output-type=FLEXJS" /> + <arg value="-closure-lib=${GOOG_HOME}" /> + <arg value="-sdk-js-lib=${FLEXJS_HOME}/frameworks/js/FlexJS/src" /> + <arg value="-sdk-js-lib=${FLEXJS_HOME}/frameworks/js/FlexJS/libs" /> + <arg value="-external-js-lib=${FLEXJS_HOME}/frameworks/js/FlexJS/src/jquery_externals.js" /> + <arg value="-external-js-lib=${FLEXJS_HOME}/frameworks/js/FlexJS/src/createjs_externals.js" /> + <arg value="${basedir}/src/${example}.mxml" /> + </java> + <fail> + <condition> + <not> + <or> + <equals arg1="${errorCode}" arg2="0" /> + <equals arg1="${errorCode}" arg2="2" /> + </or> + </not> + </condition> + </fail> + </target> + <target name="compileasjs" description="Cross-compiles ${example}"> <echo message="Compiling ${example}.js"/> <echo message="FLEX_HOME: ${FLEX_HOME}"/>