How can I check if a function is or is not called from the event listener? in Flash CS4 (AS3)

Hi,
I came across a little problem.
I put an event listener inside a for loop and the for loop inside a function.
I want the for loop to end as soon as the event listener inside the for loop calls its function.
Here is the general code for a better picture.
Code:
this.addEventListener(Event.ENTER_FRAME, function#1);
function function#1(event:Event):void{
          if(something is true){
                    for(var i = 0; i < numOfmy_mcs; i++){
                              this["my_mc_"+String(i)].addEventListener(MouseEvent.CLICK, function#2);
function function#2(e:Event):void{
//do something cool here
Thank you for any help!

kglad wrote:
that for-loop (if it executes), defines listeners for interactive objects.  that will complete long before any object is clicked.
Well yes but it does it again and again (frames per second times seconds = number of times it goes through the code if i'm not mistaken), because it is inside a function, and through testing i found out that it works like this:
Example:
there are 5 my_mc's in my project: (my_mc_0, my_mc_1, my_mc_2, my_mc_3, my_mc_4)
if i click my_mc_0 function#2 is called and executed. BUT only after the loop finishes (i know this from tons of testing)...which is unnecessary since you cannot click two places at once. This might not be a problem in this example because i am only using 5 my_mc's buy if i use 500000000 my_mc's it would make a lot of difference.
is there a way to stop the loop if the function is called?
...maybe there is a better way to write it, the only alternative i know that works is if i manually write every single listener and this also is logical in this example but as i said next to impossible if the numbers get bigger.
-Note
I didn't specify this earlier but function#2 makes the if statement false so it wont jump back into it.
Thank you for the help I really appreciate it!
3rd edit...don't know what's wrong with me

Similar Messages

  • How can I check that second hand macbook air is not stolen?

    How can I check that second hand macbook air is not stolen?

    Ask for the original purchase receipts.
    Take it to the Apple store  and make sure that the computer is not stolen
    provided they have any such information.
    Best.

  • How can I check what version of Java Web Start is installed on the client ?

    hi,
    Can anyone tell me how can I check what version of java web start is installed on the client and display a message if the client has not the good version ?
    I mean:
    I'd like all people running my application use java 5 and if someone using java 1.4 try to run the application get a nice screen telling him to download the latest version of Java Web Start.
    Is this possible ?
    Thanks in advance.

    Of course, I put this on my jnlp file,
    <resources>
        <j2se version="1.5+"/>
        <jar href="..... "/>
    </resources> But even with that, it doesn't display a nice message but a kind of exception instead.
    Thanks in advance.

  • How can we check whether a ResultSet is EMPTY or NOT ?

    i'm getting some data inside ResulSet (using JDBC inside Servlet).
    now i want to redirect response according to ResultSet...., if ResultSet is EMPTY then on diff page, else on different page...
    how can i check whether a ResultSet is empty or not...
    i've used next() , wasNull() methods ,,, but not solving the purpose...
    thanx in advance...

    What you could do is to ask the database fora
    record count and check that for zero.
    How?????You just do an SQL statement but instead of the list of fields after SELECT you put
    SELECT count(*) FROM ...... WHERE .....
    That returns a single integer value into the resultset giving the number of matching records currently in the database.
    The trouble is you can't be certain that when you subsequently access the records the number won't have changed, because databases are generally accessible to more than one process at a time and some other process might add or delete a record between counting and retrieving or, for that matter, during the process of retrieval.
    Also the count is likely to take more time than just doing rs.next() and seeing if you get a record.
    Since you seem to be in a servlet environment you should consider doing the database query and the first rs.next() at the top of the servlet/JSP that presents the results and, if there are no records, using getServletContext.getRequestDispatcher(...).forward(request, response) to swich to your error page if it returns false.
    So the stucture looks like:
    rs = stmt.executeQuery(......);
    if(!rs.next())
          getServletContext().getRequestDispatcher("/noresultspage.jsp").forward(request, response);
    else {
         do   {
             .... display result data
          } while(rs.next());
        }

  • HOW can i check my iphone4s is factory unlock  or not ?

    HOW can i check my iphone4s is factory unlock  or not  i wants to update my software version at present its version is 6.0.1(10A523) can any one tell me?

    Do you have iTunes 11.0.1 on computer?
    iOS: Device not recognized in iTunes for Windows
    iPhone not appearing in iTunes

  • How can i restore my new macbook pro. Lion is installed from the beginning, but I have no cd. What am I suposed to do?

    How can i restore my new macbook pro. Lion is installed from the beginning, but I have no cd. What am I suposed to do?

    Boot your computer while pressing Command-R. You can reinstall Lion from here. Covered here:
    http://support.apple.com/kb/HT4718

  • HT201401 i have a birthday showing in my calendar listed as an all day event and it is incorrect how can I delete it. When clicked on does not bring up the edit feature. The vodaphone shop thinks it has synced with my facebook app.

    i have a birthday showing in my calendar listed as an all day event and it is incorrect how can I delete it. When clicked on does not bring up the edit feature. The vodaphone shop thinks it has synced with my facebook app.

    hello, the addons manager is exactly the right place to look for it. please try disabling the addons that are listed there one-by-one (a restart of the browser might be necessary after each step). maybe one of them is bundling this kind of adware.
    [[Disable or remove Add-ons]]

  • HT204409 how can i locate my mini ipad even when its not connected to the internet

    how can i locate my mini ipad even when its not connected to the internet

    Is it lost or stolen?
    Apple (and no one else) can not assist (with serial number or iCloud) in finding a lost or stolen iPad.
    Report to police along with serial number. Change all your passwords.
    These links may be helpful.
    How to Track and Report Stolen iPad
    http://www.ipadastic.com/tutorials/how-to-track-and-report-stolen-ipad
    Reporting a lost or stolen Apple product
    http://support.apple.com/kb/ht2526
    What to do if your iOS device is lost or stolen
    http://support.apple.com/kb/HT5668
    iCloud: Locate your device on a map
    http://support.apple.com/kb/PH2698
    iCloud: Lost Mode - Lock and Trace
    http://support.apple.com/kb/PH2700
    iCloud: Remotely Erase your device
    http://support.apple.com/kb/PH2701
    Report Stolen iPad Tips and iPad Theft Prevention
    http://www.stolen-property.com/report-stolen-ipad.php
    How to recover a lost or stolen iPad
    http://ipadhelp.com/ipad-help/how-to-recover-a-lost-or-stolen-ipad/
    How to Find a Stolen iPad
    http://www.ehow.com/how_7586429_stolen-ipad.html
    What NOT to do if your iPhone or iPad is lost or stolen
    http://www.tomahaiku.com/what-not-to-do-if-your-iphone-or-ipad-lost-or-stolen/
    Apple Product Lost or Stolen
    http://sites.google.com/site/appleclubfhs/support/advice-and-articles/lost-or-st olen
    Oops! iForgot My New iPad On the Plane; Now What?
    http://online.wsj.com/article/SB10001424052702303459004577362194012634000.html
    If you don't know your lost/stolen iPad's serial number, use the instructions below. The S/N is also on the iPad's box.
    How to Find Your iPad Serial Number
    http://www.ipadastic.com/tutorials/how-to-find-your-ipad-serial-number
    iOS: How to find the serial number, IMEI, MEID, CDN, and ICCID number
    http://support.apple.com/kb/HT4061
     Cheers, Tom

  • How can I take a video snap shot during skype video call from my MacBook Pro?

    How can I take a video snap shot during skype video call from my MacBook Pro?

    OS X Lion: Shortcuts for taking pictures of the screen

  • How can i view a list of previous purchases i have made from the appstore on my iphone that i have now deleted?

    how can i view a list of previous purchases i have made from the appstore on my iphone that i have now deleted?

    Launch iTunes on your computer. Select iTunes Store in the source list on the left then click Sign In right side of the iTunes window just above QUICK LINKS.
    In the Account Information window click See All to the right of Purchase History.

  • Recently Iam purchased a Iphone from U.S, but iam residing in India, so can any body tell me in india how can i get support as my phone charger is not working from where in india i can replace i

    Recently Iam purchased a Iphone from U.S, but iam residing in India, so can any body tell me in india how can i get support as my phone charger is not working from where in india i can replace it

    gosharma wrote:
    What if we have Applecare? Applecare is worldwide. Isnt it?
    Not on an iPhone.

  • How can i check whether my phone is unlocked or not

    How can i check whether my phone is unlocked or not

    rozhan.m wrote:
    Im in srilanka, my sister brought me this phone from UK. i dont kwon how to call apple from here. pls help me
    Nothing we can do to help you.  If it was bought in the UK from an Apple store as unlocked, it is unlocked.  If it was bought anywhere else, it will be locked, and only the carrier it is locked to will be able to unlock it.
    If you've tried a local SIM and it has not worked, then you have your answer, it is locked.

  • How can an artist show as a search result yet not exist in the artist list?

    I'm trying to import music from the My Music folder on my computer. I followed the steps outlined in the iTunes tutorial. When I search for the song, the artist and album show as search results, but the song does not. When I follow the link from the search to the artist, iTunes goes to the artist list, and the one I am looking for is not in that list- where does the song go when I upload it into iTunes? And how can the artist show up in a search result as existing in Music, but not actually be in the artist list?

    Hi IWolbers,
    >>I have a recurring problem where all of a sudden I can no longer see the values of my variables when I debug my unit tests. I cannot find a pattern as to when this happens but I experience this across one of every 20 tests that I write. Occasionally
    this has also happened during normal debbuging of running code on my machine.
    So you mean that it worked well before, am I right? 
    If you debug the same app in other VS machine, does it work well? So we could make sure that whether it is related to the VS IDE.
    Please disable all add-ins in your VS IDE, and then reset your VS settings, debug it again.
    https://msdn.microsoft.com/en-us/library/ms247075(v=vs.100).aspx
    Or you could run your VS in safe mode, debug it again, at least, we could know that whether it is the add-in's issue.
    https://msdn.microsoft.com/en-us/library/ms241278.aspx
    To make sure that it is not the project files' issue, create a new blank solution, copy the project files to the new solution, clean and rebuild the solution, check the result.
    >>Once I step over this to the next line (screen shot 2) I get the error message 'The name '[variable name]' does not exist in the current context'
    How about debugging it with "Step Into" instead of "Step Over"? Or you could add breakpoints between 234 line to 241 line, after the breakpoint is hit, check the watch window again. How about the result?
    In addition, do you check other debugger window like local or others?
    Best Regards,
    Jack
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How can we get a url for a "Meet Now" conference call from within the Windows Store App?

    Hi,
    Is it possible to get the url for the current meeting / new "Meet Now" call from within the Windows Store app?
    You have the option of inviting your current Lync contacts, but I don't see a way of giving a URL to clients that would launch Lync on their device, or take them to the web app.
    I can see how to get the link using the Outlook plugin, for pre-scheduled meetings. Is this link always the same and the one that should be used for an impromptu "Meet Now" meeting? It would still be good to know how to get this URL from within
    the store app so I can tell clients where to get it.
    Some people may be on Windows RT devices and not have access to the plugin in Outlook, and want to start a meeting at short notice and then invite others via email or pasting a link to them elsewhere.
    Any help appreciated.
    If I have answered your question, please mark it as the correct answer. If I have provided helpful information, please mark it as so.

    Hi,
    Agree with Holger, I check on my Lync Windows Store app and can't find the meeting URL as well.
    Best Regards,
    Eason Huang
    Eason Huang
    TechNet Community Support

  • How can I test my thunderbolt port? It's not working after the update to 10.10.1

    I have been using my computer with the Thunderbolt Port for a while and after updating to 10.10.1 and after I while of using my computer I tried to use the thunderbolt port with my external monitor.. and it doesn't work at all.. video doesn't come out.. I tried a different screen with the mini adapter from thunderbolt to HDMI and another with thunderbolt to VGA and in both adapters I don't get video from my mac.
    Any idea how can I test my Thunder bolt port?
    This is what I have done:
    1 cable adapter thunder bolt to mini HDMI to an LCD screen with HDMI : No video, but my computer detects that there is something connected
    2 cable adapter thunder bolt to VGA to an LCD screen with VGA : No video, but my computer detects that there is something connected
    3 cable adapter thunder bolt to mini HDMI to an 40' TV with HDMI : No video, but my computer detects that there is something connected
    All the test pass from the Hardware test at the startup (press D at boot time).
    Any ideas? my guarantee it's expired and no coverage. Due the nature of where the port it's installed, if this is a hardware problem seems that I will (may be) have to buy the Logic Board.. no good. No bueno!!
    Thanks!!!

    restore iPhone

Maybe you are looking for

  • Can you help me diagnose my macbook crash log and fix the crash?

    Hi  I have been using my macbook for 1 and a half years and only a month ago, it started to crash constantly.  3 days ago, the macbook couldn't restart after a crash, so I format the whole disk and re-installed snowleopard and got updates. But it kep

  • How do i connect my apple  tv to my tv but it doesnt have an hdmi input

    How do i connect my apple tv to my tv if my tv doesnt have an hdmi input ??? i have the apple tv  2 and didnt realize when i bought it so what cord do i need to make it work ???

  • Exchange syncing of contacts weirdly incomplete

    I am an Office 365 exchange user, with an iPhone, a PC with Outlook, an iPad and a couple Mac laptops.  I chalked it up to a problem with the first laptop, but when the second laptop was set up and did the exact same thing, I realized I have a more c

  • Is a BPX a Process Steward?

    My colleague Aiaz Kazi forwarded this to us: <a href="http://jkobielus.blogspot.com/">James Kobielus' Blog</a> The piece Aiaz highlighted, was a discussion he had with the blogger who calls the BPX a Process Steward.  I've quoted it below as it speak

  • Css struts problem

    Hi there: <link href="<%="theme/layoutdisplay.css"%>" rel="stylesheet" type="text/css"> this is how I define my css. my project is situated in ../webapps/projectname/ <a href="pm_meeting.do?action=edit&id=<%=id%>"><img src="<%="img/edit.gif"%>"></a>