Copy link to clipboard
Copied
Good day for everyone;)
I have game wheel and I want that flash shows number in dynamic text field then the vheel stops.
This is my wheel script for rotation:
var speed: Number = 0;
var minSpeed: Number = 0;
var maxSpeed: Number = 4;
var increaseNum: Number = 0.03;
var decreaseNum: Number = 0.01;
var clicked: Boolean = false;
var myMusic: Sound = new tiktak();
var Channel: SoundChannel;
var clickarea: Sprite = new Sprite();
clickarea.graphics.beginFill(0x000000, 0);
clickarea.graphics.drawRect(-500, 0, stage.stageWidth, stage.stageHeight);
clickarea.graphics.endFill();
clickarea.buttonMode = true;
clickarea.addEventListener(MouseEvent.MOUSE_DOWN, downHandler);
clickarea.addEventListener(MouseEvent.MOUSE_UP, upHandler);
addChild(clickarea);
function downHandler(e: MouseEvent): void {
clicked = true;
stage.addEventListener(Event.ENTER_FRAME, enterHandler);
playSound();
}
function upHandler(e: MouseEvent): void {
clicked = false;
}
function enterHandler(e: Event): void {
ratas.rotation += speed;
if (clicked) {
increaseSpeed();
} else {
decreaseSpeed();
}
}
function increaseSpeed(): void {
speed = speed + increaseNum;
if (speed > maxSpeed) speed = maxSpeed;
}
function decreaseSpeed(): void {
speed = speed - decreaseNum;
if (speed < minSpeed) speed = minSpeed;
if (Channel && speed == minSpeed) {
Channel.stop();
stage.removeEventListener(Event.ENTER_FRAME, enterHandler);
var myMusicC: Sound = new taskai();
SoundMixer.stopAll();
myMusicC.play(0, 1);
}
}
function playSound(): void {
Channel = myMusic.play();
}
This is my wheel:
Copy link to clipboard
Copied
you need something (like an associative array) that relates ratas.rotation to the number on ratas.
Copy link to clipboard
Copied
I have no idea how to do that
Copy link to clipboard
Copied
rotate ratas in the ide and note the number to be displayed
Copy link to clipboard
Copied
Oh ok. Sorry for my questions. I dont understand how to do it. It will be fine as it is. Thanks
Copy link to clipboard
Copied
you're welcome.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now