Power button in AS3

Hi all I have a problem. I'm developing an iOS app, a dashboard. I added a start button, a stop button and a reset button, but there is not enough space for buttons. So I decided to create a Start/Stop button.
Practically, the button displays starts, I pass the mouse and start the timer. Then the button Stop, I pass the mouse and stop the timer, then it displays another time start ecc.
How to do this?

import flash.events. *;

var ScoreHome:Number = 0;
HomeScore.text = scoreFormat (ScoreHome);

var ScoreGuest:Number = 0;
GuestScore.text = scoreFormat (ScoreHome);

var timePattern:RegExp = / \d\d\:\d\d(?=\s);
var secondPattern:RegExp = / (? < =-:) \d\d(?=\s);
var time: Date = new Date();

var timer2:Timer = new Timer(1000, 24);
TIMER2.addEventListener (TimerEvent.TIMER, countdownpossesso);
TIMER2. Start();

var: timer = new Timer(1000, 360);
timer.addEventListener (TimerEvent.TIMER, count);
Timer.Start ();

ButtonplusHome.addEventListener (MouseEvent.MOUSE_OVER, fl_MouseOverHandleradd);
ButtonminusHome.addEventListener (MouseEvent.MOUSE_OVER, fl_MouseOverHandlerminus);
StartSecond.addEventListener (MouseEvent.MOUSE_OVER, fl_MouseOverHandlerSS);
StopSecond.addEventListener (MouseEvent.MOUSE_OVER, fl_MouseOverHandlerStS);
ResetSecond.addEventListener (MouseEvent.MOUSE_OVER, fl_MouseOverHandlerRS);
Reset24.addEventListener (MouseEvent.MOUSE_OVER, fl_MouseOverHandler24);
ButtonplusGuest.addEventListener (MouseEvent.MOUSE_OVER, fl_MouseOverHandleraddg);
ButtonminusGuest.addEventListener (MouseEvent.MOUSE_OVER, fl_MouseOverHandlerminusg);

Seconds.Text = "06:00";
Possesso.Text = "24";

function countdown(e:TimerEvent):void
{
= Time.Time (timer.repeatCount - timer.currentCount) * 1000;
Seconds.Text = time.toString () everyone (timePattern) [0];
If (timer.repeatCount == timer.currentCount) {}
playSound (Event);
}
}

function countdownpossesso(e:TimerEvent):void
{
= Time.Time (timer2.repeatCount - timer2.currentCount) * 1000;
Possesso.Text = time.toString () everyone (secondPattern) [0];
If (timer2.repeatCount == timer2.currentCount) {}
playSound (Event);
}
}

function playSound (Event): void {}
mySound.play)
Timer.Stop)
}

function scoreFormat(value:Number):String
{
Returns the string (value < = 9?) ('0' + value: value);
}

function fl_MouseOverHandleradd(e:MouseEvent):void
{
ScoreHome ++;
HomeScore.text = scoreFormat (ScoreHome);
}

function fl_MouseOverHandlerminus(e:MouseEvent):void
{
-ScoreHome;
HomeScore.text = scoreFormat (ScoreHome);
}

function fl_MouseOverHandlerSS(e:MouseEvent):void
{
Timer.Start)
TIMER2. Start();
}

function fl_MouseOverHandlerStS(e:MouseEvent):void
{
Timer.Stop)
TIMER2. Stop();
}

function fl_MouseOverHandlerRS(e:MouseEvent):void
{
Timer.Reset)
TIMER2. Reset()
Timer.Start)
TIMER2. Start()
Timer.Stop)
TIMER2. Stop()
Seconds.Text = "06:00";
Possesso.Text = "24";
}

function fl_MouseOverHandleraddg(e:MouseEvent):void
{
ScoreGuest ++;
GuestScore.text = scoreFormat (ScoreGuest);
}

function fl_MouseOverHandlerminusg(e:MouseEvent):void
{
-ScoreGuest;
GuestScore.text = scoreFormat (ScoreGuest);
}

function fl_MouseOverHandler24(e:MouseEvent):void
{
TIMER2. Reset()
TIMER2. Start()
Possesso.Text = "24";
}
var mySound:Sound = new Buzzer();

use a movieclip button:

import flash.events. *;

