• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

program a spinning wheel in Animate CC

New Here ,
Mar 04, 2017 Mar 04, 2017

Copy link to clipboard

Copied

Hi. I'm using Animate CC and AS3 and I want to program a spinning wheel for a desktop game like Wheel of Fortune. I want it to rotate and I'm trying to create a meter to determine the strength of the spinning. The wheel is attached to this post.twisters_wheel.jpg

TOPICS
ActionScript

Views

3.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 04, 2017 Mar 04, 2017

Copy link to clipboard

Copied

I'm not really sure that you asked a question yet.

With a spinning wheel you may well use an enterframe function to update things. When you start spinning the wheel you would change the rotation by a lot, and over time you would rotate by less. The code might look like this (I did test it):

addEventListener(Event.ENTER_FRAME, onenterframe);

var spinamount: Number = 30;

function onenterframe(e: Event) {

  spinner.rotation += spinamount;

  spinamount -= .1;

  if (spinamount < .1) stopspinner();

}

function stopspinner() {

  removeEventListener(Event.ENTER_FRAME, onenterframe);

}

The spinner movieclip will spin quickly, and slow down over time. You could change the spinamount -= .1 part, or the var spinamount: Number = 30;; part to change the range o start speed.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 05, 2017 Mar 05, 2017

Copy link to clipboard

Copied

if a user is dragging and dropping the wheel and that's what determines the strength of spin, you can use something like the following to as a spinamount to be used in colin's code:

var prevT:int

var prevY:int;

spinner.addEventListener(MouseEvent.MOUSE_DOWN,downF);

function downF(e:MouseEvent):void{

startF();

stage.addEventListener(MouseEvent.MOUSE_UP,upF);

}

function upF(e:MouseEvent):void{

stopF();

stage.removeEventListener(MouseEvent.MOUSE_UP,upF);

}

function startF():void{

this.addEventListener(Event.ENTER_FRAME,loopF);

}

function loopF(e:Event):void{

prevT=getTimer();

prevY=mouseY;

}

function stopF():void{

this.removeEventListener(Event.ENTER_FRAME,loopF);

spinamount = (mouseY-prevY)/(getTimer()-prevT);  // you'll probably need some function of this parameter to get it right

addEventListener(Event.ENTER_FRAME, onenterframe);  // then colin's code

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 21, 2021 Aug 21, 2021

Copy link to clipboard

Copied

LATEST

I want to do some mobile app. Do you know how to control the wheel manually?

 

When we click the wheel n move it manually follow our hand/mouse movement?

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 05, 2017 Mar 05, 2017

Copy link to clipboard

Copied

Have you ever played Wheel of Fortune on the Nintendo Entertainment System (NES)? I've attached the "Spin strength" meter to show you what I'm talking about. I want the meter to go in and out automatically so when the user presses "enter" to stop the meter, it determines the strength of the spinning of the wheelspin_strength_meter.jpg

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 05, 2017 Mar 05, 2017

Copy link to clipboard

Copied

then use the timer on mousedown to start a loop that increments spin strength.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines