AS3 video start and stop the question.

Hello

I am new to AS3 and I'm trying to figure out how to stop a clip to play on mouse click. For now, I created a movieclip that plays when the user clicks on it, but now I want to be able to stop the movieclip if clicked again.
At the moment, I have the following code:

Stop();
bigTree_mc.addEventListener (MouseEvent.CLICK, onClickplayAnimation);

function onClickplayAnimation(event:MouseEvent):void
{
bigTree_mc.play ();
}

The tree animation plays very well, but I want to be able to stop it if the user click on it again.

Any help would be appreciated!

Thank you!

Try...

Stop();

var isPlaying:Boolean = false;

bigTree_mc.addEventListener (MouseEvent.CLICK, onClickplayAnimation);

function onClickplayAnimation(event:MouseEvent):void
{
{if (isPlaying)}

bigTree_mc.stop ();

} else {}

bigTree_mc.play ();
}

isPlaying =! isPlaying;

}

Tags: Adobe Animate

Similar Questions

  • Satellite A30 554: start and stop the question automatically

    After about a year of use my computer laptop (Satellite A30 554) started having problems with the starter. Quite often when I turn it on cooler starts working and the LEDs are showing that the computer is on, but the screen remains black. Sometimes, I need to turn off the PC and on a couple of times so that he can start to begin. What is the reason for this and can it be resolved?

    Once I had a problem with this computer off by itself while working, which was not caused by a virus. Some people advised me to vacuum clean :) under cooler. I did and it helped.

    The problem was supposed to be linked to the dust on the heatsink, which does not allow that it works correctly. The current problem also connectable to the cooler, or is - it a motherboard problem?

    Hello

    Generally speaking, if it starts and does even not initializing the monitor, or starts and turns off immediately, it could be the motherboard. It helps to remove each device at a time and try to start the computer. Sometimes when the parts become defective they still affect the ability to start. If, after removing all devices, that the problem persists, then your motherboard is faulty and must be replaced. Hope that fix you the problem.

  • I want cRIO to start and stop the acquisition by push physical button on the cRIO, is this possible?

    When you use my cRIO 9024 on the ground, I prefer to be able to start and stop the acquisition with pressing a physical button on cRIO.

    I want to say I don't want it to be "as a start-up," I don't want cRIO to start the acquisition as soon as the power supply is ensured.

    Is this possible?

    Hi Cashany,

    you will surely find this switch status. But there are easier ways (but more expensive) for a button. Fiddling with a pen or a small screwdriver to switch USER1 is not what I call "user friendly"...

    -You have at least 2 voltage inputs on your module available. Use a switch voltage on the power inputs. Use a 'real' button!

    -You have an available serial port. You can set some pins on GND or voltage and check their status inside the cRIO/RT target...

  • Can you start and stop the glassfish server in JDeveloper 12 c and how?

    Mr President.

    Can you start and stop the glassfish server in JDeveloper 12 c and how?

    Concerning

    have you looked at

    http://www.Java-n-me.com/2014/02/GlassFish-extension-for-JDeveloper-12C-go-live.html

  • Is it possible to start and stop the servers without using nodemanager?

    Is it possible to start and stop the servers without using nodemanager? If so, how?

    Hello

    Please follow the link below, it will be useful

    http://docs.Oracle.com/CD/E1322201/wls/docs81/ConsoleHelp/startstop.html#1243161_

    Concerning
    Fabian

  • iOS 10 times to start and stop the music messed up

    I'm running a SE 64 GB iPhone with iOS 10. Many songs from my iTunes library has some moments of power, but after update, they are all mixed. Songs don't start or stop when they're supposed to, or they're going to start and stop at a random time, which is annoying. The same problem was in the beta, causing me to backup on iOS 9. I assumed that this bug would be fixed in the final version. All the solutions in addition to remove and re - download my library?

    Hello Carnage1215,

    Thank you for reaching out to the Community Support from Apple. I understand your music has had some problems and I want to help him. By the sounds of things that your songs start may be delayed or in the middle of the piece, is that correct?

    Before you make too much trouble shooting, it's a good idea to make a backup of your iPhone If you don't have it already. If you do not know how to save your phone from this article will guide you in the process: the backup of your iPhone, iPad and iPod touch

    Once you have made a backup, I would recommend to reset all the settings on your iPhone. This will ensure that all old data of a version of iOS parameter are removed and reset default. This removes all data and applications, photos or contacts, but it removes all of your preferences for the Wi - Fi, Bluetooth, do not disturb, Notifications, general, sounds, contact ID, brightness & paper painted and privacy, then you may need to define these things upwards after this reset.

    Do this please go to settings > general > reset > reset all settings.

    If you always use the same behavior after you restart your phone, please inform the community. We are all here to help.
    Best regards.

  • How to create services start and stop the script of automation for different servers

    Hi all

    I want to create a file bat for automation object, start and stop services
    I have some services in 1 server and a server in 2nd and some servers in 3rd.
    has you all know that I have to follow the sequence to start and stop services can all help me in creating .bat combining 3 servers fo start and collapses of the services.

    Thanks in advance

    Concerning
    SM

    the location of your batch file should not matter

  • How to start and stop the video capture in a state machine

    Hello

    I am a student of neuroscience and this is what I try to do: 1) trigger a camera to GigE (200 FPS), 2) start the video capture, 3) triggers a light that stays on for x milliseconds, 4) trigger a valve that will blow an air puff, 5) stop the tone and the valve at the same time and 5) stop the video capture 1 second after 4). For this, my VI is a state machine, with a State for each trigger (ex, 1 State for trigger camera 1 State of light of trigger, ect) and a statement to "stop" and a "time-out State." Everything worked except the video acquisition - the program could trigger the camera but only acquire a frame, because it was not running in a while loop and this is my first question: for an acquisition video is it always necessary to have a while loop?
    I guess the answer is Yes, so I built a loop of 'consumer' for the camera. A queue of the pre-trial 'trigger camera' in the loop of producer, I was then able to start the video capture, but now the problem is to stop it at the right time. I have an another queue in the State of 'stop' in the loop of the producer, but is not able to start the State 'stop' in the loop of consumer, I think that maybe it's because the loop of consumer gets "stuck" in the whole loop.

    I hope you can help me, the VI is attached. Thank you!

    Hello

    First of all, in your loop producer: STATE 'Stop', you use the flushing line, then there is no need to use 'item queue at the opposite end. You can use the enqueue function.

    Secondly, you said "I moved the command stop inside the while loop as you said, but it did not work. But if you look closely, you moved "Enqueue function" inside the while loop. Instead you should use Dequeue function. Please, look at the picture I posted an orderly manner.

    And remove the circled (i.e. function. Enqueue function loop of consumption, where I wrote 'Why stop here').

    Try now.

  • Start and stop the ASM in a standalone environment

    Hello

    I installed just 11 GR 2 grid Infrastructure and ASM you have running.

    Q1. How I closed ASM correctly? So far I have

    stop the + ASM instance

    stop the listener

    However I always seem to have a number of processes that are running

    Grid1 6184 1 0 10:53?        19:00:00 /home/app/oracle/product/11.2.0/grid/bin/ohasd.bin restart

    Grid1 6338 1 0 10:54?        00:00:31 /home/app/oracle/product/11.2.0/grid/bin/oraagent.bin

    Grid1 6351 1 0 10:54?        00:00:00 /home/app/oracle/product/11.2.0/grid/bin/evmd.bin

    Grid1 6387 6351 0 10:54?        00:00:00 /home/app/oracle/product/11.2.0/grid/bin/evmlogger.bin o /home/app/oracle/product/11.2.0/grid/evm/log/evmlogger.info-l /home/app/oracle/product/11.2.0/grid/evm/log/evmlogger.log

    Grid1 6883 1 0 10:57?        00:00:05 /home/app/oracle/product/11.2.0/grid/bin/cssdagent

    Grid1 6897 1 0 10:57?        00:00:01 /home/app/oracle/product/11.2.0/grid/bin/ocssd.bin

    When I do = >

    Grid1 [+ ASM] > ASM srvctl status

    ASM is not running.

    Q2. What are the processes above, and how to close properly?

    Q3. What is the procedure for starting a ASM?

    any help appreciated,

    Jim


    Look for the command

    crsctl stop

  • How to start and stop the APEX?

    Hi all! I am new to this forum and APEX too...

    We are runing (Version: Application Express 4.1.1.00.23)

    I need to reboot the server.

    How can I stop APEX graciously and start back after? Thank you!

    Kind regards

    Ghyslain salvation,

    to reinforce what Mike says. Apex is a database and, with the exception of the HTTP server application, runs entirely on the database. (Note with EPG, its all in the database) It contained in the users/schemas database and built items of data such as tables and PL/SQL packages. If the server that is running the Oracle database in which the Apex is installed needs to be restarted, the database must be stopped, which stops indeed Apex. If the HTTP server is also running on this server (ESS or earpiece of the Apex) then this should be stop as well.

    Of course, if your desire is not to stop the database, but to deny the user access to the Apex, perhaps for purposes of maintenance of database, then this can be done by stopping the HTTP server or by stopping the EPG.

    I hope it is clear now.

    André

  • Starting and stopping the process GG

    GG admin guide I understand we can start/stop the GG (excerpt, pump, Replicat) procedures through shell scripts, and it is mentioned that it can be invoked from a script to start/stop/go. Are there restrictions on these operations?

    We intend to implement the process of stop/start GG in our application scenario where you need to update the source DB (and thus the target DB also) through a batch process at regular intervals (once a week, can also be less frequent). The plan is the first above mentioned stop GG process, update source DB with the latest data, transfer data to target the DB using exp/imp, restart GG treats using the SNA option after. All these steps are automated.

    From the tests above of initial works but don't know if GG power operation is strong enough to manage the scenarios on a regular basis and will work. Are there known issues with these operations such as disorders while implementation power which makes it unfit for use through scripts like the one mentioned above.

    Enjoy all the entries in the present.

    Thank you

    The process can be run from the command line and are just as reliable as any other executable UNIX regarding commissioning correctly if all the prerequisites are met.

    To launch the Manager from the command line
    To run the management of the control of the operating system interface, use the following syntax.
    Bishop paramfile [ reportfile]

    On the source and target systems, publishes one of the following sets of commands
    in the process, you are a beginner. Run the Oracle programs
    Directory of GoldenGate.
    extract paramfile .prm reportfile .rpt [Pei ]
    or...
    replicat paramfile .prm reportfile .rpt

    You can automate the monitoring, and it's an exercise as any monitoring process (for example, the tail of the alerts log and grep for errors ORA, logs of web server of grep, etc..). You can see extract and replicat upstairs / ongoing run, so you can also use Director (Management Pack).

  • How to start and stop the timer by using the keyboard.

    Hello, I would really like to help please, I have

    here to launch a program whereby I press a key

    which starts the timer and press another button to stop the timer, the

    delay is displayed and used to move an object on the phase on the delay dependant.

    Thank you

    Attach a listener of events on the stage of your film.

    stage... addEventListener (KeyboardEvent.KEY_DOWN, keyDownHandler);

    According to the http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/events/KeyboardEvent.html# KEY_DOWN

    1 if you want any key, so you don't need a key code.

    var myKeyBoolean = false;

    function keyDownHandler(event:KeyboardEvent) {}

    if(myKeyBoolean == false) {}

    start my Countdown

    } else {}

    Cancel and reset my timer

    }

    }

    2. If you want the same key to both use a Boolean value like this:

    var myKeyBoolean = false;

    function keyDownHandler(event:KeyboardEvent) {}

    if(Event.keycode == MyKey) {}

    if(myKeyBoolean == false) {}

    start my Countdown

    } else {}

    Cancel and reset my timer

    }

    }

    }

    3. If you want two different keys

    function keyDownHandler(event:KeyboardEvent) {}

    if(Event.keycode == myStartKey) {}

    start my Countdown

    } Else if (event.keyCode == myStopKey) {}

    Cancel and reset my timer

    }

    }

    }

  • Start and stop the survey

    Hey, I tried to stop a poll by setting the interval-1. But it will not stop! What could be the reason?
    I'll call you poll.setInterval(-1) of the method that is called when the survey event takes place...
    any suggestions on this?
    thanx

    try to call poll.setRendered (false) to stop the election and poll.setRendered (true) do it again

    Kind regards

    Branislav

  • Re: Start and stop the scene/video button

    I need help to fix my departure and switch to stop.  It will start the video scene, but it will not stop if I click on the Start button. Please correct my code.  Thank you.

    Process.Visible = false;

    Cycles.Visible = false;

    Stop();

    function playMovie(event:MouseEvent):void

    {

    Play();

    }

    startButton.addEventListener (MouseEvent.CLICK, playMovie);

    var paused: Boolean = false;

    function myPauseFunction (): void {}

    {if (Paused)}

    Play();

    paused = false;

    }

    else {}

    Stop();

    paused = true;

    }

    change:

    function pauseMovie (): void {}

    {if (Paused)}

    Play();

    }

    else {}

    Stop();

    }

    pause =! suspended;

    }

    TO:

    function pauseMovie (e:MouseEvent): void {}

    {if (Paused)}

    Play();

    }

    else {}

    Stop();

    }

    pause =! suspended;

    }

  • Start and stop the movie with the key

    Can someone tell me please how to do this?

    I am very new to Flash.

    Thank you

    Place this code in the script you are trying to control - pressing a key will be play/stop depending on what mode it is in.

    Stop();

    var isPlaying:Boolean = false;

    stage.addEventListener (KeyboardEvent.KEY_UP, keyUsed);

    function keyUsed(event:KeyboardEvent)
    {
    If (isPlaying) {}
    Stop();
    } else {}
    Play();
    }
     
    isPlaying =! isPlaying;
    }

    If you have any other questions, try to anticipate what you might be asked and include details.

Maybe you are looking for