How to stop the water flow?

Hello

I need to make the water from the shower, when you click on shower.

And the water should stop after 5 seconds.

The code is below.

Water flows well. But I fail to stop it.

I added a timer that starts when the shower is clicked. And must stop the flow of water after 5 seconds have elapsed.

With the lines

If (stop = true)

{

break;

trace ("Break");

}

It looks like the for loop breaks right from the start, from the first second. But not completely, somehow 1 or 2 drops are fluid.

Without these lines, nothing happens when the time is up (5 seconds click on the shower). The water just flows.

Can anyone help? How to stop water flowing after 5 seconds and cleaning of the table and stage of water drops?

Thanks in advance!

import flash.display.MovieClip;

import flash.events.Event;

import flash.utils.Timer;

import flash.events.TimerEvent;

var WatertropArray: Array = new Array();

var WaterArea01: MovieClip = new WaterArea();

var WaterBorder01: MovieClip = new WaterBorder();

var timer: Timer = new Timer (1, 5000);

var stop: Boolean;

var i: uint;

Shower.addEventListener (MouseEvent.CLICK, waterFlowStart);

function waterFlowStart(event: MouseEvent): void

{

addChild (WaterArea01);

WaterArea01.x = WaterArea00.x;

WaterArea01.y = WaterArea00.y;

WaterArea01.alpha = 0;

addChild (WaterBorder01);

WaterBorder01.x = WaterBorder00.x;

WaterBorder01.y = WaterBorder00.y;

WaterBorder01.alpha = 0;

Stop = false;

timer.addEventListener (TimerEvent.TIMER, waterFlowEnd);

Timer.Start ();

addWaterdrops();

Shower.removeEventListener (MouseEvent.CLICK, waterFlowStart);

}

function addWaterdrops(): void

{

for (var i: uint = 0; i < 100; i ++)

{

waterDrop var: MovieClip = new Waterdrop();

addChild (waterDrop);

waterDrop.x = Math.round (Math.random () * stage.stageWidth / 1.5);

waterDrop.y = Math.round (Math.random () * stage.stageHeight / 3);

waterDrop.alpha = 0;

waterDrop.rotation = - 12;

WatertropArray.push (waterDrop);

trace ("drops of water added");

moveWaterdrops();

}

}

function moveWaterdrops(): void

{

waterDrop00.addEventListener (Event.ENTER_FRAME, water flow);

}

function waterFlow(event: Event): void

{

for (var i: uint = 0; i < WatertropArray.length; i ++)

{

WatertropArray [i] there = 8;

WatertropArray [i] .x += 5;

trace (i);

If (WatertropArray [i] .hitTestObject (WaterArea01))

{

WatertropArray [i] .alpha = Math.Random ();

WatertropArray [i] .scaleX = Math.Random ();

WatertropArray [i] .scaleY = .scaleX [i] WatertropArray;

}

If (WatertropArray [i] .hitTestObject (WaterBorder01) |) WatertropArray [i] .x > stage.stageWidth | WatertropArray [i] there > stage.stageHeight / 2).

{

WatertropArray [i] .x = Math.round (Math.random () * stage.stageWidth / 1.5);

WatertropArray [i] there = Math.round (Math.random () * stage.stageHeight / 3);

. Alpha WatertropArray [i] = 0;

}

If (stop = true)

{

break;

trace ("Break");

}

}

}

function waterFlowEnd(event: TimerEvent): void

{

trace ("TIME OVER");

Stop = true;

stoppTrue();

}

function stoppTrue(): void

{

for (var i: uint = WatertropArray.length; i > WatertropArray.length; i-)

{

Remove (i);

}

}

function remove(idx: int)

{

removeChild (WatertropArray [idx]);

WatertropArray.splice (idx, 1);

trace ("removed");

removeChild (waterDrop00);

trace (i);

}

I should be an int, not a uint.

Tags: Adobe Animate