var ScoreHome:Number = 0;
HomeScore.text = scoreFormat (ScoreHome);

var ScoreGuest:Number = 0;


GuestScore.text = scoreFormat (ScoreHome);

var timePattern:RegExp = / \d\d\:\d\d(?=\s);
var secondPattern:RegExp = / (?)<=\:)\d\d(?=\s)>
var time: Date = new Date();

var timer2:Timer = new Timer(1000, 24);
TIMER2.addEventListener (TimerEvent.TIMER, countdownpossesso);
TIMER2. Start();

var: timer = new Timer(1000, 360);
timer.addEventListener (TimerEvent.TIMER, count);
Timer.Start ();

startstop.addEventListener (MouseEvent.MOUSE_OVER, stopstartF);

ButtonplusHome.addEventListener (MouseEvent.MOUSE_OVER, fl_MouseOverHandleradd);
ButtonminusHome.addEventListener (MouseEvent.MOUSE_OVER, fl_MouseOverHandlerminus);
StartSecond.addEventListener (MouseEvent.MOUSE_OVER, fl_MouseOverHandlerSS);
StopSecond.addEventListener (MouseEvent.MOUSE_OVER, fl_MouseOverHandlerStS);
ResetSecond.addEventListener (MouseEvent.MOUSE_OVER, fl_MouseOverHandlerRS);
Reset24.addEventListener (MouseEvent.MOUSE_OVER, fl_MouseOverHandler24);
ButtonplusGuest.addEventListener (MouseEvent.MOUSE_OVER, fl_MouseOverHandleraddg);
ButtonminusGuest.addEventListener (MouseEvent.MOUSE_OVER, fl_MouseOverHandlerminusg);

Seconds.Text = "06:00";
Possesso.Text = "24";

function stopstartF(e:MouseEvent):void{if(!e.currentTarget.toggle){     timer.start()     timer2.start();MovieClip(e.currentTarget).gotoAndStop("stop");   // label the stop frame which contains the appropriate display} else {
     timer.stop()     timer2.stop();

MovieClip(e.currentTarget).gotoAndStop(1);  // your play display}e.currentTarget.toggle=!e.currentTarget.toggle;}

function countdown(e:TimerEvent):void
{
= Time.Time (timer.repeatCount - timer.currentCount) * 1000;
Seconds.Text = time.toString () everyone (timePattern) [0];
If (timer.repeatCount == timer.currentCount) {}
playSound (Event);
}
}

function countdownpossesso(e:TimerEvent):void
{
= Time.Time (timer2.repeatCount - timer2.currentCount) * 1000;
Possesso.Text = time.toString () everyone (secondPattern) [0];
If (timer2.repeatCount == timer2.currentCount) {}
playSound (Event);
}
}

function playSound (Event): void {}
mySound.play)
Timer.Stop)
}

function scoreFormat(value:Number):String
{
(The return value string<= 9="" "0"="" +="" value="" :="">
}

function fl_MouseOverHandleradd(e:MouseEvent):void
{
ScoreHome ++;
HomeScore.text = scoreFormat (ScoreHome);
}

function fl_MouseOverHandlerminus(e:MouseEvent):void
{
-ScoreHome;
HomeScore.text = scoreFormat (ScoreHome);
}

function fl_MouseOverHandlerRS(e:MouseEvent):void
{
Timer.Reset)
TIMER2. Reset()
Timer.Start)
TIMER2. Start()
Timer.Stop)
TIMER2. Stop()
Seconds.Text = "06:00";
Possesso.Text = "24";
}

function fl_MouseOverHandleraddg(e:MouseEvent):void
{
ScoreGuest ++;
GuestScore.text = scoreFormat (ScoreGuest);
}

function fl_MouseOverHandlerminusg(e:MouseEvent):void
{
-ScoreGuest;
GuestScore.text = scoreFormat (ScoreGuest);
}

function fl_MouseOverHandler24(e:MouseEvent):void
{
TIMER2. Reset()
TIMER2. Start()
Possesso.Text = "24";
}
var mySound:Sound = new Buzzer();

Tags: Adobe Animate

