Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - willcrain

Pages: [1]
help / Re: Multitouch problems
« on: Fri, Aug 26, 2011 »
Hey, I was just curious if you found your answer. I have been trying to figure out the same thing. Thanks in advance.


iOS / Re: flixel + AIR SDK 2.6
« on: Thu, Aug 25, 2011 »

Thanks for the reply.

I am trying to drag a sprite across the screen and still having some issues.

I tried drawing a simple rectangle shape and also played with the idea of relaying the touch coordinates. My issues are that I am not able to an addEventListener to anything within the Flixel world. I have tried adding a listener to the stage, the rectangle that i was trying to track by touch/mouse coordinates and the flxSprite itself. None with any success due to that i cant add event Listeners.

I am playing with templates from the Flixel Power Tools collection as a reference

the following is a mess, i know, but you can get an idea, hopefully of what i am trying. Thanks again for any help you might have to give.
something i have tried:

Code: [Select]
import flash.display.*;
import flash.ui.Multitouch;
import flash.ui.MultitouchInputMode;

private static var tPos:Object;
private static var xPos:Number;
private static var yPos:Number;

public var touchBOOL:Boolean;

Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
/// the following 3 lines don't work because it doesn't know
// what the addEventListener method is
addEventListener( TouchEvent.TOUCH_BEGIN, onTouchBegin );
addEventListener( TouchEvent.TOUCH_MOVE, onTouchMove );
addEventListener( TouchEvent.TOUCH_END, onTouchEnd );

player = new FlxExtendedSprite(64, 64, imagePNG);
player.solid = true;
player.allowCollisions = FlxObject.ANY;
// mouseDrag doesn't work on touch devices, disabled for now?
// player.enableMouseDrag(false, true); 

_rect = new FlxSprite(player.x, player.y);

/// this doesn't work because it doesn't know what the addEventListener method is
// _rect.addEventListener( TouchEvent.TOUCH_MOVE, trackerMove ); 


override public function update():void
// updates the position of _rec to match the mouse/Touch

// _rect.x = FlxG.mouse.x - (_rect.width/2);
// _rect.y = FlxG.mouse.y - (_rect.height/2);

// if (FlxG.collide(player, _rect)) {
// }


public function onTouchBegin(evnt:TouchEvent):void
touchBOOL = true;
private function onTouchMove(evnt:TouchEvent):void
if (touchBOOL) {
xPos = evnt.stageX;
yPos = evnt.stageY;
private function onTouchEnd(evnt:TouchEvent):void
touchBOOL = false;
public function getCoords():Object
tPos.x = xPos;
tPos.y = yPos;
return tPos;

iOS / Re: flixel + AIR SDK 2.6
« on: Wed, Aug 24, 2011 »
Hey knarrenheinz,
Thanks for sharing. I am newer to flixel and trying to explore it with the AIR platform also. I saw that you suggested some TouchMode tutorials. I have been able to use Touch Gestures before, but am not able to get my FlxSprite to listen for them?

for example:
myFlxSprite.addEventListener(TouchEvent.TOUCH_BEGIN, onTouchBegin);

From what i have come to understand all of the flixel objects are blitted onto the page, so how do you addEventListeners to them? or are you overlaying buttons on top of the game layer?

Did you track your 'mouse position' and then adjust actions to that with the overlap method?

For instance, if i wanted to create a custom graphic button to be pressed. --> overlap method?
Or, if i wanted to create a sprite to be dragged across the screen with my finger --> overlap method?

I guess i am just trying to see where you used the TouchEvents in your app.

Sorry if this seems confusing. Any tips would be appreciated.

Pages: [1]