Skip to content
Browse files

Initial commit

  • Loading branch information...
0 parents commit ca01242160aacfcd3c886e92f9dc265941902dce @fljot committed Apr 29, 2011
Showing with 2,604 additions and 0 deletions.
  1. +10 −0 .gitignore
  2. +17 −0 .project
  3. +23 −0 .settings/com.powerflasher.fdt.classpath
  4. +15 −0 .settings/com.powerflasher.fdt.core.prefs
  5. +3 −0 .settings/org.eclipse.core.resources.prefs
  6. +21 −0 LICENSE
  7. +30 −0 README.textile
  8. +51 −0 build.template.properties
  9. +299 −0 build.xml
  10. +217 −0 build/android/descriptor-template-apk.xml
  11. BIN build/assets/images/placekitten.jpg
  12. BIN build/assets/images/transparent_background_tile.png
  13. +217 −0 build/iOS/descriptor-template-ipa.xml
  14. BIN build/libs/ant-contrib-1.0b3.jar
  15. BIN build/libs/commons-net-2.0.jar
  16. BIN build/libs/jakarta-oro-2.0.8.jar
  17. BIN build/libs/jsch-0.1.32.jar
  18. BIN libs/MinimalComps_0_9_9.swc
  19. BIN libs/MonsterDebuggerMobile.swc
  20. BIN libs/greensock.swc
  21. BIN src/assets/images/Splashscreen.png
  22. +112 −0 src/org/gestouch/examples/DoubleTapGestureExample.as
  23. +52 −0 src/org/gestouch/examples/GestouchExamples.mxml
  24. +136 −0 src/org/gestouch/examples/LongPressGestureExample.as
  25. +91 −0 src/org/gestouch/examples/SwipeGestureExample.as
  26. +57 −0 src/org/gestouch/examples/base/ExampleBase.as
  27. +27 −0 src/org/gestouch/examples/controls/ArrowShape.as
  28. +83 −0 src/org/gestouch/examples/controls/EditableLabel.as
  29. +29 −0 src/org/gestouch/examples/controls/EditableTextInput.as
  30. +20 −0 src/org/gestouch/examples/controls/HintText.as
  31. +37 −0 src/org/gestouch/examples/model/ExamplesModel.as
  32. +152 −0 src/org/gestouch/examples/views/DoubleTapGestureView.mxml
  33. +78 −0 src/org/gestouch/examples/views/DragGestureView.mxml
  34. +120 −0 src/org/gestouch/examples/views/ExampleViewBase.as
  35. +189 −0 src/org/gestouch/examples/views/FreeTransformView.mxml
  36. +57 −0 src/org/gestouch/examples/views/GestouchExamplesHomeView.mxml
  37. +104 −0 src/org/gestouch/examples/views/HoldAndDragView.mxml
  38. +176 −0 src/org/gestouch/examples/views/LongPressGestureView.mxml
  39. +77 −0 src/org/gestouch/examples/views/SingleTouchPowerView.mxml
  40. +103 −0 src/org/gestouch/examples/views/SwipeGestureView.mxml
  41. +1 −0 version.properties
