Skip to main content
rjoshicool
Inspiring
February 10, 2012
Question

Spin a wheel in AIR mobile application

  • February 10, 2012
  • 5 replies
  • 1194 views

I am having a circular wheel which I need to spin when the user swipes over it. I also need to make the speed of the spinnig wheel dependent on the amount of swipe and speed with which it was done, just like we have it for the regular list component. How can I do this? Is there any similar component or tutorial available?

This topic has been closed for replies.

5 replies

Participating Frequently
January 22, 2013

Depending on the exact effect(s) you're looking for, here's a simple example that maybe you can build upon.

var mouseDownX:Number, mouseUpX:Number;

var mouseDownTime:Date, mouseUpTime:Date;

var velocity:Number;

stage.addEventListener(MouseEvent.MOUSE_DOWN, myMouseDown);

stage.addEventListener(MouseEvent.MOUSE_UP, myMouseUp);

function myMouseDown(e:MouseEvent):void{

     mouseDownX = mouseX;

     mouseDownTime = new Date();

}

function myMouseUp(e:MouseEvent):void{

     mouseUpX = mouseY;

     mouseUpTime = new Date();

     velocity = (mouseUpX - mouseDownX) / (mouseUpTime.getTime() - mouseDownTime.getTime());

}

It's just a draft, so I don't guarantee it'll compile. I'm sure there are better solutions than mine too. Hope it helps

January 22, 2013

Thank you very much.

It works for me now.

I use the code that Eddy.Li, said and I've changed this:

velocity = (mouseUpX - mouseDownX) / (mouseUpTime.time - mouseDownTime.time);

Inspiring
February 10, 2012

you have to listen to touch move and touch end and touch begin and set a timer. I do this things in my app" free fortune cake" ( apple store)

t

3 things

the weel must follow the finger == touch move

lisent for the direction to change == change in the X

lisent for velociti == timer beetween last direction change and touch end

January 21, 2013

Hi,

I'ver tried to do something similar to this, with events, timer... but it doesn't work.

I have a HGroup which width is bigger than device width and I want to recreate the swipe functionality of the ios platform, where user can swipe with variable speed.

I'm very new at flash builder, could you please give me some examples about how you do it?

Thanks in advance

Participant
January 22, 2013

Hello Alidena

thanksmister-touchlist is good that helped me about this. But I see developer site is not working now.

But here is link to sample archive source file, hope you will find it useful.

http://rapidshare.com/files/3191378190/touchlist.rar

Good luck.