event.localX of a MovieClip regardless of any other DisplayObject over/under/inside

Here is an example:

var table:Table = new Table();
stage.addChild(table);
//table covers the whole stage
for (var i:int = 0; i<= 10; i++){
  var book:Book = new Book();
  book.x = Math.random() * stage.stageWidth;
  book.y = Math.random() * stage.stageHeight;
  if (Math.random() < .5){
    stage.addChild(book)
  }
  else {
    table.addChild(book)
  }

stage.addEventListener(MouseEvent.CLICK, clicked); //notice that the eventListener is added to the stage

function clicked(event:MouseEvent){
trace(event.localX, event.localY);
}


what I need here, it's the localX or locally TO THE TABLE, not another thing.

so the general question is "how to return event.localX of a certain MovieClip regardless of any other DisplayObject over/under/to inside it, without defining the mouseChildren to false (which I need to be enabled).

This question is another discussion I had on actionscript 3 - event.localX of a MovieClip regardless of any other DisplayObject over/under/inside - Stack Overflow

function clicked (event: MouseEvent) {}

var globalPt:Point = new Point (event.stageX, event.stageY);

var tablePt:Point = table.globalToLocal (globalPt);

trace (tablePt.x, tablePt.y);

}

SOLVED

Tags: Adobe Animate