Similar Questions

  • How to stop the remote control to the setting

    How to stop the remote control to the setting

    Disable the settings > general > accessibility > voiceover.

  • How to stop the music in the iOS download

    How to stop the music in the iOS download songs? I accidentally clicked (stupidly) songs to download all the purchased. It will take some time and fill out my iPhone with music. I tried restarting and that did not help. It is also a priority on updating apps from the App store. I use the latest version 9.3.2 iOS iPhone 6.

    Thank you

    I will try to put the device in Airplane Mode, then signature of the iTunes and the App Store. Then try to disable airplane Mode. While you are not connected to the iTunes Store, you should not try to download on the phone once you turn it off airplane mode.

  • HOW TO STOP THE NEW ADS ON FACEBOOK... THEY ARE FRIGGIN BORING AND REEK HAVOC WHEN YOU PLAY... PLEASE ME TELL HOW TO BLOCK THEM!

    How to stop the new ads on Facebook

    I get very annoyed by ads to where they are on the web so I use an add-on called 'Adblock Plus' which uses its database to block known ads and you can even block yourself!

    With 'Adblock Plus Adblock Plus ' installed, you can block all advertising photo:

    1. right click on the announcement of photo that you want to get rid

    2. in the menu, click the option that says: ' Adblock Plus: block image... "(it is usually at the bottom of the menu)

    3. when the pop up box appears, simply click 'Add filter' and advertising will disappear before your eyes!

    If this was the answer you are looking for, please click 'Resolved' - thank you.

  • How to stop the shortcut ctrl-alt-s

    How to stop the shortcut ctrl-alt-s bringing HP info? I use this shortcut elsewhere.

    Here it is:

    http://support.HP.com/us-en/document/c00761879

  • How to stop the Animations of Chrome

    How to stop the animations in Chrome? We're wasting resources and slow down the user interface, especially when the user interface is already slow due to the nature of Firefox non-multitraitement. It is like throwing cement on a turtle.

    The animation of the tab bar has a pref browser.tabs.animate related to this and can be set to false.

  • How to stop the Firefox update page to load whenever I run the FF 3.6.16 application

    How to stop the Firefox update page to load whenever I run the application FF 3.6.16. I use it on an iMac G5 ALS.

    See the following for a few suggestions:

  • How to stop the dashboard at the bottom of the screen in endangered?

    How to stop the dashboard to disappear the bottom of Safari.  It did not happen, but I installed iCapitan.

    Dashboard or the Dock? If you mean that the docking menu Apple > System Preferences > Dock > automatically hide / show Dock.

    OS X El Capitan: use the docking station

  • How to stop the VI and a Sub VI together

    Hi, in my application, I have a vi with a state machine with a loop of event handler. One of the events in my loop of event handler is out who runs the State of the output of my state machine. I also have an under vi outside my statemachine.

    The problem:

    1. at the exit of pressing my Vi does not stop.

    Reason: my sub vi is still running.

    Need solution : How tp stop the two loops together using the exit button.

    StateMachine P.S:1.My is inside a while loop and while loop runs inside my sub vi also.

    2. both the loops are parallel, since I'm on queues in it.

    2. both the loops are parallel, since I'm on queues in it.

    There are many ways, depending on your architecture.

    Can pass you a message from out of your event loop to your another loop on the queue?

    Another way is to use a global Boolean variable 'Stop' and use it in your second loop exit condition. Set it in the event loop when you want to stop the program.

    The producer consumer example stops the second loop by closing the queue during the first loop stops and then to capture the error when the second loop trying to read the queue.

  • How to stop the log in page and continue straight on the desktop at boot?

    Original title: desktop

    How to stop the newspaper in stright page and go to the desktop page when starting

    Hi Ms.HarleyChic,

    Windows operating system you are using?

    If you use Windows 7, try the steps in the following article and check if this can help:

    Enable or disable a secure connection (CTRL + ALT + DELETE)

  • How to stop the red symbols to appear when I use the question mark, the apostrophe and slash keys. This only happens in my e-mail program.

    How to stop the red symbol to appear when I use the key question mark in my e-mail program.

    HI Julie Delany.

    1. for how long are you facing this problem?

    2. is there any changes made prior to this issue?

    3. may I know what mail client do you use?

    Disable the function key (lock) and then check

  • How to stop the "Microsoft" folder opens at startup

    Whenever I start my computer, "C:\Program Files\Microsoft" opens. I went through each item, start nothing leading to this path. (msconfig, registry, and "Startup" in "Programs" folder.) Anyone know how to stop the start to the top of the file?

    You are really the way strong, but as long you are looking at the registry "Run" keys, make sure that the names of path for various startup items are surrounded by double quotes.

    I can find no documentation final for this - and there is certainly some entries in my key Run that have spaces in them, but are not surrounded by double quotes - but in general, Windows behaves better if you either do not use characters such as spaces or surround the path with quotation marks name.

    For example:

    "C:\Program Files\Fichiers Files\Adobe\ARM\1.0\AdobeARM.exe"

    Because registry Analyzer seems to know the space in Program Files, and given your statement that the problem started when you installed Office, I suggest looking for an entry that starts C:\Program Files\Microsoft Office\Office14\

    If you find such an entry without quotes, modify to add and see if the problem goes away.

    In the future, Autoruns is an easier way to find the startup entries... and it shows many places more than just two Run keys you watched.

  • NOTEBOOK: HOW TO STOP THE EMBEDDED "UNTITLED" WORD ON PAGE I USE

    HOW TO REMOVE THE EMBEDDED "UNTITLED" WORD OF THE PAGE WHICH SHOULD BE PRINTED...                                                                                                                                                                                      Remember - this is a public forum so never post private information such as numbers of mail or telephone!

    Ideas:

    • You have problems with programs
    • Error messages
    • Recent changes to your computer
    • What you have already tried to solve the problem

    HOW TO STOP THE EMBEDDED "UNTITLED" WORD ON PAGE I USE

    Go to file, Page Setup and remove header and footer text.

    "jimmcanany" wrote in the new message: * e-mail address is removed from the privacy... *

    HOW TO REMOVE THE EMBEDDED "UNTITLED" WORD OF THE PAGE WHICH SHOULD BE PRINTED... Remember - this is a public forum so never post private information such as numbers of mail or telephone!

    Ideas:

    * You have problems with programs
    * Error messages
    * These recent changes made to your computer
    * What you have already tried to solve the problem, HOW can I STOP THE WORD EMBEDDED 'UNTITLED' of BEING PRINTED on the PAGE that I USE

  • How to stop the zoom to change?

    How to stop the zoom of the evolution to more or less at will.  I don't have a mouse

    Hi shellywilson,

    ·         Are you referring to the Web page zoom feature?

    ·         Did you do changes on the computer before the show?

    Follow the steps in the article.

    Get the best display on your monitor

    For reference: Zoom in on a Web page

  • How to stop the McAfee anti-spam folder appear in Windows Mail?

    I know I've done this before, but I just had to reinstall the operating system and forget how to stop the McAfee anti-spam folder to appear in my Windows Mail Inbox.

    Help!
    Thank you!!
    It should not appear in the Inbox WinMail, but rather a clean folder. The best way to stop it from appearing anywhere descend McAfee of your machine.
     
    Norton and McAfee are the two least friendly Windows security and swine resource to start programs. My ISP offers the McAfee security suite for free and I refuse to use it.
     
    I used to use Avast in conjunction with Windows Defender, (still a decent option), but since MSE became of age, I have used which. MSE is an anti-virus, Anti-Spyware and Anti-Malware program all in one. IMO, it is a program MS got it wrong. And all of these options are freeware.
     
    If you choose to give it a try, download and save the MSE. Remove McAfee and install MSE.
     
     
    Correction of tool McAfee Consumer Product Removal triple
    http://service.McAfee.com/FAQDocument.aspx?LC=1033&ID=TS100507  