10 .gitignore
@@ -0,0 +1,10 @@
+_resources/
+bin/
+bin-debug/
+bin-release/
+
+.svn/
+
+Thumbs.db
+.DS_Store
+build.properties
17 .project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>GestouchExamples</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.powerflasher.fdt.core.FlashBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.powerflasher.fdt.core.FlashNature</nature>
+ </natures>
+</projectDescription>
23 .settings/com.powerflasher.fdt.classpath
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<AS3Classpath>
+ <AS3LibraryFolder>libs</AS3LibraryFolder>
+ <AS3Classpath generateProblems="true" sdkBased="false" type="source" useAsSharedCode="false">src</AS3Classpath>
+ <AS3Classpath generateProblems="false" sdkBased="false" type="source" useAsSharedCode="false">src_external</AS3Classpath>
+ <AS3Classpath generateProblems="false" sdkBased="true" type="lib" useAsSharedCode="false">frameworks/libs/air/airglobal.swc</AS3Classpath>
+ <AS3Classpath generateProblems="false" sdkBased="true" type="lib" useAsSharedCode="false">frameworks/libs/authoringsupport.swc</AS3Classpath>
+ <AS3Classpath generateProblems="false" sdkBased="true" type="lib" useAsSharedCode="false">frameworks/libs/charts.swc</AS3Classpath>
+ <AS3Classpath generateProblems="false" sdkBased="true" type="lib" useAsSharedCode="false">frameworks/libs/flash-integration.swc</AS3Classpath>
+ <AS3Classpath generateProblems="false" sdkBased="true" type="lib" useAsSharedCode="false">frameworks/libs/framework.swc</AS3Classpath>
+ <AS3Classpath generateProblems="false" sdkBased="true" type="lib" useAsSharedCode="false">frameworks/libs/osmf.swc</AS3Classpath>
+ <AS3Classpath generateProblems="false" sdkBased="true" type="lib" useAsSharedCode="false">frameworks/libs/rpc.swc</AS3Classpath>
+ <AS3Classpath generateProblems="false" sdkBased="true" type="lib" useAsSharedCode="false">frameworks/libs/spark.swc</AS3Classpath>
+ <AS3Classpath generateProblems="false" sdkBased="true" type="lib" useAsSharedCode="false">frameworks/libs/textLayout.swc</AS3Classpath>
+ <AS3Classpath generateProblems="false" sdkBased="true" type="lib" useAsSharedCode="false">frameworks/libs/mobile/mobilecomponents.swc</AS3Classpath>
+ <AS3Classpath generateProblems="false" sdkBased="true" type="lib" useAsSharedCode="false">frameworks/themes/Mobile/mobile.swc</AS3Classpath>
+ <AS3Classpath generateProblems="false" sdkBased="true" type="lib" useAsSharedCode="false">frameworks/libs/air/servicemonitor.swc</AS3Classpath>
+ <AS3Classpath generateProblems="false" sdkBased="false" type="lib" useAsSharedCode="false">libs/greensock.swc</AS3Classpath>
+ <AS3Classpath generateProblems="false" sdkBased="false" type="lib" useAsSharedCode="false">libs/MinimalComps_0_9_9.swc</AS3Classpath>
+ <AS3Classpath generateProblems="false" sdkBased="false" type="lib" useAsSharedCode="false">libs/MonsterDebuggerMobile.swc</AS3Classpath>
+ <AS3Classpath generateProblems="false" inclusion="complete" sdkBased="false" type="project" useAsSharedCode="false">Gestouch</AS3Classpath>
+ <AS3Classpath generateProblems="false" sdkBased="true" type="lib" useAsSharedCode="false">frameworks/libs/mx/mx.swc</AS3Classpath>
+</AS3Classpath>
15 .settings/com.powerflasher.fdt.core.prefs
@@ -0,0 +1,15 @@
+#Mon Apr 25 18:42:57 EEST 2011
+com.powerflasher.fdt.core.CompatiblePlayers=AIR_Debug_Launcher
+com.powerflasher.fdt.core.CompilerArguments=-load-config\="{flexSDK}/frameworks/airmobile-config.xml"\n-target-player\={playerVersion}\n-library-path+\="{flexSDK}/frameworks/locale/en_US"
+com.powerflasher.fdt.core.DefaultOutputFolder=bin
+com.powerflasher.fdt.core.DefaultPlayer=AIR_Debug_Launcher
+com.powerflasher.fdt.core.Language=AS3
+com.powerflasher.fdt.core.PassClasspath=true
+com.powerflasher.fdt.core.PassMainclass=true
+com.powerflasher.fdt.core.PassRsls=false
+com.powerflasher.fdt.core.PassSwcs=true
+com.powerflasher.fdt.core.PlayerVersion=10.2
+com.powerflasher.fdt.core.ProjectTypeHint=Flex 4.5 Mobile
+com.powerflasher.fdt.core.Runtime=AIR
+com.powerflasher.fdt.core.SdkName=Flex 4.5
+eclipse.preferences.version=1
3 .settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,3 @@
+#Mon Apr 25 18:42:57 EEST 2011
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
21 LICENSE
@@ -0,0 +1,21 @@
+The MIT License
+
+Copyright (c) 2011 the original author or authors
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
30 README.textile
@@ -0,0 +1,30 @@
+h2. Examples repository for Gestouch Framework.
+
+"Gestouch Framework":http://github.com/fljot/Gestouch
+
+
+h3. Usage
+
+Build is powered by Ant.
+1. Make your own build.properties out of build.template.properties by copying and renaming. Fix several path properties (like path to your Flex SDK, Android SDK, etc..).
+2. If you're using IDE such as FDT or FB(Flash/Flex Builder) point to Gestouch project (framework source project) as a reference project ("Project dependencies" for FDT, Library project for FB, etc..). Don't forget to fix src_framework.lib property also.
+3. If you are FDT4 user: set property user.ide to FDT4 to have faster compilation time and extra tasks like debugger and profiler. If you use other IDE — skip it, there's a fallback to mxmlc.jar in Ant tasks. If someone knows tasks for FB, IDEA, FD — feel free to add them.
+4. Check available Ant tasks and run them.
+
+Hint for compiling for iOS: do it through console interface (Terminal on MacOS) so that IDE would be free and usable. For example:
+ant package.ipa -Duser.ide=none
+
+
+h3. Code
+
+* "Gestouch Framework":http://github.com/fljot/Gestouch
+* "Gestouch Examples":http://github.com/fljot/GestouchExamples
+
+
+h2. License
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
51 build.template.properties
@@ -0,0 +1,51 @@
+# IMPORTANT Change to your local system paths before using ANT
+
+# Flex SDK related properties
+FLEX_HOME = path-to-flex-4.5-SDK#/Users/fljot/Development/SDKs/flex_sdk_4.5
+flexSDK.dir = ${FLEX_HOME}
+flexSDK.adl = ${flexSDK.dir}/bin/adl
+flexSDK.adt = ${flexSDK.dir}/lib/adt.jar
+
+# Android SDK related peoperties
+androidSDK.dir = path-to-android-SDK#/Users/fljot/Development/SDKs/android-sdk-mac_x86
+android.emulator = ${androidSDK.dir}/tools/emulator
+android.manager = ${androidSDK.dir}/tools/android
+android.adb = ${androidSDK.dir}/platform-tools/adb
+
+flashPlayer = path-to-flashplayer(debug)#/Applications/Adobe Flash CS4/Players/Debug/Flash Player.app
+
+project.name = ${ant.project.name}
+user.ide = #FDT4#options: FDT4|...
+
+# Project-path relative properties
+src.dir = ${basedir}/src
+src_external.dir = ${basedir}/src_external
+src_framework.dir = ${basedir}/../Gestouch/src
+libs.dir = ${basedir}/libs
+build.dir = ${basedir}/build
+bindebug.dir = ${basedir}/bin
+binrelease.dir = ${basedir}/bin
+
+# Input
+project.examplesPackage.dir = org/gestouch/examples
+project.targetPlayerVersion = 10.2
+project.baseCompilerArguments = -default-size=800,600 --target-player=${project.targetPlayerVersion} -static-link-runtime-shared-libraries=true
+project.mobileCompilerArguments = -preloader=spark.preloaders.SplashScreen -theme="${flexSDK.dir}/frameworks/themes/Mobile/mobile.swc"
+project.debugCompilerArguments = -define=CONFIG::Debug,true -define+=CONFIG::Release,false -verbose-stacktraces=true
+project.releaseCompilerArguments = -define=CONFIG::Debug,false -define+=CONFIG::Release,true
+
+# AIR stuff
+project.air.appID =
+project.air.descriptor = ${src.dir}/${project.name}-app.xml
+project.air.descriptor.template = ${src.dir}/${project.name}-app.xml
+project.air.filename = ${project.name}.air
+project.air.certificate = path-to-p12-certificate-for-AIR
+project.air.certificate.password = password
+project.android.descriptor.template = ${build.dir}/android/descriptor-template-apk.xml
+project.android.certificate = ${build.dir}/android/certificate.p12
+project.android.certificate.password = password
+project.ios.appID = application-packge-ID
+project.ios.descriptor.template = ${build.dir}/iOS/descriptor-template-ipa.xml
+project.ios.provisionprofile = ${build.dir}/iOS/iOS.mobileprovision
+project.ios.certificate = ${build.dir}/iOS/certificate.p12
+project.ios.certificate.password = password
299 build.xml
@@ -0,0 +1,299 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project name="GestouchExamples" default="usage" basedir=".">
+
+ <!-- Load properties -->
+ <property file="build.properties" />
+ <property file="version.properties" />
+
+
+ <!-- Additional tasks -->
+ <taskdef resource="net/sf/antcontrib/antcontrib.properties" classpath="${build.dir}/libs/ant-contrib-1.0b3.jar" />
+
+
+ <!-- Visible targets -->
+
+ <target name="usage">
+ <echo>Usage:
+- Use debug.GestouchExamples task to compile and run example application.
+- Use package.ipa task to compile for iOS device. Default example name to compile is GestouchExamples (just hit enter when input required).
+- Use package.apk task to compile for Android device. Default example name to compile is GestouchExamples (just hit enter when input required).
+ </echo>
+ </target>
+
+ <target name="debug.LongPressGestureExample" description="">
+ <compile.example exampleName="LongPressGestureExample" openSWF="true" />
+ </target>
+
+ <target name="debug.DoubleTapGestureExample" description="">
+ <compile.example exampleName="DoubleTapGestureExample" openSWF="true" />
+ </target>
+
+ <target name="debug.SwipeGestureExample" description="">
+ <compile.example exampleName="SwipeGestureExample" openSWF="true" />
+ </target>
+
+ <target name="debug.GestouchExamples" description="">
+ <var name="example.name" value="GestouchExamples"/>
+ <compile.debug input="${project.examplesPackage.dir}/${example.name}.mxml"
+ output="${example.name}.swf"
+ compilerArguments=""
+ />
+ <copy file="${build.dir}/iOS/descriptor-template-ipa.xml" tofile="${bindebug.dir}/${example.name}-ipa.xml" overwrite="true">
+ <filterset>
+ <filter token="ID" value="com.velvet.PankTest" />
+ <filter token="FILENAME" value="${example.name}" />
+ <filter token="VERSION" value="0.1" />
+ <filter token="CONTENT" value="${example.name}.swf" />
+ </filterset>
+ </copy>
+ <antcall target="ide.startDebugger" />
+ <!--
+ <antcall target="ide.startProfiler" />
+ -->
+ <exec executable="${flexSDK.adl}">
+ <arg value="${bindebug.dir}/${example.name}-ipa.xml" />
+ <arg value="${bindebug.dir}" />
+ </exec>
+ </target>
+
+
+ <target name="package.ipa" description="" depends="ide.resetCompiler">
+ <input message="Example name to compile (eg: SwipeGestureExample):"
+ addproperty="example.name"
+ defaultvalue="GestouchExamples"/>
+
+ <if>
+ <equals arg1="${example.name}" arg2="GestouchExamples"/>
+ <then>
+ <compile.debug input="${project.examplesPackage.dir}/${example.name}.mxml"
+ output="${example.name}.swf"
+ compilerArguments=""
+ />
+ </then>
+ <else>
+ <compile.example exampleName="${example.name}"/>
+ </else>
+ </if>
+
+ <if>
+ <equals arg1="${project.ios.certificate.password}" arg2=""/>
+ <then>
+ <input message="Certificate password:"
+ addproperty="var.project.app.certificate.password"/>
+ </then>
+ <else>
+ <var name="var.project.app.certificate.password" value="${project.ios.certificate.password}" />
+ </else>
+ </if>
+
+ <var name="var.project.app.descriptor" value="${bindebug.dir}/${example.name}-ipa.xml"/>
+ <copy file="${project.ios.descriptor.template}" tofile="${var.project.app.descriptor}" overwrite="true">
+ <filterset>
+ <filter token="ID" value="${project.ios.appID}" />
+ <filter token="FILENAME" value="${example.name}" />
+ <filter token="VERSION" value="${project.version}" />
+ <filter token="CONTENT" value="${example.name}.swf" />
+ </filterset>
+ </copy>
+
+ <var name="ipaTarget" value="ipa-test"/>
+ <java jar="${flexSDK.adt}" fork="true" failonerror="true">
+ <arg value="-package"/>
+ <arg line="-target ${ipaTarget}"/>
+ <arg line="-provisioning-profile ${project.ios.provisionprofile}"/>
+ <arg value="-storetype"/>
+ <arg value="pkcs12"/>
+ <arg value="-keystore"/>
+ <arg value="${project.ios.certificate}"/>
+ <arg value="-storepass"/>
+ <arg value="${var.project.app.certificate.password}"/>
+ <arg value="${bindebug.dir}/${example.name}.ipa" />
+ <arg value="${var.project.app.descriptor}" />
+ <arg value="-C"/>
+ <arg value="${bindebug.dir}" />
+ <arg value="${example.name}.swf" />
+ </java>
+ </target>
+
+
+ <target name="package.apk" description="" depends="ide.resetCompiler">
+ <input message="Example name to compile (eg: SwipeGestureExample):"
+ addproperty="example.name"
+ defaultvalue="GestouchExamples"/>
+
+ <if>
+ <equals arg1="${example.name}" arg2="GestouchExamples"/>
+ <then>
+ <compile.debug input="${project.examplesPackage.dir}/${example.name}.mxml"
+ output="${example.name}.swf"
+ compilerArguments=""
+ />
+ </then>
+ <else>
+ <compile.example exampleName="${example.name}"/>
+ </else>
+ </if>
+
+ <if>
+ <equals arg1="${project.android.certificate.password}" arg2=""/>
+ <then>
+ <input message="Certificate password:"
+ addproperty="var.project.app.certificate.password"/>
+ </then>
+ <else>
+ <var name="var.project.app.certificate.password" value="${project.android.certificate.password}" />
+ </else>
+ </if>
+
+ <var name="var.project.app.descriptor" value="${bindebug.dir}/${example.name}-apk.xml"/>
+ <copy file="${project.android.descriptor.template}" tofile="${var.project.app.descriptor}" overwrite="true">
+ <filterset>
+ <filter token="ID" value="${project.air.appID}" />
+ <filter token="FILENAME" value="${example.name}" />
+ <filter token="VERSION" value="${project.version}" />
+ <filter token="CONTENT" value="${example.name}.swf" />
+ </filterset>
+ </copy>
+
+ <java jar="${flexSDK.adt}" fork="true" failonerror="true">
+ <arg value="-package" />
+
+ <arg value="-target" />
+ <arg value="apk-debug" />
+
+ <arg value="-storetype" />
+ <arg value="pkcs12" />
+ <arg value="-keystore" />
+ <arg value="${project.android.certificate}"/>
+ <arg value="-storepass" />
+ <arg value="${var.project.app.certificate.password}" />
+
+ <arg value="${bindebug.dir}/${example.name}.apk" />
+ <arg value="${var.project.app.descriptor}" />
+ <arg value="-C" />
+ <arg value="${bindebug.dir}" />
+ <arg value="${example.name}.swf" />
+ </java>
+
+ <!-- Installing the published application on to the emulator -e for emulator, -d for device -->
+ <exec executable="${android.adb}">
+ <arg line="-d"/>
+ <arg line="install"/>
+ <arg line="-r"/>
+ <arg line="${bindebug.dir}/${example.name}.apk"/>
+ </exec>
+ </target>
+
+ <target name="ide.startDebugger" description="Starts IDE Debugger">
+ <if>
+ <equals arg1="${user.ide}" arg2="FDT4"/>
+ <then>
+ <fdt.startDebugger projectname="${project.name}" />
+ </then>
+ <else>
+ <echo>ide.startDebugger task is available only for FDT4. TODO: tasks for other IDEs</echo>
+ </else>
+ </if>
+ </target>
+
+ <target name="ide.startProfiler" description="Starts IDE Profiler">
+ <if>
+ <equals arg1="${user.ide}" arg2="FDT4"/>
+ <then>
+ <fdt.startProfiler projectname="${project.name}"/>
+ </then>
+ <else>
+ <echo>ide.startProfiler task is available only for FDT4. TODO: tasks for other IDEs</echo>
+ </else>
+ </if>
+ </target>
+
+ <target name="ide.resetCompiler" description="">
+ <if>
+ <equals arg1="${user.ide}" arg2="FDT4"/>
+ <then>
+ <fdt.launch.resetFlexCompiler />
+ </then>
+ <else>
+ <echo>ide.resetCompiler task is available only for FDT4. TODO: tasks for other IDEs</echo>
+ </else>
+ </if>
+ </target>
+
+ <!-- Hidden targets and macro definitions-->
+
+ <macrodef name="compile.example">
+ <attribute name="exampleName" />
+ <attribute name="compilerArguments" default="" />
+ <attribute name="air" default="true" />
+ <attribute name="openSWF" default="false" />
+ <sequential>
+ <compile.debug input="${project.examplesPackage.dir}/@{exampleName}.as"
+ output="@{exampleName}.swf"
+ compilerArguments="@{compilerArguments}"
+ air="@{air}"
+ openSWF="@{openSWF}"
+ />
+ </sequential>
+ </macrodef>
+
+ <macrodef name="compile.debug">
+ <attribute name="input" />
+ <attribute name="output" />
+ <attribute name="air" default="true" />
+ <attribute name="compilerArguments" default="" />
+ <attribute name="openSWF" default="false" />
+ <sequential>
+ <var name="var.compilerArguments" value="${project.baseCompilerArguments} ${project.debugCompilerArguments} @{compilerArguments}" />
+ <if>
+ <equals arg1="@{air}" arg2="true" />
+ <then>
+ <var name="var.compilerArguments" value="${var.compilerArguments} ${project.mobileCompilerArguments} +configname=airmobile" />
+ </then>
+ </if>
+
+ <if>
+ <equals arg1="${user.ide}" arg2="FDT4"/>
+ <then>
+ <fdt.launch.application projectname="${project.name}"
+ compilerarguments="${var.compilerArguments}"
+ mainclass="${src.dir}/@{input}"
+ debug="true"
+ profile="false"
+ target="${bindebug.dir}/@{output}"
+ startswf="@{openSWF}"
+ swflauncher="Adobe Flash Player"
+ />
+ </then>
+ <else>
+ <java jar="${flexSDK.dir}/lib/mxmlc.jar" dir="${flexSDK.dir}/frameworks" fork="true" failonerror="true">
+ <arg value="${src.dir}/@{input}"/>
+ <arg value="-incremental=false"/>
+ <arg value="-headless-server=true"/>
+ <arg value="-debug=true"/>
+ <!--<arg value="+configname=flex"/>-->
+ <arg value="-source-path+=${src.dir}"/>
+ <arg value="-source-path+=${src_framework.dir}"/>
+ <arg value="-source-path+=${src_external.dir}"/>
+ <arg value="-library-path+=${flexSDK.dir}/frameworks/libs"/>
+ <arg value="-library-path+=${flexSDK.dir}/frameworks/libs/mx"/>
+ <arg value="-library-path+=${libs.dir}"/>
+ <arg value="-output=${bindebug.dir}/@{output}"/>
+ <arg line="${var.compilerArguments}"/>
+ </java>
+
+ <if>
+ <equals arg1="@{openSWF}" arg2="true" />
+ <then>
+ <exec executable="open" vmlauncher="true" spawn="false" failonerror="true">
+ <arg line="-a '${flashPlayer}'" />
+ <arg line="${bindebug.dir}/@{output}" />
+ </exec>
+ </then>
+ </if>
+ </else>
+ </if>
+ </sequential>
+ </macrodef>
+
+</project>
217 build/android/descriptor-template-apk.xml
@@ -0,0 +1,217 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<application xmlns="http://ns.adobe.com/air/application/2.6">
+
+<!-- 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/2.6
+ 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>@ID@</id>
+
+ <!-- Used as the filename for the application. Required. -->
+ <filename>@FILENAME@</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>@FILENAME@</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>@VERSION@</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> -->
+
+ <!-- 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>@CONTENT@</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>true</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>true</autoOrients>
+
+ <!-- Whether the app launches in full screen. Optional. Mobile only. Default false -->
+
+ <fullScreen>true</fullScreen>
+
+ <!-- The render mode for the app (either auto, cpu, or gpu). Optional. Mobile only. 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> -->
+ </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> -->
+
+ <!-- The subpath of the standard default installation location to use. Optional. -->
+ <!-- <installFolder></installFolder> -->
+
+ <!-- The subpath of the Programs menu to use. (Ignored on operating systems without a Programs menu.) Optional. -->
+ <!-- <programMenuFolder></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></image16x16>
+ <image32x32></image32x32>
+ <image36x36></image36x36>
+ <image48x48></image48x48>
+ <image72x72></image72x72>
+ <image114x114></image114x114>
+ <image128x128></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>NO</string>
+ ]]>
+ </InfoAdditions> -->
+ <!-- <requestedDisplayResolution></requestedDisplayResolution> -->
+ <!-- </iPhone> -->
+
+ <!-- Specify Android specific tags that get passed to AndroidManifest.xml file. -->
+ <android>
+ <!-- <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"/>-->
+ <manifestAdditions>
+ <![CDATA[
+ <manifest android:installLocation="auto">
+ <uses-configuration android:reqFiveWayNav="true"/>
+ <supports-screens android:normalScreens="true"/>
+ <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>
+ </android>
+ <!-- End of the schema for adding the android specific tags in AndroidManifest.xml file -->
+
+</application>
BIN build/assets/images/placekitten.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN build/assets/images/transparent_background_tile.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
217 build/iOS/descriptor-template-ipa.xml
@@ -0,0 +1,217 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<application xmlns="http://ns.adobe.com/air/application/2.6">
+
+<!-- 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/2.6
+ 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>@ID@</id>
+
+ <!-- Used as the filename for the application. Required. -->
+ <filename>@FILENAME@</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>@FILENAME@</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>@VERSION@</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> -->
+
+ <!-- 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>@CONTENT@</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>true</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>true</autoOrients>
+
+ <!-- Whether the app launches in full screen. Optional. Mobile only. Default false -->
+
+ <fullScreen>true</fullScreen>
+
+ <!-- The render mode for the app (either auto, cpu, or gpu). Optional. Mobile only. 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> -->
+ </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> -->
+
+ <!-- The subpath of the standard default installation location to use. Optional. -->
+ <!-- <installFolder></installFolder> -->
+
+ <!-- The subpath of the Programs menu to use. (Ignored on operating systems without a Programs menu.) Optional. -->
+ <!-- <programMenuFolder></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></image16x16>
+ <image32x32></image32x32>
+ <image36x36></image36x36>
+ <image48x48></image48x48>
+ <image72x72></image72x72>
+ <image114x114></image114x114>
+ <image128x128></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>
+ <!-- <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-configuration android:reqFiveWayNav="true"/>
+ <supports-screens android:normalScreens="true"/>
+ <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>
+ </android> -->
+ <!-- End of the schema for adding the android specific tags in AndroidManifest.xml file -->
+
+</application>
BIN build/libs/ant-contrib-1.0b3.jar
Binary file not shown.
BIN build/libs/commons-net-2.0.jar
Binary file not shown.
BIN build/libs/jakarta-oro-2.0.8.jar
Binary file not shown.
BIN build/libs/jsch-0.1.32.jar
Binary file not shown.
BIN libs/MinimalComps_0_9_9.swc
Binary file not shown.
BIN libs/MonsterDebuggerMobile.swc
Binary file not shown.
BIN libs/greensock.swc
Binary file not shown.
BIN src/assets/images/Splashscreen.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
112 src/org/gestouch/examples/DoubleTapGestureExample.as
@@ -0,0 +1,112 @@
+package org.gestouch.examples
+{
+ import com.bit101.components.HBox;
+ import com.bit101.components.PushButton;
+ import com.bit101.components.Style;
+ import com.bit101.components.VBox;
+ import com.bit101.components.Window;
+
+ import org.gestouch.events.DoubleTapGestureEvent;
+ import org.gestouch.examples.base.ExampleBase;
+ import org.gestouch.examples.controls.EditableLabel;
+ import org.gestouch.gestures.DoubleTapGesture;
+
+ import flash.display.DisplayObject;
+ import flash.display.DisplayObjectContainer;
+ import flash.events.FocusEvent;
+
+
+ /**
+ * @author Pavel fljot
+ */
+ public class DoubleTapGestureExample extends ExampleBase
+ {
+ public function DoubleTapGestureExample()
+ {
+ super();
+ }
+
+
+ override protected function init():void
+ {
+ super.init();
+
+// scaleX = scaleY = 2;
+
+ var vBox:VBox = new VBox(this, 10, 10);
+ vBox.spacing = 10;
+
+ var panel:Window;
+ panel = new Window(vBox, 0, 0, "Double tap on the buttons so they would change their styles.");
+ panel.draggable = false;
+ var hBox:HBox = new HBox(panel);
+ hBox.scaleX = hBox.scaleY = 2;
+ var button:PushButton;
+ button = new PushButton(hBox, 0, 0, "Double-tap me");
+ DoubleTapGesture.add(button);
+ button.addEventListener(DoubleTapGestureEvent.GESTURE_DOUBLE_TAP, button_gestureDoubleTapHandler);
+ button = new PushButton(hBox, 0, 0, "Double-tap me");
+ DoubleTapGesture.add(button);
+ button.addEventListener(DoubleTapGestureEvent.GESTURE_DOUBLE_TAP, button_gestureDoubleTapHandler);
+
+ panel = new Window(vBox, 0, 0, "Double tap on the label below to make it editable. Time threshold for gesture is set to 1000 ms.");
+ panel.draggable = false;
+ var label:EditableLabel = new EditableLabel(panel, 0, 0, "Double-tap me");
+ label.scaleX = label.scaleY = 2;
+ DoubleTapGesture.add(label, {timeThreshold: 1000});
+ label.addEventListener(DoubleTapGestureEvent.GESTURE_DOUBLE_TAP, label_gestureDoubleTapHandler);
+ }
+
+
+ override protected function onResize(sW:Number, sH:Number):void
+ {
+ super.onResize(sW, sH);
+
+ var container:DisplayObjectContainer = getChildAt(0) as DisplayObjectContainer;
+ var n:uint = container.numChildren;
+ var child:DisplayObject;
+ while (n-- > 0)
+ {
+ child = container.getChildAt(n);
+ child.width = sW - container.x * 2;
+ }
+ }
+
+
+ private function button_gestureDoubleTapHandler(event:DoubleTapGestureEvent):void
+ {
+ var button:PushButton = event.currentTarget as PushButton;
+
+ Style.BUTTON_FACE = 0xDDDDDD * Math.random();
+ button.draw();
+ }
+
+
+ private function label_gestureDoubleTapHandler(event:DoubleTapGestureEvent):void
+ {
+ var label:EditableLabel = event.currentTarget as EditableLabel;
+ label.editable = !label.editable;
+ if (label.editable)
+ {
+ label.text = "You can edit me now...";
+ label.addEventListener(FocusEvent.FOCUS_OUT, label_focusOutHandler);
+ }
+ else
+ {
+ label.text = "Double-tap me to make editable";
+ }
+ }
+
+
+ private function label_focusOutHandler(event:FocusEvent):void
+ {
+ var label:EditableLabel = event.currentTarget as EditableLabel;
+ if (stage.focus != label && (!stage.focus || !label.contains(stage.focus)))
+ {
+ label.removeEventListener(FocusEvent.FOCUS_OUT, label_focusOutHandler);
+ label.editable = false;
+ label.text = "Double-tap me to make editable";
+ }
+ }
+ }
+}
52 src/org/gestouch/examples/GestouchExamples.mxml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="utf-8"?>
+<s:ViewNavigatorApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ splashScreenImage="@Embed('/assets/images/Splashscreen.png')"
+ splashScreenScaleMode="letterbox"
+ splashScreenMinimumDisplayTime="2000"
+ firstView="org.gestouch.examples.views.GestouchExamplesHomeView"
+ frameRate="40"
+ initialize="init()"
+ applicationComplete="onComplete()"
+ >
+ <fx:Style>
+ Alert {
+ textAlign: left;
+ modalTransparency: 0.5;
+ modalTransparencyBlur: 8;
+ }
+ </fx:Style>
+ <fx:Script>
+ <![CDATA[
+ import com.demonsters.debugger.MonsterDebugger;
+
+ import org.gestouch.examples.model.ExamplesModel;
+
+ import mx.controls.Alert;
+
+ private var model:ExamplesModel = new ExamplesModel();
+
+
+ private function init():void
+ {
+ navigator.firstViewData = model;
+ }
+
+
+ private function onComplete():void
+ {
+ MonsterDebugger.initialize(this, "192.168.0.100", onConnect);
+ }
+
+
+ private function onConnect():void
+ {
+ Alert.show("MonsterDebugger connected!");
+ }
+
+ ]]>
+ </fx:Script>
+ <fx:Declarations>
+ <!-- Place non-visual elements (e.g., services, value objects) here -->
+ </fx:Declarations>
+</s:ViewNavigatorApplication>
136 src/org/gestouch/examples/LongPressGestureExample.as
@@ -0,0 +1,136 @@
+package org.gestouch.examples
+{
+ import flash.events.GesturePhase;
+
+ import com.bit101.components.HBox;
+ import com.bit101.components.PushButton;
+ import com.bit101.components.Style;
+ import com.bit101.components.VBox;
+ import com.bit101.components.Window;
+
+ import org.gestouch.events.LongPressGestureEvent;
+ import org.gestouch.examples.base.ExampleBase;
+ import org.gestouch.examples.controls.EditableLabel;
+ import org.gestouch.gestures.LongPressGesture;
+
+ import flash.display.DisplayObject;
+ import flash.display.DisplayObjectContainer;
+ import flash.events.FocusEvent;
+
+
+ /**
+ * @author Pavel fljot
+ */
+ public class LongPressGestureExample extends ExampleBase
+ {
+ public function LongPressGestureExample()
+ {
+ super();
+ }
+
+
+ override protected function init():void
+ {
+ super.init();
+
+// scaleX = scaleY = 2;
+
+ var vBox:VBox = new VBox(this, 10, 10);
+ vBox.spacing = 10;
+
+ var panel:Window;
+ panel = new Window(vBox, 0, 0, "Hold buttons for a second so they would change their styles.");
+ panel.draggable = false;
+ var hBox:HBox = new HBox(panel);
+ hBox.scaleX = hBox.scaleY = 2;
+ var button:PushButton;
+ button = new PushButton(hBox, 0, 0, "Hold me for a second");
+ LongPressGesture.add(button);
+ button.addEventListener(LongPressGestureEvent.GESTURE_LONG_PRESS, button_gestureHoldHandler);
+ button = new PushButton(hBox, 0, 0, "Hold me for a second");
+ LongPressGesture.add(button);
+ button.addEventListener(LongPressGestureEvent.GESTURE_LONG_PRESS, button_gestureHoldHandler);
+
+
+ panel = new Window(vBox, 0, 0, "Hold the labels below to make it editable. Time threshold for gesture is set to 1500 ms.");
+ panel.height = 150;
+ panel.draggable = false;
+ var label:EditableLabel;
+ vBox = new VBox(panel);
+ vBox.spacing = 20;
+ vBox.scaleX = vBox.scaleY = 2;
+ label = new EditableLabel(vBox, 0, 0, "Hold me for some time");
+ LongPressGesture.add(label, {timeThreshold: 1500});
+ label.addEventListener(LongPressGestureEvent.GESTURE_LONG_PRESS, label_gestureHoldHandler);
+ label.addEventListener(FocusEvent.FOCUS_OUT, label_focusOutHandler);
+
+ label = new EditableLabel(vBox, 0, 0, "Hold me with two (2) fingers");
+ LongPressGesture.add(label, {minTouchPointsCount: 2, maxTouchPointsCount: 2});
+ label.addEventListener(LongPressGestureEvent.GESTURE_LONG_PRESS, label_gestureHoldHandler);
+ label.addEventListener(FocusEvent.FOCUS_OUT, label_focusOutHandler);
+ }
+
+
+ override protected function onResize(sW:Number, sH:Number):void
+ {
+ super.onResize(sW, sH);
+
+ var container:DisplayObjectContainer = getChildAt(0) as DisplayObjectContainer;
+ var n:uint = container.numChildren;
+ var child:DisplayObject;
+ while (n-- > 0)
+ {
+ child = container.getChildAt(n);
+ child.width = sW - container.x * 2;
+ }
+ }
+
+
+ private function button_gestureHoldHandler(event:LongPressGestureEvent):void
+ {
+ var button:PushButton = event.currentTarget as PushButton;
+ if (event.phase == GesturePhase.BEGIN)
+ {
+ button.label = "I was held for a second.. you can try again.";
+ Style.BACKGROUND = 0xDDDDDD * Math.random();
+ }
+ else
+ {
+ Style.BUTTON_FACE = 0xDDDDDD * Math.random();
+ }
+
+ button.draw();
+ }
+
+
+ private function label_gestureHoldHandler(event:LongPressGestureEvent):void
+ {
+ var label:EditableLabel = event.currentTarget as EditableLabel;
+ if (event.phase == GesturePhase.BEGIN)
+ {
+ label.editable = !label.editable;
+ if (label.editable)
+ {
+ stage.focus = label.textField;
+ label.text = "You can edit me now...";
+ }
+ else
+ {
+ label.text = "Hold me for to make editable";
+ }
+ }
+ }
+
+
+ private function label_focusOutHandler(event:FocusEvent):void
+ {
+ var label:EditableLabel = event.currentTarget as EditableLabel;
+ if (stage.focus != label && (!stage.focus || !label.contains(stage.focus)))
+ {
+ label.removeEventListener(FocusEvent.FOCUS_OUT, label_focusOutHandler);
+ label.editable = false;
+ label.text = "Double-tap me to make editable";
+ }
+ }
+ }
+}
91 src/org/gestouch/examples/SwipeGestureExample.as
@@ -0,0 +1,91 @@
+package org.gestouch.examples
+{
+ import com.bit101.components.HUISlider;
+ import com.bit101.components.VBox;
+ import com.greensock.TweenMax;
+ import com.greensock.easing.Sine;
+
+ import org.gestouch.Direction;
+ import org.gestouch.GestureUtils;
+ import org.gestouch.events.SwipeGestureEvent;
+ import org.gestouch.examples.base.ExampleBase;
+ import org.gestouch.examples.controls.ArrowShape;
+ import org.gestouch.gestures.SwipeGesture;
+
+ import flash.display.BlendMode;
+ import flash.display.DisplayObject;
+ import flash.display.DisplayObjectContainer;
+
+
+
+
+ /**
+ * @author Pavel fljot
+ */
+ public class SwipeGestureExample extends ExampleBase
+ {
+ private var arrow:DisplayObject;
+ private var swipeGesture:SwipeGesture;
+
+
+ public function SwipeGestureExample()
+ {
+ super();
+ }
+
+
+ override protected function init():void
+ {
+ super.init();
+
+ arrow = new ArrowShape();
+ arrow.scaleX = arrow.scaleY = 50;
+ arrow.blendMode = BlendMode.INVERT;
+ arrow.alpha = 0;
+ addChild(arrow);
+
+ swipeGesture = SwipeGesture.add(stage, {direction: Direction.STRAIGHT_AXES});
+ stage.addEventListener(SwipeGestureEvent.GESTURE_SWIPE, stage_gestureSwipeHandler);
+
+ var box:VBox = new VBox(this, 10, 10);
+ box.scaleX = box.scaleY = 4;
+ var velocityThresholdSlider:HUISlider = new HUISlider(box, 0, 0, "velocityThreshold", function():void{
+ swipeGesture.velocityThreshold = velocityThresholdSlider.value * GestureUtils.IPS_TO_PPMS;
+ });
+ velocityThresholdSlider.setSliderParams(1, 10, swipeGesture.velocityThreshold / GestureUtils.IPS_TO_PPMS);
+ velocityThresholdSlider.tick = 0.5;
+ velocityThresholdSlider.labelPrecision = 1;
+ }
+
+
+ override protected function onResize(sW:Number, sH:Number):void
+ {
+ super.onResize(sW, sH);
+
+ arrow.x = sW >> 1;
+ arrow.y = sH >> 1;
+ return;
+ var container:DisplayObjectContainer = getChildAt(0) as DisplayObjectContainer;
+ var n:uint = container.numChildren;
+ var child:DisplayObject;
+ while (n-- > 0)
+ {
+ child = container.getChildAt(n);
+ child.width = sW - container.x * 2;
+ }
+ }
+
+
+ private function stage_gestureSwipeHandler(event:SwipeGestureEvent):void
+ {
+ arrow.scaleX = (event.offsetX < 0 && event.offsetY == 0 ? -1 : 1) * Math.abs(arrow.scaleX);
+ var angle:int = 0;//event.offsetX == 0 ? (event.offsetY > 0 ? 90 : -90) : Math.atan(event.offsetY / event.offsetX) * 180 / Math.PI;
+ if (event.offsetY != 0)
+ {
+ angle = event.offsetY > 0 ? 90 : -90;
+ }
+ arrow.rotation = angle;
+ TweenMax.fromTo(arrow, 2, {alpha: 1}, {alpha: 0, ease: Sine.easeIn});
+ }
+ }
+}
57 src/org/gestouch/examples/base/ExampleBase.as
@@ -0,0 +1,57 @@
+package org.gestouch.examples.base
+{
+ import flash.display.Sprite;
+ import flash.display.StageAlign;
+ import flash.display.StageScaleMode;
+ import flash.events.Event;
+
+
+ /**
+ * @author Pavel fljot
+ */
+ [SWF(backgroundColor="#FFFFFF", frameRate="40", width="800", height="600")]
+ public class ExampleBase extends Sprite
+ {
+
+ public function ExampleBase()
+ {
+ super();
+
+ addEventListener(Event.ADDED_TO_STAGE, addedToStageHandler);
+ }
+
+
+ private function addedToStageHandler(event:Event):void
+ {
+ init();
+ postinit();
+ }
+
+
+ protected function init():void
+ {
+ stage.align = StageAlign.TOP_LEFT;
+ stage.scaleMode = StageScaleMode.NO_SCALE;
+
+ stage.addEventListener(Event.RESIZE, stage_resizeHandler);
+ }
+
+
+ protected function postinit():void
+ {
+ stage_resizeHandler();
+ }
+
+
+ protected function onResize(sW:Number, sH:Number):void
+ {
+
+ }
+
+
+ private function stage_resizeHandler(event:Event = null):void
+ {
+ onResize(stage.stageWidth, stage.stageHeight);
+ }
+ }
+}
27 src/org/gestouch/examples/controls/ArrowShape.as
@@ -0,0 +1,27 @@
+package org.gestouch.examples.controls
+{
+ import flash.display.Graphics;
+ import flash.display.Shape;
+
+
+ /**
+ * @author Pavel fljot
+ */
+ public class ArrowShape extends Shape
+ {
+ public function ArrowShape()
+ {
+ var g:Graphics = graphics;
+ g.beginFill(0x000000);
+ g.moveTo(-3, -1);
+ g.lineTo(1, -1);
+ g.lineTo(1, -2);
+ g.lineTo(3, 0);
+ g.lineTo(1, 2);
+ g.lineTo(1, 1);
+ g.lineTo(-3, 1);
+ g.lineTo(-3, -1);
+ g.endFill();
+ }
+ }
+}
83 src/org/gestouch/examples/controls/EditableLabel.as
@@ -0,0 +1,83 @@
+package org.gestouch.examples.controls
+{
+ import com.bit101.components.Label;
+
+ import flash.display.DisplayObjectContainer;
+ import flash.events.KeyboardEvent;
+ import flash.text.TextFieldType;
+
+
+ /**
+ * @author Pavel fljot
+ */
+ public class EditableLabel extends Label
+ {
+ public function EditableLabel(parent:DisplayObjectContainer = null, xpos:Number = 0, ypos:Number = 0, text:String = "")
+ {
+ super(parent, xpos, ypos, text);
+ }
+
+
+ /** @private */
+ private var _editable:Boolean;
+
+ /**
+ *
+ */
+ public function get editable():Boolean
+ {
+ return _editable;
+ }
+ public function set editable(value:Boolean):void
+ {
+ if (_editable == value) return;
+
+ _editable = value;
+
+ mouseChildren = _editable;
+
+ invalidate();
+ }
+
+
+ override public function draw():void
+ {
+ super.draw();
+
+ _tf.mouseEnabled = _tf.selectable = editable;
+ if (editable)
+ {
+ _tf.type = TextFieldType.INPUT;
+ _tf.setSelection(0, _tf.length - 1);
+ if (stage && (!stage.focus || stage.focus == this || this.contains(stage.focus)))
+ {
+ stage.focus = textField;
+ }
+ }
+ else
+ {
+ _tf.type = TextFieldType.DYNAMIC;
+ _tf.setSelection(0, 0);
+ }
+ }
+
+
+ override protected function init():void
+ {
+ super.init();
+
+ _tf.addEventListener(KeyboardEvent.KEY_DOWN, textField_keyDownHandler);
+ mouseEnabled = true;
+ }
+
+
+ private function textField_keyDownHandler(event:KeyboardEvent):void
+ {
+ // if the key is ENTER
+ if (event.charCode == 13)
+ {
+ editable = false;
+ }
+ }
+ }
+}
29 src/org/gestouch/examples/controls/EditableTextInput.as
@@ -0,0 +1,29 @@
+package org.gestouch.examples.controls
+{
+ import flash.events.KeyboardEvent;
+ import spark.components.TextInput;
+
+
+ /**
+ * @author Pavel fljot
+ */
+ public class EditableTextInput extends TextInput
+ {
+ public function EditableTextInput()
+ {
+ super();
+ }
+
+
+ override protected function keyDownHandler(event:KeyboardEvent):void
+ {
+ super.keyDownHandler(event);
+
+ // if the key is ENTER
+ if (event.charCode == 13)
+ {
+ editable = false;
+ }
+ }
+ }
+}
20 src/org/gestouch/examples/controls/HintText.as
@@ -0,0 +1,20 @@
+package org.gestouch.examples.controls
+{
+ import spark.components.TextArea;
+
+
+ /**
+ * @author Pavel fljot
+ */
+ public class HintText extends TextArea
+ {
+ public function HintText()
+ {
+ setStyle("contentBackgroundAlpha", 0);
+ setStyle("borderVisible", false);
+ alpha = 0.5;
+ percentWidth = 100;
+ enabled = false;
+ }
+ }
+}
37 src/org/gestouch/examples/model/ExamplesModel.as
@@ -0,0 +1,37 @@
+package org.gestouch.examples.model
+{
+ import org.gestouch.examples.views.HoldAndDragView;
+ import org.gestouch.examples.views.DoubleTapGestureView;
+ import org.gestouch.examples.views.DragGestureView;
+ import org.gestouch.examples.views.FreeTransformView;
+ import org.gestouch.examples.views.LongPressGestureView;
+ import org.gestouch.examples.views.SwipeGestureView;
+
+ import mx.collections.ArrayCollection;
+
+ /**
+ * @author Pavel fljot
+ */
+ public class ExamplesModel
+ {
+ public static const LONG_PRESS_GESTURE_HELP:String = (<text>LongPressGesture tracks the long press.
+It has two phases: GesturePhase.BEGIN when timer is complete (finger is still down) and GesturePhase.END when user release the finger.
+You can customize:
+"slop" — the distance user should not overcome in case of (accidental) drag,
+"timeThreshold" — time in ms that nescessary to detect gesture.
+</text>).toString();
+
+
+ [Bindable]
+ public var examplesList:ArrayCollection = new ArrayCollection(
+ [
+ {label: "LongPressGesture Example", viewClass: LongPressGestureView},
+ {label: "DoubleTapGesture Example", viewClass: DoubleTapGestureView},
+ {label: "DragGesture Example", viewClass: DragGestureView},
+ {label: "SwipeGesture Example", viewClass: SwipeGestureView},
+ {label: "Free-transform Examples (Drag, Zoom, Rotate)", viewClass: FreeTransformView},
+ {label: "Hold-n-Drag Example", viewClass: HoldAndDragView}
+ ]
+ );
+ }
+}
152 src/org/gestouch/examples/views/DoubleTapGestureView.mxml
@@ -0,0 +1,152 @@
+<?xml version="1.0" encoding="utf-8"?>
+<views:ExampleViewBase xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:mx="library://ns.adobe.com/flex/mx"
+ xmlns:views="org.gestouch.examples.views.*"
+ xmlns:controls="org.gestouch.examples.controls.*"
+ title="DoubleTapGesture Examples"
+ >
+
+ <fx:Script>
+ <![CDATA[
+ import spark.components.Button;
+ import spark.components.TextInput;
+
+ import com.greensock.TweenMax;
+ import com.greensock.plugins.GlowFilterPlugin;
+ import com.greensock.plugins.TweenPlugin;
+
+ import org.gestouch.events.DoubleTapGestureEvent;
+ import org.gestouch.gestures.DoubleTapGesture;
+
+ import flash.display.DisplayObject;
+ import flash.events.FocusEvent;
+ import flash.events.MouseEvent;
+
+
+ override protected function init():void
+ {
+ TweenPlugin.activate([GlowFilterPlugin]);
+
+ button1.addEventListener(DoubleTapGestureEvent.GESTURE_DOUBLE_TAP, button_gestureDoubleTapHandler);
+ button2.addEventListener(DoubleTapGestureEvent.GESTURE_DOUBLE_TAP, button_gestureDoubleTapHandler);
+ button3.addEventListener(DoubleTapGestureEvent.GESTURE_DOUBLE_TAP, button_gestureDoubleTapHandler);
+ button4.addEventListener(DoubleTapGestureEvent.GESTURE_DOUBLE_TAP, button_gestureDoubleTapHandler);
+
+ label.addEventListener(DoubleTapGestureEvent.GESTURE_DOUBLE_TAP, label_gestureDoubleTapHandler);
+ label.addEventListener(FocusEvent.FOCUS_OUT, label_focusOutHandler);
+ }
+
+
+ override protected function onViewActivate():void
+ {
+ super.onViewActivate();
+
+ var foo:DoubleTapGesture = DoubleTapGesture.add(button1);
+ DoubleTapGesture.add(button2);
+ try
+ {
+ foo.target = button2;
+ }
+ catch(error:Error)
+ {
+ // example to show that u can't set another gesture
+ // of the same type on one target
+ trace(error);
+ trace(foo.target == button1);
+ trace(foo.target == button2);
+ }
+ DoubleTapGesture.add(label, {timeThreshold: 1000});
+ DoubleTapGesture.add(button3, {minTouchPointsCount: 2, moveThreshold: 50});
+ DoubleTapGesture.add(button4, {minTouchPointsCount: 2, moveThreshold: NaN});
+ }
+
+
+ override protected function onViewDeactivate():void
+ {
+ super.onViewDeactivate();
+
+ DoubleTapGesture.remove(button1);
+ DoubleTapGesture.remove(button2);
+ DoubleTapGesture.remove(label);
+ DoubleTapGesture.remove(button3);
+ DoubleTapGesture.remove(button4);
+ }
+
+
+ private function button_gestureDoubleTapHandler(event:DoubleTapGestureEvent):void
+ {
+ var button:Button = event.currentTarget as Button;
+ TweenMax.fromTo(button, 1,
+ {glowFilter: {color: 0xEEEEEE * Math.random(), blurX: 16, blurY: 16, strength: 2, alpha: 1}},
+ {glowFilter: {alpha: 0, remove: true}
+ });
+ }
+
+
+ private function label_gestureDoubleTapHandler(event:DoubleTapGestureEvent):void
+ {
+ var label:TextInput = event.currentTarget as TextInput;
+ label.editable = !label.editable;
+ if (label.editable)
+ {
+ stage.focus = label;
+ label.text = "You can edit me now...";
+ stage.addEventListener(MouseEvent.MOUSE_DOWN, stage_mouseDownHandler, true);
+ }
+ else
+ {
+ label.text = "Hold me for to make editable";
+ }
+ }
+
+
+ private function stage_mouseDownHandler(event:MouseEvent):void
+ {
+ if ((stage.focus == label || (stage.focus && label.contains(stage.focus))) && !label.contains(event.target as DisplayObject))
+ {
+ stage.focus = null;
+ }
+ }
+
+
+ private function label_focusOutHandler(event:FocusEvent):void
+ {
+ if (stage.focus != label && (!stage.focus || !label.contains(stage.focus)))
+ {
+ stage.removeEventListener(MouseEvent.MOUSE_DOWN, stage_mouseDownHandler, true);
+ label.editable = false;
+ label.text = "Double-tap me to make editable";
+ }
+ }
+ ]]>
+ </fx:Script>
+
+ <s:Scroller width="100%" height="100%">
+ <s:Group>
+ <s:layout>
+ <s:VerticalLayout/>
+ </s:layout>
+
+ <controls:HintText text="Double-tap these buttons for them to respond. Try several buttons at the same time — it's basically multi-user interface."/>
+ <s:Group top="10" left="10">
+ <s:layout>
+ <s:HorizontalLayout/>
+ </s:layout>
+ <s:Button id="button1" label="Double-tap me"/>
+ <s:Button id="button2" label="Double-tap me"/>
+ </s:Group>
+
+ <mx:HRule width="100%"/>
+
+ <controls:HintText text="Double-tap this input element in 1000ms time-frame to make editable."/>
+ <controls:EditableTextInput id="label" text="Double-tap me to make editable" editable="false"/>
+
+ <mx:HRule width="100%"/>
+
+ <controls:HintText text="This one below is DoubleTapGesture with minTouchPointsCount = 2."/>
+ <s:Button id="button3" label="Double-tap me with two fingers"/>
+ <s:Button id="button4" label="Double-tap me with two fingers (no moveThreshold)"/>
+ </s:Group>
+ </s:Scroller>
+</views:ExampleViewBase>
78 src/org/gestouch/examples/views/DragGestureView.mxml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="utf-8"?>
+<views:ExampleViewBase xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:mx="library://ns.adobe.com/flex/mx"
+ xmlns:views="org.gestouch.examples.views.*"
+ xmlns:controls="org.gestouch.examples.controls.*"
+ title="DragGesture Examples"
+ >
+
+ <views:layout>
+ <s:VerticalLayout/>
+ </views:layout>
+
+ <fx:Script>
+ <![CDATA[
+ import spark.components.Button;
+
+ import com.greensock.TweenMax;
+ import com.greensock.plugins.GlowFilterPlugin;
+ import com.greensock.plugins.TweenPlugin;
+
+ import org.gestouch.events.DragGestureEvent;
+ import org.gestouch.gestures.DragGesture;
+
+ import flash.events.GesturePhase;
+
+
+
+ override protected function init():void
+ {
+ TweenPlugin.activate([GlowFilterPlugin]);
+
+ button1.addEventListener(DragGestureEvent.GESTURE_DRAG, button_gestureDragHandler);
+ button2.addEventListener(DragGestureEvent.GESTURE_DRAG, button_gestureDragHandler);
+ }
+
+
+ override protected function onViewActivate():void
+ {
+ super.onViewActivate();
+
+ DragGesture.add(button1);
+ DragGesture.add(button2, {minTouchPointsCount: 2});
+ }
+
+
+ override protected function onViewDeactivate():void
+ {
+ super.onViewDeactivate();
+
+ DragGesture.remove(button1);
+ DragGesture.remove(button2);
+ }
+
+
+ private function button_gestureDragHandler(event:DragGestureEvent):void
+ {
+ var button:Button = event.currentTarget as Button;
+ if (event.phase == GesturePhase.BEGIN)
+ {
+ TweenMax.to(button, 0.5, {glowFilter: {color: 0xEEEEEE * Math.random(), blurX: 16, blurY: 16, strength: 2, alpha: 1}});
+ }
+ else if (event.phase == GesturePhase.UPDATE)
+ {
+ button.move(button.x + event.offsetX, button.y + event.offsetY);
+ }
+ else if (event.phase == GesturePhase.END)
+ {
+ TweenMax.to(button, 1, {glowFilter: {alpha: 0, remove: true}});
+ }
+ }
+ ]]>
+ </fx:Script>
+
+ <controls:HintText text="Drag the button around the screen"/>
+ <s:Button id="button1" x="10" y="50" label="Drag me"/>
+ <s:Button id="button2" x="10" y="80" label="Drag me with two fingers" scaleX="1.5" scaleY="1.5"/>
+</views:ExampleViewBase>
120 src/org/gestouch/examples/views/ExampleViewBase.as
@@ -0,0 +1,120 @@
+package org.gestouch.examples.views
+{
+ import spark.events.ViewNavigatorEvent;
+ import flash.events.MouseEvent;
+ import spark.components.Button;
+ import spark.components.View;
+
+ import mx.events.FlexEvent;
+ import mx.events.ResizeEvent;
+
+
+ /**
+ * @author Pavel fljot
+ */
+ public class ExampleViewBase extends View
+ {
+ private var backButton:Button;
+ private var helpButton:Button;
+
+
+ public function ExampleViewBase()
+ {
+ super();
+
+ backButton = new Button();
+ backButton.label = "Back";
+ helpButton = new Button();
+ helpButton.label = "?";
+
+ navigationContent = [backButton];
+ actionContent = [helpButton];
+ addEventListener(ResizeEvent.RESIZE, resizeHandler);
+ addEventListener(FlexEvent.INITIALIZE, initializeHandler);
+ addEventListener(FlexEvent.CREATION_COMPLETE, creationCompleteHandler);
+ addEventListener(ViewNavigatorEvent.VIEW_ACTIVATE, viewActivateHandler);
+ addEventListener(ViewNavigatorEvent.VIEW_DEACTIVATE, viewDeactivateHandler);
+ }
+
+
+ protected function init():void
+ {
+
+ }
+
+
+ protected function openHelp():void
+ {
+
+ }
+
+
+ protected function onViewActivate():void
+ {
+
+ }
+
+
+ protected function onViewDeactivate():void
+ {
+
+ }
+
+
+ protected function onResize(width:Number, height:Number):void
+ {
+
+ }
+
+
+ private function viewActivateHandler(event:ViewNavigatorEvent):void
+ {
+ backButton.addEventListener(MouseEvent.CLICK, backButton_clickHandler);
+ helpButton.addEventListener(MouseEvent.CLICK, helpButton_clickHandler);
+
+ onViewActivate();
+ }
+
+
+ private function helpButton_clickHandler(event:MouseEvent):void
+ {
+ openHelp();
+ }
+
+
+ private function viewDeactivateHandler(event:ViewNavigatorEvent):void
+ {
+ backButton.removeEventListener(MouseEvent.CLICK, backButton_clickHandler);
+ helpButton.removeEventListener(MouseEvent.CLICK, helpButton_clickHandler);
+
+ onViewDeactivate();
+ }
+
+
+ private function backButton_clickHandler(event:MouseEvent):void
+ {
+ backButton.removeEventListener(MouseEvent.CLICK, backButton_clickHandler);
+ navigator.popView();
+ }
+
+
+ private function initializeHandler(event:FlexEvent):void
+ {
+ removeEventListener(FlexEvent.INITIALIZE, initializeHandler);
+ init();
+ }
+
+
+ private function creationCompleteHandler(event:FlexEvent):void
+ {
+ removeEventListener(FlexEvent.CREATION_COMPLETE, creationCompleteHandler);
+ onResize(width, height);
+ }
+
+
+ private function resizeHandler(event:ResizeEvent):void
+ {
+ onResize(width, height);
+ }
+ }
+}
189 src/org/gestouch/examples/views/FreeTransformView.mxml
@@ -0,0 +1,189 @@
+<?xml version="1.0" encoding="utf-8"?>
+<views:ExampleViewBase xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:mx="library://ns.adobe.com/flex/mx"
+ xmlns:views="org.gestouch.examples.views.*"
+ xmlns:controls="org.gestouch.examples.controls.*"
+ title="Free-transform Examples: DragGesture, ZoomGesture, RotateGesture"
+ >
+
+ <fx:Script>
+ <![CDATA[
+ import com.greensock.TweenMax;
+ import org.gestouch.GestureUtils;
+ import org.gestouch.events.DragGestureEvent;
+ import org.gestouch.events.RotateGestureEvent;
+ import org.gestouch.events.ZoomGestureEvent;
+ import org.gestouch.gestures.DragGesture;
+ import org.gestouch.gestures.RotateGesture;
+ import org.gestouch.gestures.ZoomGesture;
+
+
+ private var dragGesture:DragGesture;
+ [Bindable]
+ private var zoomGesture:ZoomGesture;
+ private var rotateGesture:RotateGesture;
+
+
+ override protected function init():void
+ {
+ // normally you could use Greensock's TransformArounCenterPlugin
+ // but it's not open-source, so I can't include it here
+// TweenPlugin.activate([TransformAroundCenterPlugin]);
+
+ image.addEventListener(RotateGestureEvent.GESTURE_ROTATE, image_gestureRotateHandler);
+ image.addEventListener(DragGestureEvent.GESTURE_DRAG, image_gestureDragHandler);
+ image.addEventListener(ZoomGestureEvent.GESTURE_ZOOM, image_gestureZoomHandler);
+ image.addEventListener(MouseEvent.MOUSE_DOWN, fadeInImage);
+ image.addEventListener(TouchEvent.TOUCH_BEGIN, fadeInImage);
+ }
+
+
+ private function fadeInImage(event:Event):void
+ {
+ image.alpha = 1;
+ }
+
+
+ override protected function onViewActivate():void
+ {
+ super.onViewActivate();
+
+ updateDragGesture();
+ updateZoomGesture();
+ updateRotateGesture();
+ }
+
+
+ override protected function onViewDeactivate():void
+ {
+ super.onViewDeactivate();
+
+ if (dragGesture)
+ {
+ dragGesture.dispose();
+ dragGesture = null;
+ }
+ if (zoomGesture)
+ {
+ zoomGesture.dispose();
+ zoomGesture = null;
+ }
+ if (rotateGesture)
+ {
+ rotateGesture.dispose();
+ rotateGesture = null;
+ }
+ }
+
+
+ private function image_gestureZoomHandler(event:TransformGestureEvent):void
+ {
+ var matrix:Matrix = image.transform.matrix;
+ var transformPoint:Point = matrix.transformPoint(new Point(event.localX, event.localY));
+ matrix.translate(-transformPoint.x, -transformPoint.y);
+ matrix.scale(event.scaleX, event.scaleY);
+ matrix.translate(transformPoint.x, transformPoint.y);
+ image.transform.matrix = matrix;
+
+ if (event.phase == GesturePhase.END)
+ {
+ const MIN_SCALE:Number = 0.6;
+ if (image.scaleX < MIN_SCALE || image.scaleY < MIN_SCALE)
+ {
+ // normally you could use Greensock's TransformArounCenterPlugin
+ // but it's not open-source, so I can't include it here
+// TweenMax.to(image, 0.3, {transformAroundCenter: {scale: MIN_SCALE}});
+ TweenMax.to(image, 0.3, {scaleX: MIN_SCALE, scaleY: MIN_SCALE});
+ }
+ }
+ }
+
+
+ private function image_gestureRotateHandler(event:RotateGestureEvent):void
+ {
+ var matrix:Matrix = image.transform.matrix;
+ var transformPoint:Point = matrix.transformPoint(new Point(event.localX, event.localY));
+ matrix.translate(-transformPoint.x, -transformPoint.y);
+ matrix.rotate(event.rotation * GestureUtils.DEGREES_TO_RADIANS);
+ matrix.translate(transformPoint.x, transformPoint.y);
+ image.transform.matrix = matrix;
+ }
+
+
+ private function image_gestureDragHandler(event:DragGestureEvent):void
+ {
+ image.move(image.x + event.offsetX, image.y + event.offsetY);
+ }
+
+
+ private function reset():void
+ {
+ image.transform.matrix = new Matrix(1, 0, 0, 1, 60, 60);
+ }
+
+
+
+ private function updateDragGesture():void
+ {
+ if (dragCheckBox.selected && !dragGesture)
+ {
+ dragGesture = DragGesture.add(image, {minTouchPointsCount: 1, maxTouchPointsCount: 2});
+ }
+ else if (!dragCheckBox.selected && dragGesture)
+ {
+ dragGesture.dispose();
+ dragGesture = null;
+ }
+ }
+ private function updateZoomGesture():void
+ {
+ if (zoomCheckBox.selected && !zoomGesture)
+ {
+ zoomGesture = ZoomGesture.add(image);
+ }
+ else if (!zoomCheckBox.selected && zoomGesture)
+ {
+ zoomGesture.dispose();
+ zoomGesture = null;
+ }
+
+ if (zoomGesture)
+ {
+ zoomGesture.lockAspectRatio = ratioCheckBox.selected;
+ }
+ }
+ private function updateRotateGesture():void
+ {
+ if (rotateCheckBox.selected && !rotateGesture)
+ {
+ rotateGesture = RotateGesture.add(image);
+ }
+ else if (!rotateCheckBox.selected && rotateGesture)
+ {
+ rotateGesture.dispose();
+ rotateGesture = null;
+ }
+ }
+ ]]>
+ </fx:Script>
+
+ <s:Group top="10" left="10" width="100%" scaleX="0.5" scaleY="0.5">
+ <s:layout>
+ <s:TileLayout/>
+ </s:layout>
+ <controls:HintText text="You can drag (with 1 or 2 fingers), scale (pinch) and rotate the image."/>
+ <s:Button id="resetButton" label="Reset image transformation" click="reset()"/>
+ <s:CheckBox id="dragCheckBox" label="Drag" selected="true" change="updateDragGesture()"/>
+ <s:CheckBox id="zoomCheckBox" label="Zoom" selected="true" change="updateZoomGesture()"/>
+ <s:CheckBox id="rotateCheckBox" label="Rotate" selected="true" change="updateRotateGesture()"/>
+ <s:CheckBox id="ratioCheckBox" label="Lock aspect ratio (for ZoomGesture)" selected="true" change="updateZoomGesture()" />
+ </s:Group>
+
+ <s:Image id="image"
+ x="60" y="60"
+ source="@Embed(source='/../build/assets/images/placekitten.jpg')"
+ alpha="0.4"
+ />
+
+</views:ExampleViewBase>
57 src/org/gestouch/examples/views/GestouchExamplesHomeView.mxml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="utf-8"?>
+<views:ExampleViewBase xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:mx="library://ns.adobe.com/flex/mx"
+ xmlns:views="org.gestouch.examples.views.*"
+ xmlns:controls="org.gestouch.examples.controls.*"
+ title="Gestouch Examples"
+ destructionPolicy="never"
+ >
+ <fx:Script>
+ <![CDATA[
+ import spark.events.IndexChangeEvent;
+
+ import org.gestouch.examples.model.ExamplesModel;
+
+
+ [Bindable]
+ private var model:ExamplesModel;
+
+
+ override protected function init():void
+ {
+ navigationContent = [];
+ actionContent = [];
+ }
+
+
+ override protected function onViewActivate():void
+ {
+ super.onViewActivate();
+
+ if (data)
+ {
+ model = data as ExamplesModel;
+ }
+ list.selectedIndex = -1;
+ }
+
+
+ private function onListChange(event:IndexChangeEvent):void
+ {
+ if (event.newIndex > -1)
+ {
+ var exampleName:String = list.selectedItem.label;
+ var viewClass:Class = list.selectedItem.viewClass;
+ navigator.pushView(viewClass, model);
+ }
+ }
+ ]]>
+ </fx:Script>
+ <fx:Declarations>
+ <!-- Place non-visual elements (e.g., services, value objects) here -->
+ </fx:Declarations>
+ <s:List id="list" width="100%" height="100%" dataProvider="{model.examplesList}"
+ change="onListChange(event)"
+ />
+</views:ExampleViewBase>
104 src/org/gestouch/examples/views/HoldAndDragView.mxml
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="utf-8"?>
+<views:ExampleViewBase xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:mx="library://ns.adobe.com/flex/mx"
+ xmlns:views="org.gestouch.examples.views.*"
+ xmlns:controls="org.gestouch.examples.controls.*"
+ title="Hold-n-Drag Example"
+ >
+
+ <views:layout>
+ <s:VerticalLayout/>
+ </views:layout>
+
+ <fx:Script>
+ <![CDATA[
+ import com.greensock.TweenMax;
+ import com.greensock.plugins.GlowFilterPlugin;
+ import com.greensock.plugins.TweenPlugin;
+
+ import org.gestouch.events.DragGestureEvent;
+ import org.gestouch.events.LongPressGestureEvent;
+ import org.gestouch.gestures.DragGesture;
+ import org.gestouch.gestures.LongPressGesture;
+
+ import flash.events.GesturePhase;
+
+
+ private var longPressGesture:LongPressGesture;
+ private var dragGesture:DragGesture;
+
+