Similar Questions

  • Pause/Resume buttons in AS3

    I have a film of style simple slideshow I am trying to convert it to AS3 from AS2. I have next, previous, stop and start on the main timeline button. The next and previous buttons work fine, but I'm having trouble getting the power buttons to work.

    In the AS2 version, I got this on the button instance and it worked fine:

    (release) { stopAllClips (_level0); } }

    Here is what I tried the AS3 version, but does not prevent all the clips:

    pauseBut.addEventListener (MouseEvent.MOUSE_DOWN, mouseDownHandler3);

    function mouseDownHandler3(event:MouseEvent):void

    {

    MovieClip (root) .stop ();

    }

    I looked for a solution for two days but have not found anything that works. Any help would be appreciated.

    Thank you

    John

    Child of MoveiClip cast:

    MovieClip (child) .stop ();

  • Started at Mo and not charging with the charger connected. Charger works. Keyboard not workin except power button / stop. Restarted using ex in car without success. SW

    Started MacBook and not charging with the charger connected. Charger works. Keyboard does not not except the power button / stop. Restarted ex drive no available help hoping that it was a matter of SW. SW and the operating system works very well. Read some info online. Tried to reset the SMC. Now, the MacBook does not start. Can U help me please. Thanks in advance.

    MacBook, 2010, Mac OS X 10.6.8

    Hi Veronica Steward,.

    I understand that you have turned into a series of questions about your MacBook and want help getting the computer to turn on. Here is an article that can help you through the steps to fix this problem:

    If your Mac will not turn on - Apple Support

    Let us know how it goes and thanks for coming to Apple Support communities.

    See you soon.

  • macOS Sierra - press and hold the power button to enter the mode 'sleep'

    I recently updated my MacBook Air (13 inch, early 2015) model of El Capitan macOS Sierra 10.12. Before the update, hold down the power button / stop for 2-3 seconds, put the machine in standby mode. It does not properly after the update. Release the power button to switch to sleep mode works only once after each time you start the machine.

    I know he has an option to set the mode of sleep using Ctrl + button / stop and by selecting one of three options to restart, sleep and Shutdown, but who needs 3 more click click and is not fast. Also, independently of any application that is open, pressing the button walk / stop worked fine before the update, but now I need to be on the desktop even do Ctrl + Power button work.

    All patches available for it? Miss me the old way of put my Mac to sleep I do not remember if I did some tweak in my Mac, or was it a default feature...

    Greetings jainam2209,

    Thank you for using communities of Apple Support. It seems you want to put the Mac to sleep, but it does not always work.
    I would recommend read you these articles, the first article explains the ways that macOS Sierra is supposed to go to sleep.
    The second article can help if the computer won't sleep when you're trying to sleep.

    macOS Sierra: put your Mac to sleep

    macOS Sierra: If your Mac won't go or stay asleep

    Take care.

  • The power button will not turn on my computer. Is there a way to solve this problem, or the computer not sleep once I do back on?

    I have a MacBook Pro 2011.

    The power button does not turn the computer on when the computer goes to black screen.

    The battery he is

    iI tried to Community assistance to research and tried to wait. The next morning, I was able to turn it back on. Now, it happened again.

    Please help me. I can afford a new Mac.

    Thank you

    Get it fixed. Make an appointment at the Genius Bar in Apple for the service. If you need a Apple Store - find a store - Apple.

  • Another that holding down the power button, then by restarting, how should I manage my end 2009 27 "iMac when he crashes on the first blank white screen and won't start?

    Another holding down the power button, then by restarting, how should I handle turn on my end 2009 27 "iMac when he crashes on the first blank white screen and won't start?

    Combinations of keys start for Mac - Apple Support

  • Power button on my MacBook Pro is slow.

    The power button on my MacBook Pro seems to be failing.  The last time I got to turn on the machine, that it does not seem to start.  I had to press several times to get any action.  Is it a hardware fault?  Or could there be another reason why the machine is slow to start?  It's a MacBook Pro 15 inch Mid-2009 running on OS X El Capitan, 10.11.3.  2.8 GHz clocked.   Supplied with 8 GB of memory.  Thanks for any help.

    Make an appointment at the Genius Bar in Apple for the service. If you need a Apple Store - find a store - Apple.

  • My Mac Pro 2009 gives me only a power button blinks when I try to turn it on.

    My Mac Pro 2009 gives me only a power button blinks when I try to turn it on. External drives turns on but not the computer or monitor. I tried holding down the power button to restart but I still get only a power button blinking and no departures. It is running IOS 10.8.5 and I use it mainly for recording and mixing of music. I use Digital Performer and, sometimes, ProTools. Nothing new has been installed recently.

    fans on, power button flashing says "not enough RAM that works correctly for starting up".

  • Hi all, I bought apple phone I 5s recently is the power button / stop does not. Bought in the United States, but I was shifted to the India, the works of will to guarantee in India please help

    Hi all, I bought apple phone I 5s recently is the power button / stop does not. Bought in the United States, but I was shifted to the India, the works of will to guarantee in India please help

    Ask an authorized service provider regarding iPhones, a guarantee of a country may or may not be honored in another function where you take the device.

    (143868)

  • Turning on the iPod touch 4G without power button / stop

    My power button doesn't work.  I know how to turn my iPod touch 4G (ios 6.1.6) using the help key, but what I want to know is if I can turn on the iPod while plugging it.  I know when the battery dies him plugging it turns back on, but I have not tried after that I turned it off.   I would just try this, but today, I'm not able to repair or replace.  So I want to make sure that it will work before as I did try.

    (I know that I can turn by resetting the network it works, but then I have to retype my password.)  I hope I can just stop, and then plug it in.  But just want to be sure.)

    Thank you.

    Yes, unless you have other problems, connect the iPod to a charging source turns on the device

  • I can't see Start button and have to turn off my computer using the power button / stop

    When I use Mozilla, I can see no longer the button 'Start' at the bottom left of the computer. The only way that I can disable the computer is holding the "Power" button What I did to cause this.

    Make sure that you run not Firefox mode full screen (press F11 or Fn + F11 to toggle; Mac: Command + SHIFT + F).

    If you are in full screen view then hover over with the mouse to the top of the screen to facilitate the bar appear Navigation and tab bar.
    Click the expand (in the top right Navigation bar) to exit full screen or right-click on a space empty on a toolbar and select "exit full screen" or press the F11 key.

  • IPhone power button loose

    Hello

    My first SE Iphone bought June 4, 2016.  When buying the phone, did not notice that the power button (top right) is loose. Start button / stop is not properly adapted to the device. When I shake it the phone can hear vibrate its power button.

    Thank you

    Fabien

    Make an appointment at the genius bar at apple store retailer.

    Make a Genius Bar reservation (or cancel an existing reservation)

    http://www.Apple.com/retail/Geniusbar/

    Log in using your Apple ID.

    Or contact applecare.

    AppleCare U.S. phone number: 800-694-7466

    https://support.Apple.com/en-us/HT201232

  • My iPad will not extinguish little matter how long I press the power button.

    Why my Ipad2 refuses to turn off no matter how long press me on and press and hold the power button?

    How can I get my rotation of the screen to work again? It has just stopped working even when switching screen lock is not selected in the settings.

    Help, please.

    Try a forced reboot. No data is lost during this procedure. Hold on the sleep and home buttons at the same time for about 10 seconds until the Apple logo appears on the screen. Then, rotate the unit and try to stop.

  • 27 "2013 mac only shut down using the power button / stop, is this a problem or a part of the new system

    After my upgrade that Mac is not closed by using the drop-down menu option, it also seems to crash the finder.  Finder raises with force quit.  I can only shut it down using the power button.  Is this a bug/problem of a part of the El Capitan?

    Wacom tablet software is known to cause this problem. Options:

    Uninstalling the Wacom software

    Completely and remove items from connection

    The Wacom driver update

  • Firefox v15 and up to cause my computer (MAC OSX 10.8.2) to freeze for about 30 seconds every 15 to 30 seconds and I have to turn it off with the power button

    Firefox v15 and up to cause my computer (MAC OSX 10.8.2) to freeze for about 30 seconds every 15 to 30 seconds and I have to turn it off with the power button. It this causes only after I opened Firefox, my computer works well before the opening of Firefox. I h

    It looks a little like yo maybe has a hardware problem on your computer. have you tried to repair permissions on your hard drive? create a new Firefox profile? Use the Profile Manager to create and delete profiles Firefox

Maybe you are looking for