parent of interpolation for putting the child at the center of the scene

I worked on an interactive map of counties in Montana.  When a user clicks on a County, I would like the map to zoom in on the extent of the County and Center it on the stage.  Each county is a child of a larger container (the State, the allcnt_mc names).  I created things in my function so that when you click on one POINT the County variables with all the numbers you need are created.  I can not get the desired effect, and I think that I'm missing something basic with respect to the geometry of my step.  Can we see something that I am missing?  I created this so that the parent is interpolated to a new location equal to the center of the stage under the child called x, distance y from the center of the stage.  Essentially, it must be centered on the center of the scene, no child?

function tweenparent(e:MouseEvent):void{
     //create vars for x,y cordinates of clicked county (child)
     var calledx:Number=allcnt_mc[xmlData.row.NAME[e.currentTarget.ivar]].x;
     var calledy:Number=allcnt_mc[xmlData.row.NAME[e.currentTarget.ivar]].y;
     //create a point of called child and convert to parent's space (parent=allcnt_mc)
     var cldpt:Point=new Point(calledx,calledy);
     cldpt=allcnt_mc.localToGlobal(cldpt);
     //x and y coordinates of parent
     var allcntx:Number=allcnt_mc.x;
     var allcnty:Number=allcnt_mc.y;
     //x and y coordinates of stage center
     var stagecentx:Number=stage.width/2
     var stagecenty:Number=stage.height/2
     //create variable of new point where parent should be centered in order to have child centered over stage
     var goto:Point=new Point(stagecentx-(cldpt.x-stagecentx),stagecenty-(cldpt.y-stagecenty));
     //tween parent so that child is centered over stage
     TweenLite.to(allcnt_mc,.5,{x:goto.x,y:goto.y});
}

Thanks for all your help people...

-j

What I offered involves the scaling of the child, not the parent.  The parent will scale compared to its registration point, so you should have to do a kind of continuous adjustment which can be visually detectable... scaling of nervousness and complicated to manage.

For the parent appear across would be better done by having the parent in another container, where the container is always centered and the parent is moved inside, such as the County is centered as usual, but the container gets put on the scale, not the parent.

Tags: Adobe Animate