Maybe you are looking for

  • Satellite C855 - white screen after BIOS update

    Hello I am a beginner user,I have Satellite C855Yesterday, I downloaded a 'update BIOS"that was sent to my computer.Since that my screen is blank, there is a hum in the background. I have a recovery back up on my external hard drive, but of course, t

  • Satellite L500 - BSOD when you press FN key

    Upgrade to Windows 7, installed the last value Add Package and Flash memory card Support. Also made BIOS update. PVAT installs well, Flash card Support installs but causes the blue screen when the Fn key. Can someone please put a little clear on this

  • How to display continually similar to how serial communication works HyperTherminal?

    I need help on this I'm trying to read serial data and display the data I receive all the time. Right now, I can receive all the data, but I only get one line at a time and does not save previous data for the latest information disappears Essentially

  • Cannot access the downloaded song

    Help! I bought seal boarding school hits and in the process of downloading my computer returns to zune marketplace. I tried to get back what I was doing but not able to find it.  Help, please.

  • Need to retrieve the string after the 2nd comma.

    The input string: "CN = Beard\, of Tracy, OU = operations, OR = HPUsers, DC = HealthPartners, DC = org"Output string: OU = operations, OR = HPUsers, DC = HealthPartners, DC = orgSelect substr ("CN = Beard\, of Tracy, OU = operations, OR = HPUsers, DC