hitTest on an object array - use removeEvent and now the code does not work

I used hitTest to see what sunny (mc) would hit one of five objects in a table.

BUT I had to use removeEventListener otherwise she'd keep ancestral. But now I can't "beat" the next object. Why the addeventListener method does not work yet?

stage.addEventListener (MouseEvent.CLICK, myClickReaction);
speeds the LONG NYPOTENUSE
var v: Number = 5;
var varObject:String;
var i: Number;
var arrayObjects:Array;

complete table and initialize the variables i and varObject
arrayObjects is ['chocolate', 'ice', 'pizza', 'Burger', 'sandwich', 'egg'];.
i = 1;
varObject = arrayObjects [i-1];
trace (varObject);


mouse click point
var clickPoint:Point = new focus();
function myClickReaction(e:MouseEvent):void {}
clickPoint.x = mouseX;
clickPoint.y = mouseY;
addEventListener (Event.ENTER_FRAME, onEnterFrame);
}
function onEnterFrame(event:Event):void {}
var xDistance:Number = clickPoint.x - sunny.x;
var yDistance:Number = clickPoint.y - sunny.y;
var angle: Number = Math.atan2 (yDistance, xDistance);
Sunny.x += v * Math.cos (angle);
Sunny.y += v * Math.sin (angle);
If (clickPoint.x > = sunny.x) {}
sunny.gotoAndPlay ("walk straight");
trace (Math.ABS (xDistance));
}
If (sunny.x > = clickPoint.x) {}
sunny.gotoAndPlay ("left foot").
trace (Math.ABS (xDistance));
}
If (Math.abs (xDistance) < = 10) {}
trace ("Works");
sunny.gotoAndPlay ("static");
removeEventListener (Event.ENTER_FRAME, onEnterFrame);
}
}
addEventListener (Event.ENTER_FRAME, enterFrameHandler);
function enterFrameHandler(e:Event):void {}
If (sunny.hitTestObject (hotspot_pizza)) {}
If (sunny.hitTestObject (varObject)) {}
If (sunny.hitTestObject (this [varObject])) {}
i = i + 1; / / ie: he comes to the table object and NOT the string.
trace (varObject);
removeEventListener (Event.ENTER_FRAME, enterFrameHandler);
}
}

because you stop your loop when the first object has a positive hittest.

What do you do?

Tags: Adobe Animate

