Problems with Gesture Works
Posted: 08 February 2011 10:34 PM   [ Ignore ]
Rank
Joined  2011-01-31
Total Posts:  2
New Member

I am trying out a tutorial on Gesture Works. But i dont know if i have done it correctly, i am using Flex 4 with papervision 3d. I am using Actionscript file and not mxml. When i run my file it apeared to me “TypeError: Error #1034: Type Coercion failed: cannot convert flash.events::TransformGestureEvent@2ceff21 to gl.events.GestureEvent.”

Btw, here is my codes:
package
{
import flash.display.Loader;
//import flash.display.Sprite;
import flash.events.Event;
import flash.net.URLRequest;

import gl.events.GestureEvent;
import gl.events.TouchEvent;

import id.core.Application;
import id.core.TouchSprite;

import org.papervision3d.view.BasicView;

public class GestureTouch extends BasicView
{
public var orchidSprite:TouchSprite;
public var orchidLoader:Loader;
public var beeSprite:TouchSprite;
public var beeLoader:Loader;

public function GestureTouch()
{
orchidSprite = new TouchSprite();
orchidLoader=new Loader();

orchidLoader.load(new URLRequest("../orchid.jpg"));
orchidLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,loaderComplete);

orchidSprite.x = Math.random()*stage.stageWidth;
orchidSprite.y = Math.random()*stage.stageHeight;
orchidSprite.rotation = Math.random()*360
orchidSprite.blobContainerEnabled = true;

orchidSprite.addEventListener(TouchEvent.TOUCH_DOWN, startDrag_Press);
orchidSprite.addEventListener(TouchEvent.TOUCH_UP, stopDrag_Release);
orchidSprite.addEventListener(GestureEvent.GESTURE_ROTATE, gestureRotateHandler);
orchidSprite.addEventListener(GestureEvent.GESTURE_SCALE, gestureScaleHandler);
orchidSprite.addChild(orchidLoader);
addChild(orchidSprite);

beeSprite = new TouchSprite();
beeLoader=new Loader();
beeLoader.load(new URLRequest("../bee.jpg"));
beeLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,loaderComplete);
beeSprite.x = Math.random()*stage.stageWidth;
beeSprite.y = Math.random()*stage.stageHeight;
beeSprite.rotation = Math.random()*360
beeSprite.blobContainerEnabled = true;

beeSprite.addEventListener(TouchEvent.TOUCH_DOWN, startDrag_Press);
beeSprite.addEventListener(TouchEvent.TOUCH_UP, stopDrag_Release);
beeSprite.addEventListener(GestureEvent.GESTURE_ROTATE, gestureRotateHandler);
beeSprite.addEventListener(GestureEvent.GESTURE_SCALE, gestureScaleHandler);
beeSprite.addChild(beeLoader);
addChild(beeSprite);
}

public function loaderComplete(e:Event):void {
e.target.loader.x = -e.target.width/2;
e.target.loader.y = -e.target.height/2;
}

public function startDrag_Press(e:TouchEvent):void {
e.target.startTouchDrag(-1);
}
public function stopDrag_Release(e:TouchEvent):void {
e.target.stopTouchDrag(-1);
}

public function gestureRotateHandler(e:GestureEvent):void {
e.target.rotation += e.value;
}

public function gestureScaleHandler(e:GestureEvent):void {
e.target.scaleX += e.value;
e.target.scaleY += e.value;
}

}
}

I really hope some one can answer me. thanks

Profile
 
 
Posted: 25 March 2012 02:25 PM   [ Ignore ]   [ # 1 ]
Rank
Joined  2011-01-10
Total Posts:  21
New Member
marieyi - 08 February 2011 10:34 PM

public class GestureTouch extends BasicView

OpenExhibits and GestureWorks need extends class Application (for OE&GW2) or GestureWorks(for GW3)

 Signature 

I’m sorry for my f*cking english.
From Russia with Love. =]

Profile