Find the child's location in the coordinate space of the parent

I created a map of the counties of Montana.  Each county is an MC inside separate the largest parent movie clip (allcnt_mc).

When the user clicks on a County, I would like to focus this country on the scene and the zoom to its measurement.

The hard part has said the parent (allcnt_mc) where the tween to.  Given that each individual County is a child of the parent, they have their own coordinate space with reference to the parent.

Is there a way I can query the location (x, y) of a child in the coordinate space of the parent?  With this issue, I could calculate the distanct between the point of current regulation of the parent and the child, indicating the distance that the parent will have to move to focus on the scene.  I tried to use localToGlobal but could not understand how to use it.

//calculate the stage's center
var stagecentx:Number=stage.width/2
var stagecenty:Number=stage.height/2

function tweento(e:MouseEvent):void{
     // the first two variables are referncing the county that was most recently clicked on
     var calledx:Number=allcnt_mc[xmlData.row.NAME[e.currentTarget.ivar]].x;
     var calledy:Number=allcnt_mc[xmlData.row.NAME[e.currentTarget.ivar]].y;
     // these variables represent the current location of the stage
     var allcntx:Number=allcnt_mc.x;
     var allcnty:Number=allcnt_mc.y;
     //  I'd like to then tween the allcnt_mc to the location of (calledx,calledy)
     //  but in the coordinate space of allcnt_mc



var pt:Point = new Point (parent.child.x, parent.child.y);

PT = parent.localToGlobal (PT);

PT now has the parent.child coordinates in space of the parent coord.

Tags: Adobe Animate

Similar Questions

  • How to find the parent of the element

    Gurus,

    Clarify me this


    I have two tables... We're item_master, second is dtls_stg, which are related to an element of the current column.

    In my table of dtls_stg, except the column elements it is another column, called pre_pack_seq, which holds the numbers like 1,2,3... There may be one or Articles with so many pre_pack_seq for example

    Element pre-pack-seq
    1001 1
    1-1002
    2 1003
    1004 3
    1005 2
    1 1006
    1007 3

    Now I have to find the parent of the current element in the dtls_stg table, which is present in the master of the order of the day

    That is to say for all the pre-pack-seq, which has the value of 1, I select items which are located in the item_master table and must check with the item_level at the master of the order of the day, if item_level is set to 2, I need to check item_parent and see if all have same number or not, otherwise, I should show this number of point... If item_level is 3, I check with a column of item_grandparent, and check if items that have item_level 3 must have as many item_grandparent or not... If this isn't the case, display this element. This process must be done for all numbers of pre-pack-seq... This should be done in the SQL and PL/SQL...

    I hope that you understand what the requirement... For more details, plse let me know

    Concerning

    Published by: Seshu2 on September 28, 2008 23:46

    Please stop posting duplicate threads. I've already answered your question. Use:

    select  item,
            item_parent,
            pre_pack_seq
      from  (
             select  d.*,
                     m.item_parent,
                     count(distinct case item_level when 2 then item_parent else item_grandparent end) over(partition by pre_pack_seq) cnt
               from  dtls_stg d,
                     item_master m
               where m.item = d.item
            )
      where cnt > 1
    /
    

    SY.

  • Find the parent of a child

    Hi all

    I have the following problem, I have a table with the following data

    Parent child
    101 201
    102 202
    201 301
    202 302
    301 401
    301 403

    Now I need to write a select query to find the top most parent of the given child, that is to say that I gave my input like 201 302 and 403 so my output should be

    Parent child
    101 201-> (201 is the son of 101)
    102 302-> (302 is the child of 202, 202 is the child of 102)
    101 403-> (403 is the child of 301, 301 - > 201, 201-> 101)

    Thanks for your help,
    REDA

    Hi, Raj,

    Welcome to the forum!

    Whenever you have any questions, post your examples of data in a form that people can use to recreate the problem and test their solutions.
    For example:

    CREATE TABLE     table_x
    (       parent     NUMBER (4)
    ,     child     NUMBER (4)     PRIMARY KEY
    );
    
    INSERT INTO table_x (parent, child) VALUES (101, 201);
    INSERT INTO table_x (parent, child) VALUES (102, 202);
    INSERT INTO table_x (parent, child) VALUES (201, 301);
    INSERT INTO table_x (parent, child) VALUES (202, 302);
    INSERT INTO table_x (parent, child) VALUES (301, 401);
    INSERT INTO table_x (parent, child) VALUES (301, 403);
    COMMIT;
    

    A WITH clause that, as Whithat posted, is also good.

    Always tell what version of Oracle you are using. This is particularly important with parent-child problems, because each version since Oracle 7 has had significant changes in this area. The following query will work in Oracle 10 (and more).

    SELECT      parent
    ,      CONNECT_BY_ROOT child     AS child
    FROM      table_x
    WHERE      CONNECT_BY_ISLEAF     = 1
    START WITH     child     IN (201, 302, 403)
    CONNECT BY     child     = PRIOR parent
    ;
    

    If you have Oracle 9, then you cannot use CONNECT_BY_ROOT, but you can get the same information from SYS_CONNECT_BY_PATH.

    The output of this product, in light of the data from the example above, is:

    `   PARENT      CHILD
    ---------- ----------
           101        201
           102        302
           101        403
    

    I guess that's what you wanted, and that the other things you posted your results (such as "---> (201 is the son of 101)"), just explained.
    The explanation is very useful, but clearly what you want really to the exit, and what is just your comments.

  • How to find the Parent Machine to a linked Clone?

    Hello

    I deployed a few clones using Lab manager, now, I wanted to find out how the clone Parent deployed to find?

    I checked in the VM, for each child VM properties, is to show the string length... I want to see information such as (uses or used by types)... Child uses clone Parent or Parent clone is used by 'x' number of clones of children...

    Please tell me how to find it?

    Kind regards

    Esxvmuser

    Hey Buddy,

    Open your configuration. You will see a list of all the VMS in your configuration.

    There is a field called 'model '. This is your parent VM.

  • How to find the mother of flexasset?

    Hello

    I have what I think it's a very easy question.

    How do you find the parent of current assets?

    I have a family simple flex with the parent (for example, "category") and the relationship of the child.

    I have the code of the child's assets in a variable, and I want simply to find the parent and display the name of the parent.

    Example of code?

    < name assetset:setasset = "myChild" type = "FlexAttribute_C" id =' < % = ics. GetVar ("childID") % > ' / >

    After you load this asset, how can I get a reference to its parent of flex?

    Normally, I would use < assetset:getattributevalues > to recover assets of flex flex attributes.

    However, because the parent is not my normal type of FlexAttribute, it is not recoverable in the same way that I retrieve other attributes of flex.

    for example, using < assetset:getattributevalues >

    I also tried ics:treemanager.getparent but it does not work.

    I've not found an obvious answer in the developer's guide.

    Thank you

    Mike

    You can do this quickly with java AssetAPI, as soon as you get the AssetData object that represents your assets, you can call. getParents() or. getImmediateParents(). The developer's Guide has AssetAPI examples, and you can find the full javadoc at http://docs.oracle.com/cd/E29542_01/apirefs.1111/e39356/toc.htm

    Phil

  • To find the Top most parent SQL

    How to find the top most parent SQL. I want to avoid the hierarchical query that shows a high cost to run. Please suggest alternative options to find the parent

    Maybe (when having multiple hierarchy trees) to be adapted to your needs

    Select empno, I

    from (select empno, I

    WCP

    where empno = 7876

    model

    hierarchy of reference on (select employee empno,

    Manager Mgr

    WCP

    )

    dimension (employee)

    measures (Manager)

    main main_model

    size of (0 I)

    measures (empno)

    rules iterate (100) until (empno [iteration_number + 1] is null)

    (

    EmpNo [iteration_number + 1] = hierarchy.manager [empno [iteration_number]]

    )

    )

    where empno is not null

    order by I desc

    EMPNO I
    7839 3
    7566 2
    7788 1
    7876 0

    Concerning

    Etbin

  • find the value relative to another column

    Find the value column B in the column 'sparent. Let me explain the few cases:
    Suppose that we receive the 1000 kg of quantity for Jack, Jack then transferred this 1000 kg to Robin and Robin transferred once again this amount to Parkins and so on. A column named Type records the entry type, either it's a receipt or transfer operation. His entry would be recorded in my table like:

    QTY_ A_ B_ Type_
    Reception of 1000 Jack
    1000 jack Robin transfer
    Transfer of 1000 Robin Parkins

    So, with this information, you find the parent of Parkins, Jack, receipt of Type?
    with t as (select 1000 qty,null a,'jack' b,'receipt' type from dual
                 union all
                   select 1000,'jack','robin','transfer' from dual
                   union all
                   select 1000,'robin','','transfer' from dual
                   union all
                   select 1000,'parkins','jack','transfer' from dual)
        select *
          from t
          where connect_by_isleaf = 1
          and a is null
          connect by nocycle b = prior a
         start with b = 'jack' ;
    
           QTY A       B     TYPE
    ---------- ------- ----- --------
          1000         jack  receipt
    1 row selected.
    

    Good bye
    DPT

  • How do you define the parental control on firefox android? If it does not, it will be?

    I can't find the parental control on Firefox android.

    There is no parental control for firefox. You can however get a parental control as app of Google game store that applies to the system-wide.

  • Is the parent of the layer using ActionManager

    Is it possible to get the layer using ActionManager parent? There is a simple way to layer.parent, but this seems to be rather slow, I would appreciate a quick access, but could not get an idea how to do it.

    The descriptor of the layer is not a key "parent". There is no key with the stringID of 'layerSection '.

    Action of eating a layerSet is really two layers. It has the value "layerSectionStart" in the key 'layerSection '. This is the layer that you can see in the interface of Photoshop. It marks the top of a layerSet. The background to the layerSet is a hidden layer with the value of "layerSectionEnd" in the "layerSection" key You can't do this active hidden layer and some of the key have different values as the "high" corresponding. For example if the visible layerSet in Photoshop is 'Group 1' is the name for the end of the layerSet ".

    I think you might find the parent of a layer by using the Action Manager, if you got the index of the layer in question. Then a loop backwards using the index and the search for the key "layerSection" to "layerSectionStart". If you encounter a "layerSectionEnd" before finding the beginning you must keep track of that to be sure, you will find the good 'start '. Something like that on my list of things to do, I just have not had him yet.

    Even if a loop by index in action Manager is much faster that the loop in the DOM, I have a not sure that find the parent with the Action of eating would be faster doing the active layer and using the DOM to find the parent.

  • How to find the coordinates of the screen control clicks?

    I would like to find the screen coordinates of the place a click / tap event occurs. So, for example, if a button is clicked, is it possible to find the x / place on screen? Or at least the command position?

    It seems to be difficult scpecially if the controls are in a ListView. The onClicked: event there is no provided location information. And if I try to join a TapHandler to the ListView it seems fire on areas non-zero.

    You can use the onTouch() signal to get the coordinates compared to itself or on the window...

    http://developer.BlackBerry.com/native/reference/Cascades/bb__cascades__visualnode.html#function-TOU...

    http://developer.BlackBerry.com/native/reference/Cascades/bb__cascades__touchevent.html

  • Is it possible to find the location in the bookmarks of a bookmark?

    From time to time, it happens that I strongly suspect that I saved a bookmark, but I do not remember exactly where, and I maybe changed a category or subcategory description bookmark in the meantime.

    I usually remember something on the bookmark that allows me to find breast show all bookmarks, but it does not give me the option to rename or re-file the bookmark, category or subcategory.

    View all bookmarks, looks that the field called 'Location' (of a bookmark) should be called "URL" and that there should be another field called 'Location' which tells you where the bookmark is breast show all bookmarks.

    Is it already possible to find the current location of the current bookmark in view all bookmarks?

    If this isn't the case, I ask it is possible.

    The text that appears in "Troubleshooting information" seems not very relevant to my question.

    Without the use of an extension cord, you can click on that bookmark to open the link in a new tab (you can also do offline), and then click the star highlighted at the right end of the address bar to open the dialog box "edit this bookmark".

    See also these two extension that adds a parent column in the Manager of bookmarks (library)

  • My iPhone is dead and the lack of how find the last location?

    How to find the last location of the iphone

    Apple has sent sms on my phone number. We found your lost iphone please refer to the specific location. Apple. messageios.com apple support. What shoud I do

  • Equium M50 - cannot find the second memory location

    I just bought 2 X 1 GB memory sticks to upgrade my laptop. I skipped one at the back of the machine and it works fine but I can't find the second memory location. I have to open the machine? And if so, how.

    Any help appreciated...

    Hello

    Second memory slot is not so easy to find because you have to remove the keyboard and the top cover. Please contact your dealer and ask him for help. Please do not try to do anything only because you can cancel the warranty.

  • Degree of accuracy is to find the locations of friends?  If the location of a person is updated, the situation might be wrong or delay?

    Degree of accuracy is to find the locations of friends?  If the premises of a person is updated on my phone, could be wrong or delay of an hour or two?

    It is as accurate as the location information that becomes their phone. And which can vary wildly. GPS signals are subject to an intervention by buildings, trees, weather. The phone can get information about the location of a WiFi network that is inaccurate. Find My Friends is certainly not specific enough to be invoked in situations of life and death. Nor should it be used as "evidence" that children or spouses are lying to you.

  • Photos can not find the location of the original file

    Hi all

    I need help.

    My photo library cannot locate the masters original which means that photos don't load to icloud and photo book, I worked all year is riddled with exclamation points, because they can't find the file.

    Is that what I can do to fix the places they designate? The files are still on my computer, because none have been moved and I can find them when you use find any file, it's just that there are more 6 000 files that are "unable to download" so it would be very expensive to do it one by one.

    Thank you

    Paul

    The files are still on my computer, because none have been moved and I can find them when you use find any file, it's just that there are more 6 000 files that are "unable to download" so it would be very expensive to do it one by one.

    Are files that can be found inside the photo library in the folder of masters or referenced by pictures in a folder outside the library?

    If the photos are in a folder outside your library, check where Photos expected them to be.  The error you get when you try to edit or export the original file should show you the path to the file in the folder where the photo should be.  Where is it?  Try "file > see the file reference in the Finder.  He opens the folder where the original must be. Where is it?

Maybe you are looking for

  • Music: Why the Star Ratings went?

    Apple, I was using iTunes since 1.0 and music from Apple since the first iPod players. The main way I sort my music is by assessing all my songs, so I can quickly make playlists based on songs of five stars (for example). I often listen to playlists

  • Could not find Adobe Shockwave Download

    The add-on integration FF 26 said shockwave must be upgraded. By clicking on 'update now' sending me to the Adobe shockwave download page that is labeled STEP 1 out of 3. I click on 'Install now' and are sent to a generic Adobe page which is obviousl

  • Pavilion Notebook: Windows Media Player went

    Somehow, my Windows Media Player has disappeared from my laptop. The HP-1000 refuses to play any DVD and no symbol. How to restore the media player?  When I search for apps, it indicates that the player has been charged on my PC. Confused; Help, plea

  • Sticky notes for Windows XP

    I'm trying to get the sticky notes for my windows xp. How do I do that? I can't find a site that I can trust.

  • Acer Aspire E1-470-33214G1TMkk/ww RAM upgrade

    Hello world I have an Acer Aspire E1-470-33214G1TMkk/ww, I increase the RAM or add another 4 GB?