Similar Questions

  • MovieClip not getting any custom event

    I have a problem of understanding of events and event management.

    I have a movieClipA that contains several other movieClips (a1, A2, A3, etc...)

    MovieClipA is the parent of movieClips (a1, A2, A3, etc...)

    MovieClipA I use the following code:

    ...

    addEventListener ("Pieter", pieterFnP);

    dispatchEvent (new Event ("Pieter"));

    ...

    private void pieterFnP (e: Event) {}
    trace ("PIETER - Parent');

    } / / Is triggered when event is received

    In movieClips (a1, A2, A3, etc...) I use the code

    addEventListener ("Pieter", pieterFnC);

    ...

    private void pieterFnC (e: Event) {}
    trace ("PIETER - Child");

    } / / Is NOT triggered?

    ...

    When I run the application, the 'pieterFnP' function is triggered, but 'pieterFnC' is NOT.


    Thank you.

    Pieter

    events propagate upwards, not downwards.  children won't detect a parent event. the parent could detect an event of the child.

  • interrupt an event of any other event handler

    Is it possible to have an event that interrupts another handful rutin event? I mean, I have an event handle the structure with several events (case). One of this event takes place, and the structure begins to run in rutin. Meanwhile, rutin is running, another event takes place. Is it possible to stop rutin from first event to run the other?

    Thank you!

    No. not really.

    Structures of the event has no any code embedded in them that can take a long time to run and block the other events.  If you do not have one such routine, you must move to the other while loop using an architecture of producer/consumer with queues.  The structure of the event would just load a command into a queue that the other dequeue while loop and start working on.  The structure of the event loop will become quickly available to treat other events.

    If the second event is one that is designed to interrupt the first routine, then you just need to have the right communication architecture to send to the other loop.  This could be another queue order, perhaps a declarant or accident.  A local variable or functional global variable.

    Remember that you can not stop any structure in the middle of its processes.   A time of loop can be stopped, but all the code in the while loop should run before this iteration of the loop stops.

  • USB key used in iMac unrecognized by any other device

    Hi all, I recently encountered a problem using USB keys with my iMac 2010 10.11.3 running OSx.

    My iMac will recognize UBS sticks and allow me to save documents and files for them, but when I insert into any other device (e.g. a few friend PC and Macs, professional printers to Officeworks etc.) the USB stick is not recognized and does not see the same on their system.   Then when I insert the USB in my iMac, it is recognized immediately as well as its content.

    Before that, I was able to share files and documents with family, friends and clients on USB with no problems at all.

    I tried a variety of different USB keys (old and new) and what is happening to all of them, whatever the brand, age, size, etc.   Is produced only for a few months and at first I was in denial and thought that it was my friend PC, but now I see that it is certainly a problem with my iMac.  He may have started happening around the same time that when I upgraded to IE Captain earlier this year.

    Any ideas please?

    Thank you.

    eccydee

    The fact that this happens with different computers suggests that the problem could be the configuration.

    Go to Applications/Utilities/Disk utility. Insert your flash key and look at the settings. It may look like this:

    Everything on this list must be verified. While you're there, see if your USB is correctly configured:

    http://www.PCAdvisor.co.UK/how-to/storage/how-format-USB-stick-on-Mac-3434423/

  • Repetition of Thunderbird download and download any other

    Win 7 Home
    TBird 31.2.0

    Thunderbird remains only download an email several times. It appears a legitimate e-mail with no attachments. Thunderbird shows "download 1 of 988... then stops)...

    What I did:
    Cleared email server
    Removed popstate.dat (removal of this triggers redownload for a thousand of emails, but same problem occurs)
    Inbox.MSF deleted
    create new account in thunderbird and pointed on the same server, with the same result.

    Any ideas?

    Thank you
    L

    You are looking in the wrong program. Disable e-mail scanning in your anti virus. Restart your computer and try again. You can turn it back on it after downloads mail because it is a simple mail on this is barfing.
    Alternatively you could delete the e-mail following in Quebec using webmail. But this mail may be in your spam mail web folder or any other folder.

  • VZW iPhone is unlocked? Means it can be used with a SIM card, anywhere in the world with any other SIM card from another provider, including the United States

    VZW iPhone is unlocked?

    Means it can be used anywhere in the world with any other SIM card from another provider, including in the USA?

    Yes, only bought it for full price directly from Apple.

    Buy from anywhere else or under contract with Verizon means that he will probably be locked.

  • I have a Macbook Pro (13 - inch, Mid 2012), processor 2.5 GHz Intel Core i5, memory 4 GB 1600 MHz DDR3 and the serial number C1MK12K6DTY3. On the Pages, Numbers and Keynote, y at - it any other way to get them for free?

    I have a Macbook Pro (13 - inch, Mid 2012), processor 2.5 GHz Intel Core i5, memory 4 GB 1600 MHz DDR3 and the serial number C1 * TY3. On the Pages, Numbers and Keynote, y at - it any other way to get them for free?

    < personal information under the direction of the host >

    Only when you buy a new Mac. Since the end of 2013 the app came with the purchase of a Mac.

  • Hi, I just upgraded my 4s to 9.3.2 and now it is completely dead and will not start. Had no problem with any other previous updates.

    Hi, I just upgraded my 4s to 9.3.2 and now it is completely dead and will not start. Had no problem with any other previous updates.

    Sorted now

  • My old iphone 6s is completely broken, it does not or registry that it is connected when plugged into a computer. I'm able to recover photos from the SIM card with an adapter USB SIM card or through any other way?

    My old iphone 6s is completely broken, it does not or registry that it is connected when plugged into a computer. I'm able to recover photos from the SIM card with an adapter USB SIM card or through any other way? I also do not save anything with AllAccess, icloud, or through my computer as you would with a digital camera.

    The photos are not stored on the sims, sorry.

    You can always try the Recovery Mode, little to lose at this point. If it doesn't, I suggest taking it to an Apple Store for testing.

    Recovery mode:

    Turn off your iOS device.

    Plug charge cable to the computer only (not to the device yet).

    Open iTunes on your computer.

    Hold the button to power on your device and do not let go.

    Plug the cable into the device while keeping the power button.

    Wait for the computer to detect the device and wait that he eat.

    Restore as New first, then restore sauvegardΘ if you wish.

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

  • How to change the Google search engine to any other?

    Without a doubt the Firefox browser is much better then MS IE9 which I used to use, but the problem is in Firefox, I don't want to use Google search.

    Question is how I could change any other friendly search engine Google search?

    Please someone respond and oblige.

    Hello

    Thank you for the support.

    It seems in yahoo.com home page is rather easier and safer to play with technical terms. I changed the homepage of Yahoo.

    I appreciate the cooperation offered by you and others.

  • When I scroll in Firefox, a line of distortion appears horizontally across the page. It is in any other application.

    When I scroll in Firefox, a feint but remarkable line of distortion (directly in line with where my cursor is grabbing and dragging the scroll bar) appears horizontally across the page in multiple windows of Firefox. It is in any other application. Mac OS X 10.7, Lion on a Mac Mini Server, 2011. Suggestions or files I have to remove to do that, go away?

    You are welcome

  • For many of the latest versions of Firefox, I was able to get Firefox to save the preferences, passwords or any other information, except the navigation history.

    I checked the different settings in the submenu options under tools and similar controls in CCleaner, with no luck. All ideas, with specific instructions on how I could make some underlying changes to fix this (for example, to be able to save these settings and passwords)?
    My Bank will not recognize my computer in Firefox, but in IE 9.
    The same is true for other sites such as UPS, USPS, clips and any other place cookie preferences, passwords are stored (invited to remember); e-mail, passwords and other account identifiers remembers when typed directly into a portal of connection, such as hotmail.

    Websites to remember you and automatically log you on are stored in a cookie.

    • Create a cookie exception allow (Tools > Options > privacy > Cookies: Exceptions) to keep such cookies, especially for sites Web secure and if the cookies expire when Firefox is closed.

    Make sure that you run not Firefox in private browsing mode.

    Do not use clear recent history to erase "Cookies" and "Site preferences".

    Compensation of the "Site Preferences" clears all exceptions for cookies, images, windows pop up, installation of software and passwords.

  • Download Manager, any other programms?

    I have an unstable connection... when downloading and driveway connection makes downloading and I have to start from the beginning... is there any other Download Manager works with firefox who already watch downloaded bits and bytes?

    You can try downthemall add-on

  • I use iWeb to update a Web site and the objects appear in Safari unless you have a hyperlink when they download.  Is it because iWeb can only support a limited number of links, hypertext, or any other reason?

    I use iWeb to update a Web site and the objects appear in Safari unless you have a hyperlink when they download.  Is it because iWeb can only support a limited number of links, hypertext, or any other reason?

    It has been much discussed.

    See my solution in this post:

    Re: Re: iWeb Publishing Solution in El Capitan

  • The address toolbar is missing. I followed the guides online to resolve this issue, do not work. Any other ideas?

    The address toolbar is missing. I followed the guides online for this problem, including disabling macros complementary and extensions. The problem does not occur in safe mode. But occurs even when accelerating, all extensions & add-ins and themes are disabled. I also reloaded firefox 4. Any other ideas?

    Follow these steps:

    1. Click help | Restart with disabled modules.
    2. In the next menu that appears, select: "reset the bars of tools and controls.
    3. Finally, click on the button called "make changes and restart".

Maybe you are looking for