Similar Questions

  • I dropped my iPhone 4S and now the touchscreen does not work. Is there a way I can fix it without having to buy another or should I buy another?

    I dropped my iPhone 4S and now the touchscreen does not work. Is there a way I can fix it without having to buy another or should I buy another? (my screen is cracked)

    From what I see, Apple does not screen repair for any older than the iPhone iPhone 5. I don't see off-warranty, replacement cost for 4 on their page of repair, but I'm figuring you would spend at least $200 to get a new.

    Would be better to see if your cell phone operator has the options of upgrade for you.

    ~ Lyssa

  • My sound on my computer worked but lately it seems to stop working unless I beat type of speaker and now the sound does not work and I don't know how to fix it.

    When I plug in head phones work. and when he came out I had just hit my speakers really hard until she is back now he used no matter what I do.

    Hello Christina,

    Well tell what is obvious, you may well have damaged your material in a certain way - probably 'hit' a wide wire that has already been lost. It's a hardware problem; This site deals with software, for example, windows.

    The kind of help that I could give would be if you have problems with your audio drivers, or if it is a virus or malware that was the cause. But shots on your speakers 'really hard' it makes it seem as if its associated hardware.

    Assistance with the material, I suggest you two sites: Tom Hardware (http://www.tomshardware.com/); and Computing.Net (http://www.computing.net/).

    Best I can do, sorry. Let me know how you fare.

    Kind regards

    BearPup

  • Zoom in PS, and now the 'Z' does not work after update.

    Hello, after the last update, I have a problem with zoom. I prefer to zoom with the 'z' key and dragging my pen tool. This function is now completely gone. Corrections to know or settings I messed up? Thank you

    Please install the plugin for this problem. Let me know if it works for you.

    Photoshop and El Capitan | Mac OS 10.11

  • my epson dx4050 will not work or open I use wind 7 now, but it does not work pls help

    my epson dx4050 will not work or open I use wind 7 now, but it does not work pls help

    Because your message was clearly not your comments on the web site of MIcrosft responses, I have he left the comment forum in the forum 'Hardware and drivers' Windows 7.

    When you say it "will not open', do you mean physically or you want to tell the printer object in the printers and devices folder does not open when you double-click it?

    Have you tried to delete the printer and add it again?

    He has already worked?  If so, have you changed between yesterday and today?  The device is supposed to be compatible with Windows 7 and should not need a separate driver, but if you have Windows 7 32 - bit, you can try using the driver on the Epson website.
    http://eSupport.Epson-Europe.com/FileDetails.aspx?LNG=en-GB&data=lkuCfcvA9cw77whFcRdwis4JOQH9mtNd&ID=324678

    How do you connect to the Stylus DX4050?  It is USB, wired network or wireless network?  The documentation says it is USB, but I connected USB printers to the network, then maybe you have as well.

    The more details you provide on your printer and your system, the better people can help you.

  • Downloaded Firefox 38.0.1 and now edit/search does not work.

    The Question above about nearly everything.

    I downloaded Firefox 38.0.1 (I'll never learn) and now edit/search does not work. The search at the bottom of my screen bar disappeared and clicking on EDIT and SEARCH does nothing. Also, Ctl - F does nothing.

    FYI, using Windows 8.1.

    Someone actually check the compatibility with desktop computers and laptops on the news, or is it more important to be compatible with smart phones?

    Start Firefox in Safe Mode to check if one of the extensions (Firefox/tools > Modules > Extensions) or if hardware acceleration is the cause of the problem.

    • Put yourself in the DEFAULT theme: Firefox/tools > Modules > appearance
    • Do NOT click on the reset button on the startup window Mode safe

    Try to rename (or delete) the file xulstore.json in the Firefox profile folder.

    You can use this button to go to the Firefox profile folder currently in use:

  • I have re-installed Windows Vista on my laptop (Dell Inspiron 1525) and now my wireless does not work.

    Hi, I have re-installed Windows Vista on my laptop (dell insparon) 1525 and now my wireless does not work. ive tried re installing driver, but it says operating system not supported. I used the disc that came with the computer of the re install and I even tried to install service pack 1. .

    original title: Wireless problems after install.

    I just tried both, the dell is one that says OS not supported"and the intel, it went very well, but my 'network controller' still have a yellow top thing in Device Manager. and I always wireless. any other ideas? Thank you for the help

    Question...  You have whatever it is listed in the "Network adapters" section of "Device Manager" now?

    While ensuring that the exclamation point is not for your wired network device (plausible) or bluetooth (plausible) and you just need to configure your wireless network to connect to * your * wireless network now.

    You may have to contact Dell to see why none of their drivers receive your wireless device works on the original operating system, what they included.  This could be a hardware problem PURE.

  • Microsoft Fix Center 0 X 80092003 error message when you try to fix the hardware and drivers, the program does not work

    Microsoft Fix Center 0 X 80092003 error message when you try to fix the hardware and drivers, the program does not work. I use Windows Vista Home top.  Please provide me with a fix for this problem. Thank you

    Hello

    What type of material is actually causing the problem? Is there more information the Fix It center offers you?
    I would have a look at the article I have below the link and go ahead and run a update of Windows on the PC.
    I hope this helps.
  • Reinstalled vista now the modem does not work, says the modem is already in use. Modem does not appear in the material...

    Vista Basic with dial-up. I reinstalled vista and now the modem will not work with any of the numbers given by my provider. He throws error numbers (Sorry didn't write them) and said that the modem is already current usage or other computer is busy. The modem does not appear in the lists of material and reinstallation does not work. The computer does not recognize when a new modem is installed either. I use the same drivers provided with the computer when I got it.

    Hello

    I suggest to refer to this link and follow the instructions in the link below and check, if this can help:

    http://Windows.Microsoft.com/en-us/Windows-Vista/troubleshoot-modem-problems

    It will be useful.

  • Installed at El Capitan and now HP printer does not work via the network

    Installed at El Capitan and now HP printer does not work via wireless network

    Open system preferences > printers and Scanners and select the print tab.

    Then the right or control click on the HP printer on the left then click: reset the printing system

  • Satellite L300D - installed XP and now my wifi does not work

    I spent from Vista to XP and now my wifi does not work. I was told that I don't have the drivers.
    Can someone help me? I have a Satellite L300D-01N. Please help me, I don't know much about this kind of stuff.

    Thank you

    You can download drivers Toshiba from here: http://eu.computers.toshiba-europe.com/cgi-bin/ToshibaCSG/download_drivers_bios.jsp

    There is however no driver XP for the L300D. But I found a LAN driver for XP wireless that would work.

    Select:
    Laptop
    Satellite Pro
    Satellite Pro L series
    Satellite Pro L300

    Download and install
    -Wireless Lan Driver Realtek Semiconductor Corporation Windows XP 6.1116.1226.2007

    If this does not work, you can have an Atheros Wireless LAN card. If this is the case, look at the other models for an Atheros Wireless LAN Driver XP.

  • I upgraded Qualcom Ateros and now my wifi does not work.

    Original title;

    I upgraded Qualcom Ateros and now my wifi does not work. How is it?

    I've just updated and now my wifi does not work. I trust Microsoft updates... But this time I shouldn't trust...

    Hello

    1. what operating system is installed on the computer?

    2. How is that you have updated drivers for QUALCOMM Ateros?

    3. what exactly happens when the problem occurs? You receive an error message?

    If you are having problems with your computer or device after upgrading sound driver, you can restore to an earlier device driver. Check out the following link.

    Restore a driver with its previous version

    http://Windows.Microsoft.com/en-us/Windows7/restore-a-driver-to-its-previous-version

    Also check out the following link:

    Windows wireless and wired network connection problems

    http://Windows.Microsoft.com/en-us/Windows/help/wired-and-wireless-network-connection-problems-in-Windows

    Let us know if it helps!

  • I had to replace my hard drive and now my key does not work

    I had to replace my hard drive and now my key does not work, it keeps giving the error 0xC004E003

    Have you tried to restart by phone?

    How to activate Windows 7 manually (activate by phone)
     
    1) click Start and in the search for box type: slui.exe 4
     
    (2) press the ENTER"" key.
     
    (3) select your "country" in the list.
     
    (4) choose the option "activate phone".
     
    (5) stay on the phone (do not select/press all options) and wait for a person to help you with the activation.
     
    (6) explain your problem clearly to the support person.
     
    http://support.Microsoft.com/kb/950929/en-us

    Activation error: 0XC004E003 http://support.microsoft.com/kb/938450

    Please run the Microsoft Genuine Diagnostics Tool then copy and paste the results into an answer here for further analysis:
    http://go.Microsoft.com/fwlink/?LinkId=52012

  • I got a notification of update for adobe CC but it does not work and now the Office does not

    I got a notification of update for adobe CC but it does not work and now the Office does not

    I actually just finished with support on a cat and it was corrected. Thank you.

  • I need help. I updated Adobe cc and now my photoshop does not work. Here is the error message:

    ' I need help. I updated Adobe cc and now my photoshop does not work. Here is the error message:


    Problem event name: APPCRASH

    Application name: Photoshop.exe

    Application version: 16.0.0.88

    Application timestamp: 55681d 39

    The default module name: StackHash_76b2

    The default module version: 0.0.0.0

    The default module timestamp: 00000000

    Exception code: c0000005

    Exception offset: 0000000000000006

    The system version: 6.1.7601.2.1.0.768.3

    Locale identifier: 3084

    Information extra No. 1: 76 b 2

    Information extra No. 2: 76b2e5a7b24373bbe6f47563f13e47b1

    Information extra No. 3: 51ff

    Information extra No. 4: 51ff68a42cf4d2164e10e22e1f794f34


    Hi Oscar,.

    Please see the thread below:

    Photoshop CC 2015 crashing?

    You can also check: 2015 release of Photoshop CC: FAQ

    Kind regards

    Sheena

Maybe you are looking for

  • NEW Macbook Pro, get really hot

    Hello I got my Macbook pro 15 "with 512 GB SSD and GPU AMD end of 2015 in about 3 weeks. When I watch Netflix with almost no other apps open, I can feel the upper keyboard keeps while it almost burns the hand. Is this normal?

  • I continually get HP connection error.

    Recently, when you try to access the websites of my emails, I continually get 'Connection HP error' screen 'Google Chrome cannot display the webpage ".  Chrome is my default browser.  Outlook is my default Email.  When I try another browser, I can ac

  • When you try to view a video on youtube, its saying to download flashplayer.

    Original title: help with player flashmedia I'm watching a video on youtube and its tells me to download flasplayer but I already more I tried to download it but its does not work I need help?

  • USB 2.0 and other drivers not found for W520

    Hey guys,. -Fine, brand-new W520 (428224U), fresh install of Windows 7 64-bit. Downloaded and installed all the drivers lenovo (including chipset) and still cannot use my USB 2.0 2 side ports. When I look in Device Manager, I see the following with s

  • My Defragmenter widows stoped working how to fix it

    My defrag doesn't work any more the screan happens but it does not start