15 Replies Latest reply on Jan 5, 2010 4:52 PM by David_F57

    Import class Multitouch fail

    RicardoFressa

      Hello, all right?
      I saw a talk by Andrew Trice on using Flex Builder 4 MultiTouch and found it very interesting.
      But when I use the class Multitouch in my Flex Builder 4 he did not think the same, it will be?

      I imported a class like this:

      import flash.ui.multitouch;

      the error was in 1120 that found the property multitouch

      and also tried to use an example of the blog Andrew Trice ...
      Wanted to know how to do this class appear in Flex Builder 4, if there is any library that I imported before use and how do I do ...

      I thank your help and congratulations for the excellent work

        • 1. Re: Import class Multitouch fail
          David_F57 Level 5

          Hi,

           

          Multi-touch is a new thing for flex and there are a few things you need to do, I think the examples you may be refering to were done several months ago and are missing some libraries that were used back then.

           

          You need to download the lates flashplayer 10.1 beta and also get the air 2.0 beta and sdk, there is a replacment for the globalplayer.swc which will let you use touch events in the ide, the following code is a simple touch screen test. You just need to add an image.

           

           

          also have a look at this thread

           

          http://forums.adobe.com/thread/542429

           

           

          David

           

          <?xml version="1.0" encoding="utf-8"?>

          <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

             xmlns:s="library://ns.adobe.com/flex/spark"

             xmlns:mx="library://ns.adobe.com/flex/mx" viewSourceURL="srcview/index.html" width="1024" height="800" verticalCenter="0" horizontalCenter="0">

           

          <fx:Script>

          <![CDATA[

          import flash.events.GestureEvent;

          import flash.events.PressAndTapGestureEvent;

          import flash.events.TouchEvent;

          import flash.events.TransformGestureEvent;

           

          import mx.collections.ArrayCollection;

           

          [Bindable] private var arr:ArrayCollection = new ArrayCollection();

           

          protected function image1_gestureZoomHandler(event:TransformGestureEvent):void

          {

          arr.addItemAt("zoom",0);

          zoom.stop();

          zoom.zoomWidthFrom = img.scaleX;

          zoom.zoomWidthTo = img.scaleX * event.scaleX;

          zoom.zoomHeightFrom = img.scaleY;

          zoom.zoomHeightTo = img.scaleY * event.scaleY;

           

          zoom.play();

          }

           

           

          protected function image1_touchMoveHandler(event:TouchEvent):void

          {

          arr.addItemAt("move",0);

          }

           

           

          protected function image1_touchTapHandler(event:TouchEvent):void

          {

          arr.addItemAt("tap",0);

          }

           

           

          protected function image1_gestureRotateHandler(event:TransformGestureEvent):void

          {

          arr.addItemAt("rotate",0);

          }

           

           

          protected function image1_gestureTwoFingerTapHandler(event:GestureEvent):void

          {

          arr.addItemAt("2 finger tap",0);

          }

           

           

          protected function image1_gesturePanHandler(event:TransformGestureEvent):void

          {

          arr.addItemAt("gesturepan",0);

          }

           

           

          protected function image1_gestureSwipeHandler(event:TransformGestureEvent):void

          {

          arr.addItemAt("gestureswipe",0);

          }

           

           

          protected function image1_gesturePressAndTapHandler(event:PressAndTapGestureEvent):void

          {

          arr.addItemAt("press_tap",0);

          }

           

          ]]>

          </fx:Script>

          <fx:Declarations>

          <mx:Zoom id="zoom" target="{img}" duration="1" />

          </fx:Declarations>

           

          <mx:Image id="img" width="510" height="342" source="img_007.jpg"

            gestureZoom="image1_gestureZoomHandler(event)"

            gestureRotate="image1_gestureRotateHandler(event)"

            gestureTwoFingerTap="image1_gestureTwoFingerTapHandler(event)"

            gesturePan="image1_gesturePanHandler(event)"

            gestureSwipe="image1_gestureSwipeHandler(event)"

            gesturePressAndTap="image1_gesturePressAndTapHandler(event)"

            touchMove="image1_touchMoveHandler(event)"

            touchTap="image1_touchTapHandler(event)" horizontalCenter="-61" verticalCenter="22"/>

          <s:List id="lst" y="9" width="190" height="752" dataProvider="{arr}" right="5"></s:List>

          <s:Button x="903" y="769" label="Clear" right="150" click="arr.removeAll()"/>

          </s:Application>

          • 2. Re: Import class Multitouch fail
            RicardoFressa Level 1

            Through her example is still going a few mistakes, probably because I can not put that library to work ...
            Will could help me, showing me how to add this library to run the classes multitouch, gesture, etc ...

            errors in my project:

            Description Resource Path Location Type
            1046: Type was not found or was not a compile-time constant: GestureEvent. main.mxml MultiTouch/src line 82 Flex Problem
            1046: Type was not found or was not a compile-time constant: PressAndTapGestureEvent. main.mxml MultiTouch/src line 112 Flex Problem
            1046: Type was not found or was not a compile-time constant: TouchEvent. main.mxml MultiTouch/src line 52 Flex Problem
            1046: Type was not found or was not a compile-time constant: TouchEvent. main.mxml MultiTouch/src line 62 Flex Problem
            1046: Type was not found or was not a compile-time constant: TransformGestureEvent. main.mxml MultiTouch/src line 29 Flex Problem
            1046: Type was not found or was not a compile-time constant: TransformGestureEvent. main.mxml MultiTouch/src line 72 Flex Problem
            1046: Type was not found or was not a compile-time constant: TransformGestureEvent. main.mxml MultiTouch/src line 92 Flex Problem
            1046: Type was not found or was not a compile-time constant: TransformGestureEvent. main.mxml MultiTouch/src line 102 Flex Problem

            • 3. Re: Import class Multitouch fail
              David_F57 Level 5

              Hi,

               

              this is for windows but it should be similar to macs.

               

              Step 1 download the latest nightly build of the sdk

               

              http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+4

               

              unzip it into a folder below the existing sdk folder (call it mySDK)

               

              Step 2 download the flashplayer 10.1 plugins and global player, install the plugins

              http://labs.adobe.com/downloads/flashplayer10.html#pgswc

               

               

              step 3 replace the global player swc with the one from the flash download site into your new sdk

               

               

              C:\Program Files (x86)\Adobe\Adobe Flash Builder 4\mySDK\frameworks\libs\player\10

               

              step 4 Open flashbuilder and add the new sdk

              menu - windows/preferences

              dialog - flash builder/install sdks.

               

              step 5 either create a new project and select the new sdk as the one you want to use, for an existing project change the sdk to the new one and it will rebuild.

               

               

              David

               

              [edited] some typo's

              • 4. Re: Import class Multitouch fail
                RicardoFressa Level 1

                Thank you very much for your help and your patience, now following his footsteps could use the classes multitouch, gesture, etc., the errors also disappeared ... But the application is not starting and if I try to start again says he is using.
                I installed Flash Player 10.1 Beta, Adobe Air 2, I'm using the Flex SDK that the site of 100mb ... I believe I'm doing alright ....
                Do you know what is going wrong for the application Uninitiated?

                • 5. Re: Import class Multitouch fail
                  David_F57 Level 5

                  Hi,

                   

                  There are 2 more things you can try the first is to change the target for the flex application from flash 10.0.0 to 10.1.0, if this doesn't work do a release build and see if you can run the release copy.

                   

                  There is a chance that you are also having issues with the fp 10 debugger that comes with flashbuilder (fp 10.1 debugging plugins aren't available yet). If there any messages about the debugger take the option to continue without debugging.

                   

                  You can also download the Air 2.0 sdk and copy its content into the flex SDK you are using for these tests(the instructions about copying the content directly into the sdk are included in the zip file).

                   

                  download my testbed app and try to see if it will compile and run-

                   

                  http://ezflex.net/AirTest.fxp  , This is actually an Air desktop project so it doesn't use the same debugging routines that flex net applications use.

                   

                   

                  David

                  • 6. Re: Import class Multitouch fail
                    RicardoFressa Level 1

                    Hi David, I really am very new in these applications multitouch and are too complicated for me. There are things you told me now that I do not know ..

                    How to use Flex Builder 4 plug-in 10.1 instead of 10.0?

                    Where is the AIR SDK 2.0 in order to apply correct in my flex sdk I'm using?


                    I do not know compiles this file to me now, is it so can you explain?


                    I would be very happy and grateful for your help ...

                    • 7. Re: Import class Multitouch fail
                      David_F57 Level 5

                      Hi,

                       

                      I'm a little distracted at the moment so just quickly,

                       

                      you can downloadd the air 2.0 sdk  http://labs.adobe.com/downloads/air2.html

                       

                      its a zip file with the same folder structure as the flexsdk so it can just be extracted directly into the flex sdk and it will replace the existing air items.

                       

                      You don't really need to use air but for the new flashplayer 10.1 its a little easier as it doesn't need to be targeted to the player

                       

                       

                      With flex you can target your project to a specific flash player -

                       

                      from the project menu open the properties dialog

                       

                      on the left hand side click 'Flex Compiler'

                       

                      the second option on the right lets you target the player change 10.0.0 to 10.1.0

                       

                       

                      David.

                       

                      Note: If anyone knows of a tutorial about setting up sdk's could they post a link here, or maybe I should just do one when I have time

                      • 8. Re: Import class Multitouch fail
                        RicardoFressa Level 1

                        Hello, thank you again for these tips, I could not find the options that you told me.
                        I wanted to please, if you do not bother to look that much print screen I took of my Flash menu Builder 4.0 and two errors that occur with your application.
                        Thanks

                         

                        http://uploaddeimagens.com.br/imagem/ver/print01.jpg

                         

                         

                        http://uploaddeimagens.com.br/imagem/ver/print02.jpg

                        • 9. Re: Import class Multitouch fail
                          David_F57 Level 5

                          The project I gave you is a flex 4 application, try unchecking flex3 compatibility mode in the compiler properties. Also the sdk you are using is the original sdk that came with Flashbuilder beta 2 maybe you have done something wrong there.

                           

                          What I can do is organise a live connection so you can  login and I can step through the process on my pc will you watch and you can ask questions as it is done. This is much better my timezone is GMT+10 so let me know if you want to do this and I will send you a link.

                           

                           

                          David.

                          • 10. Re: Import class Multitouch fail
                            RicardoFressa Level 1

                            Wow, that would be great, now 10:30 in the morning ...
                            How would the connection with my computer?

                            • 11. Re: Import class Multitouch fail
                              David_F57 Level 5

                              Hi,

                               

                              Its very easy, you go to this url

                               

                              https://connectnow.acrobat.com/davidf57/testdev

                               

                              login in as a guest, its up now so just login so you know it works and tommorrow morning (your time) i'll put aside some time to go through it with you (it's almost midnight here).

                               

                              David

                              • 12. Re: Import class Multitouch fail
                                Jason San Jose Adobe Employee

                                Thanks David for the great response here. I'd like to emphasize some points David makes.

                                 

                                Create a new SDK whenever you're replacing any SWC's built-in to the SDKs. Flash Builder (all versions) will not update it's cache if you try to reuse an existing SDK (see http://bugs.adobe.com/jira/browse/FB-24767).

                                 

                                1) Simply download or copy an SDK

                                2) Replace the SWCs you're targeting (newer playerglobal.swc or airglobal.swc are the most comment use case)

                                3) Add the your new copy to Flash Builder under Preferences > Flash Builder > Installed SDKs

                                4) Set your project to point to your new copied SDK under Project > Properties > Flex Compiler, Use a specific SDK

                                 

                                These instructions should work for Flex Builder 3.0.2 or higher including the latest beta of Flash Builder 4.

                                 

                                Failing to follow these steps will lead to issues like missing code hints and deleted imports. It's especially confusing since the compiler won't report any errors since it uses different SWC caching logic.

                                 

                                Jason San Jose

                                Quality Engineer, Flash Builder

                                • 13. Re: Import class Multitouch fail
                                  RicardoFressa Level 1

                                  David,

                                   

                                  Would you provide the link of your application that you had put here?

                                  • 15. Re: Import class Multitouch fail
                                    David_F57 Level 5

                                    Hi Jason,

                                     

                                     

                                    As and additional emphasis, never mix sdk's in a workspace, its far better to have a specific workspace for development witth any particular sdk, also helps avoid any confusion

                                     

                                    ie I am setup this way.

                                     

                                    Workspace  1: defaults to flex 3 sdk

                                    Workspace  2: flashbuilder supplied 4.0 sdk

                                    Workspace  3: flashbuilder svn 4.0 sdk

                                    Workspace  4: Nightlies.

                                    WorkSpace 5: Flash player 10.1

                                    WorkSpace 6: test cases-usually for the forums stuff.

                                     

                                     

                                    David.