Similar Questions

  • To access the elements of the scene, via a SWF file that is loaded inside the scene

    -J' I A.fla.

    -A.fla includes buttons, video clips and also B.swf is loaded in A.fla with a CHARGER

    -I want to access the elements in A.fla, from codes actionscript inside B.fla to change these video clips and buttons based on the actions going on in B.swf

    for example, lets say there is an X button in A.fla and there is a button there B.fla, B.swf is loaded into A.fla, and I want the key Y to delete X when you click the button.

    General question: to access the elements in a stage, via a file SWF loaded in this stage.

    This is a way silly to explain: there is this pregnant mom, a child is loaded inside him, now, I want the codes inside the child, access to MOM

    elements, such as lets say, I want the code of the child can make the eyes of MOM flashing faster. logically there is something inside something else, but I want to have access to the bigger picture of what is loaded. I hope I can get my point across.

    I repeat what I replied to your other psoting for this same question and adding just a little bit more...

    If you load a swf into another using the Loader class, then the charger itself is the parent of the loaded swf file, so MovieClip (parent.parent) could help you target the timeline that the charger was born.

    The way to have a loaded file to speak to a parent file is through the sending of events that the parent assigns headphones for after the file has been loaded.  Here is a link to an announcement that could help explain how to implement this.

    http://forums.Adobe.com/thread/470135?tstart=120

    And here's a quick example...

    Example:

    Add something to raise the event in the child:

    dispatchEvent (new Event ("eventTriggered"));

    In your SWF to loading/parent, listen for the complete event on the Loader.contentLoaderInfo.  In the complete event handler, add a listener for the event on the loaded swf file.

    triggered when external swf loading event handler
    function loaderCompleteHandler(event:Event) {}
    (event.currentTarget.content as MovieClip) .addEventListener ("eventTriggered", eventHandler);
    }

    function eventHandler(event:Event):void {}
    trace ("event sent in loaded swf");
    }

    So in your A.swf, you should have the other event and functions of event handler that would take care of control buttons.   Event listeners could be assigned to the B.swf after that that it has loaded.  In your B.swf you just have it dispatches an event and the A.swf manage self adjustments you need taken care of.  This allows the two files to be independent of each other on a functional level.

    Regarding the buttons that you want to disable, you can either use the removeEventListener() method to remove the listeners you have assigned, or you can set the mouseEnabled property to false, or you can set the visible property to false.

  • The menu list of lateral nevigation does not (+) I put the Parent for some items list entry! Why?

    Dear all,

    The menu list of lateral nevigation does not extend I put the Parent list entry for some elements. (sublist extention does not) why? (APEX 4.2.4...)

    any iadea?

    cordially siya

    Siya,

    you choose wrong

    Model list-> vertical list with subtext and icons

    which consist of list with additional information about the entry in the list

    not a child of list (sublist)

    in order to choose another list as "Hierarchical expanding" model that adapts very well to your needs

    or

    See more blog which refer, what you want to achieve

    Creating a navigation menu of the accordion as jQuery | APEXPLAINED

  • LVOOP - 1 table of Parents in several bays of the child?

    I have 3 types of channels in my system. DI, I and AO.

    I want to create a Parent class that has 3 children for each of my types of channels.  It's because I want to store (on disk using flatten chain) all my channels together as an array of strings.  It's ok because I can use the 'to the more generic class"and a record in a table of my parents (CHANNEL class).

    The problem is when I read this array of objects.  I can read my array of objects parent but then I want to transform my array of objects of string into an array of objects, an array of objects HAVE and an array of objects of the DI AO.

    Any ideas?  Thank you.

    Lewis_G wrote:

    Hi nathand thanks for the ideas.  I've implemented it as you sugested.  Is there a way to make it more scalable?

    You might abuse the primitive preserve Run-Time class, as shown below. This divided the table parent tables separated for each class of the child, but the type of each element of these tables is always the parent type, even if they are transporting children. Not sure if that's what you want, or not.

    Lewis_G wrote:

    The child the more classes i, messier, fine.  Even if the code is the same for both, I can't have a Subvi generic because the child class is different for the two.  Don't you think it's a good idea to have a new class of table for each child.  For example, I could make a class with a method that has a channel enter parent and trys to add it to the guard?

    This could be very good, if it meets your needs.

    Intaris wrote:

    nathand wrote:

    Otherwise, add a method to the class called parent Type Get and override it in each class of the child, and then call on each element of the array to determine its type.

    And make sure that the type is a string, otherwise problems ensure later in life...

    I thought to mention that when I offered everything first, but then I thought that there could be situations in which an enum would work very well if you don't mind violating good OOP practices. Yes, the parent should know his children and you need to know about all children at design time, but if you can accept these terms then an enum is simple. I'm undecided about whether I would never apply this solution if I were to try to solve this problem in my own code.

  • When I go to control panel to set up parental controls, I gives me the options as to what I want to put in place controls

    When I click on the user that I want to put controls for, he's not raising access controls - for example I want to put in the time controls.

    Hi Paul,.

    What is the operating system installed on the computer?

    I suggest you to visit the links below and check if it helps.

    For Windows Vista;
    http://Windows.Microsoft.com/en-us/Windows-Vista/what-can-I-control-with-parental-controls

    For Windows 7;
    http://Windows.Microsoft.com/en-us/Windows7/what-can-I-control-with-parental-controls

    Alternatively, you can follow the link below to learn more about Parental controls.
    http://Windows.Microsoft.com/en-us/Windows7/search?q=parental+controls&p=1&PRD=all

  • Problem with a VM server: "the virtual disk parent has been changed since the child was created.

    Hello!

    I have a problem with a server that does not start.

    We had a virtual machine running on VMWare Infrastructure 3 with two hard drives and an instant backup of them.

    This machine has been removed from the inventory, but when it has been recreated, the secondary hard drive is mentioned for the basic-disk vmdk
    instead of being referenced to the instant vmdk and used for a few days.

    All changes made after the snapshot, were kept in the delta snapshot file, which is not loaded.

    We are with difficult to reference the secondary disk for the snapshot file. We tried to edit the .vmx and hard disk files
    to correct the CID made reference, but when we try to start the virtual machine, we got this error:

    "The virtual disk parent has been changed since the child was created.

    I think it happens because we made a blow-up of a secondary drive a few weeks after the backup snapshot. We spent 30 GB to 50 GB.
    And because it has been referenced and used in another vm.

    *** Log is attached

    Thank you

    Bruno.

    It is a bad sign

    next step in the usual forest is to use "testdisk" since a LiveCD to set the tables MBR and partition - if possible

  • There should be a limitation or personal parental control on hotspot. Children feel obliged to allow their friends to use their hotspot. And the parents who pay for it!

    There should be a limitation or personal parental control on hotspot. Children feel obliged to allow their friends to use their hotspot. And the parents who pay for it!

    This is a user to user support forum, so there is really nothing anyone here can do for you, I'm afraid.

    However, you can send your comments Apple

    http://www.Apple.com/feedback/

  • my iphone 5 s has been disabled. I'm trying to restore my iphone with itunes and itunes asks me to put the password for my iphone. but my iphone does not display the unlock screen. What should I do now?

    my iphone 5 s has been disabled. I'm trying to restore my iphone with itunes and itunes asks me to put the password for my iphone. but my iphone does not display the unlock screen. What should I do now?

    Hello

    Follow the instructions here:

    If you have forgotten the password for your iPhone, iPad or iPod touch, or your device is disabled - Apple supports

  • I bought a brand new iPhone 5 s to the United Kingdom for use in New Zealand. When I'm in New Zealand and put the card sim inside (put a sim card in the first time), he said that it is not supported and it doesn't let me do anything else - cant even get i

    I bought a brand new iPhone 5 s to the United Kingdom for use in New Zealand. When I'm in New Zealand and put the card sim inside (put a sim card in the first time), he said that it is not supported and it doesn't let me do anything else - cant even get into the phone. Why has this happened?

    The United Kingdom, where did buy you it?

  • I tried for AN HOUR to find a way to put the two different fonts on the same line

    Pages is crap. I tried for AN HOUR to find a way to put the two fonts on the same line, even if I highlight 1 WORD, the whole line changes (if you know how to do that please tell me, I'll me CRAZY!). Wouldn't recommend, that Word is 100 x better and easier to use

    < published by host >

    Hi varn,.

    Seems to work here (Pages of screen capture):

    Select (highlight) the text you want to change. Click on the Format brush, and then click Style. Choose the font you want to use.

    The example above is in the text layer. I also tried in a text box and a table cell.

    I also tried to change the font for a single word of a line of text in Pages for iOS. The police has changed to the selected word, while the rest of the line remained in the police, he had previously.

    Cannot test it in 5 Pages, because I have not installed. The above example is Pages ' 09.

    It is possible that you have applied to a paragraph Style, what would change everything in the paragraph containing the insertion point.

    Kind regards

    Barry

    PS: MS Word is available for OS X, if you feel the need to switch.

    B

  • My browser is blocked for security reasons. Code error-QFR5000RT11C. My incoming connections in open State distance. Then I got the call from the United States 1 (866)986-3669, I picked up the phone, but they put the phone down. No matter what? Help, plea

    My browser is blocked for security reasons. Code error-QFR5000RT11C. My incoming connections in open State distance. Then I got the call from the United States 1 (866)986-3669, I picked up the phone, but they put the phone down. No matter what? Help, please.

    It's probably a SCAM.  Do not call these numbers.  Force Quit Safari and reopen it by holding down the SHIFT key.

    Ciao.

  • When I put the window XP update to Windows 7 (Ultimate) will be my Convert programs for Windows 7? Or will I have to reinstall all the of them

    All title in Question says...

    When I put the window XP update to Windows 7 (Ultimate) will be my Convert programs for Windows 7? Or will I have to reinstall all the of them?

    You will need to reinstall all your programs compatible with Windows 7.  Please see the bulletin: upgrade from Windows XP to Windows 7

  • His HP Pavilion dm4-2070us stop when put the socket for headphones

    Hello

    When I remove or put the headphone jack, the sound stops for work in the speakers and headphones. To put it back, I have to close the player (music, video, or audio stream from the web site) and start it again, but if the headphones are pluged it works very well, if I remove the jack stop once again, it happens in the reverse case.

    Could you please tell me the solution for this problem?

    Info for laptop

    IDT High Definition Audio CODEC

    Genuine Windows 7 Home Premium 64 - Bit SP1

    Intel Core i5 - 2410M

    6 GB of system memory

    Thank you

    Roberto

    I solved the problem by reinstalling the driver.

  • With HP8600 I put the Option for tray 2, but it will pull only from the Tray1

    Envelopes of printer with HP8600 I put the Option for tray 2, but it will pull only from the Tray1.

    Hello finfannc,

    Welcome to the HP Forums.

    I see that you are having problems with printing envelopes from tray #2.

    Just to let you know, the printer will only print envelopes of Lac #1.  Here is the link to the User Guide that will show you what all is supported and what bins what to do. For envelope printing, go to page #165-167 media support and sizes of envelope.

    Thanks for your time.

    See you soon,.

  • My parents has been removed and the game of solitaire on their computers. How can I find and download one for them

    My parents has been removed and the game of solitaire on their computers.  How can I find and download one for them

    You still have the Windows CD?

    Follow these steps how add or remove games in Windows XP
    http://support.Microsoft.com/kb/307768

Maybe you are looking for