AS3 Dropped MovieClip doesn't take parent's dimensions

Please help me with my code. I'm working on a map project with several movie clips that are dragged and dropped onto their respective movie clips.
PROBLEM:
Initially, draggable movie clips are reduced their original size. When they are dropped onto their matching movie clip, I would like them to take the dimensions of the movies placed on the map. How to do that?
HERE IS MY CODE
stop();
var startX:Number;
var startY:Number;
var finalX:Number;
var finalY:Number;
var finalWidth:Number;
var finalHeight:Number;
var counter:Number = 0;
alta_mc1.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
alta_mc1.addEventListener(MouseEvent.MOUSE_UP, dropIt);
alta_mc3.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
alta_mc3.addEventListener(MouseEvent.MOUSE_UP, dropIt);
alta_mc2.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
alta_mc2.addEventListener(MouseEvent.MOUSE_UP, dropIt);
alta_mc4.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
alta_mc4.addEventListener(MouseEvent.MOUSE_UP, dropIt);
alta_mc5.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
alta_mc5.addEventListener(MouseEvent.MOUSE_UP, dropIt);
alta_mc6.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
alta_mc6.addEventListener(MouseEvent.MOUSE_UP, dropIt);
alta_mc7.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
alta_mc7.addEventListener(MouseEvent.MOUSE_UP, dropIt);
alta_mc8.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
alta_mc8.addEventListener(MouseEvent.MOUSE_UP, dropIt);
alta_mc9.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
alta_mc9.addEventListener(MouseEvent.MOUSE_UP, dropIt);
alta_mc10.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
alta_mc10.addEventListener(MouseEvent.MOUSE_UP, dropIt);
alta_mc11.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
alta_mc11.addEventListener(MouseEvent.MOUSE_UP, dropIt);
alta_mc12.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
alta_mc12.addEventListener(MouseEvent.MOUSE_UP, dropIt);
alta_mc13.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
alta_mc13.addEventListener(MouseEvent.MOUSE_UP, dropIt);
alta_mc14.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
alta_mc14.addEventListener(MouseEvent.MOUSE_UP, dropIt);
function pickUp(event:MouseEvent):void {
event.target.startDrag(true);
event.target.scaleX = 1.2;
event.target.scaleY= 1.2;
m_txt.text = "";
event.target.parent.addChild(event.target);
startX = event.target.x;
startY = event.target.y;
function dropIt(event:MouseEvent):void {
event.target.stopDrag();
var myTargetName:String = "target" + event.target.name;
var myTarget:DisplayObject = getChildByName(myTargetName);
if (event.target.dropTarget != null && event.target.dropTarget.parent == myTarget){
  m_txt.text = "Good Job!";
  event.target.removeEventListener(MouseEvent.MOUSE_DOWN, pickUp);
  event.target.removeEventListener(MouseEvent.MOUSE_UP, dropIt);
  event.target.buttonMode = false;
  finalX = myTarget.x;
  finalY = myTarget.y;
  // HERE IS WHERE I CAN'T MAKE THE DROPPED MOVIE CLIP TAKE THE PARENT'S MOVIE CLIP DIMENSIONS.
  finalWidth= event.target.width
  finalHeight= event.target.height;
  counter++;
} else {
  m_txt.text = "Try Again!";
event.target.x = startX;
event.target.y = startY;
event.target.scaleX = 1;
event.target.scaleY= 1;
if(counter == 14){
        m_txt.text = "Felicitaciones! Ha colocado todos los municipios correctamente!";
alta_mc1.buttonMode = true;
alta_mc2.buttonMode = true;
alta_mc3.buttonMode = true;
alta_mc4.buttonMode = true;
alta_mc5.buttonMode = true;
alta_mc6.buttonMode = true;
alta_mc7.buttonMode = true;
alta_mc8.buttonMode = true;
alta_mc9.buttonMode = true;
alta_mc10.buttonMode = true;
alta_mc11.buttonMode = true;
alta_mc12.buttonMode = true;
alta_mc13.buttonMode = true;
alta_mc14.buttonMode = true;
completo.visible=false;
help_1.addEventListener(MouseEvent.CLICK, showMap);
function showMap(event:MouseEvent): void {
completo.visible=true;
help_1.addEventListener(MouseEvent.ROLL_OUT, showMap1);
function showMap1(event:MouseEvent): void {
completo.visible=false;
Thanks
German

try:
stop();
var startX:Number;
var startY:Number;
var finalX:Number;
var finalY:Number;
var finalWidth:Number;
var finalHeight:Number;
var counter:Number = 0;
for(var i:uint=1;i<15;i++){
this["alta_mc"+i.toString()].addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
this["alta_mc"+i.toString()].addEventListener(MouseEvent.MOUSE_UP, dropIt);
this["alta_mc"+i.toString()].buttonMode=true;
function pickUp(event:MouseEvent):void {
event.target.startDrag(true);
//event.target.scaleX = 1.2;
//event.target.scaleY= 1.2;
m_txt.text = "";
event.target.parent.addChild(event.target);
startX = event.target.x;
startY = event.target.y;
function dropIt(event:MouseEvent):void {
event.target.stopDrag();
var myTargetName:String = "target" + event.currentTarget.name;
var myTarget:DisplayObject = getChildByName(myTargetName);
if (event.target.dropTarget != null && event.target.dropTarget.parent == myTarget){
  m_txt.text = "Good Job!";
  event.target.removeEventListener(MouseEvent.MOUSE_DOWN, pickUp);
  event.target.removeEventListener(MouseEvent.MOUSE_UP, dropIt);
  event.target.buttonMode = false;
  finalX = myTarget.x;
  finalY = myTarget.y;
  // HERE IS WHERE I CAN'T MAKE THE DROPPED MOVIE CLIP TAKE THE PARENT'S MOVIE CLIP DIMENSIONS.
event.currentTarget.width=myTarget.width;
event.currentTarget.height=myTarget.height;
  counter++;
} else {
  m_txt.text = "Try Again!";
event.target.x = startX;
event.target.y = startY;
event.target.scaleX = 1;
event.target.scaleY= 1;
if(counter == 14){
        m_txt.text = "Felicitaciones! Ha colocado todos los municipios correctamente!";
completo.visible=false;
help_1.addEventListener(MouseEvent.CLICK, showMap);
function showMap(event:MouseEvent): void {
completo.visible=true;
help_1.addEventListener(MouseEvent.ROLL_OUT, showMap1);
function showMap1(event:MouseEvent): void {
completo.visible=false;

Similar Messages

  • When I go to do a drop shadow, photoshop cc takes 17 seconds to pull up the window

    I just got Photoshop CC a few weeks ago.  It seems to be very slow, and I'm using a super fast computer with 32Gig of RAM, i7 Processor, SSD, etc...
    Photoshop in particular, is REALLY slow.  For instance, when I go to Layer, Layer Style, Drop Shadow, it takes about 17 seconds before the window will pop up for me to make adjustments on a drop shadow.  If I click cancel on that, it takes about 2-3 seconds for the window to go away.
    Lots of other slow things in photoshop too.  Scratch disks are on a SSD.  Performance is set to give Photoshop 80% of my RAM.
    Anyone have any clues or ideas to help?

    I have this same problem. It doesn't take quite as long, about 6 seconds to open the Layer Styles dialog, but still, way too long for such a powerful computer (I have pretty much the same specs as your). My Surface Pro 3 i5 runs Photoshop faster than my i7-5820k with a GTX970.
    Did you ever get the issue resolved?

  • My iPhone 3GS doesn't take the charge and reboots all the time

    my iphone went to deep discharge and now when i connect it
    to a computer (Mac or PC) or to a socket it doesn't take the charge ...
    sometimes it seems to take the charge (volt icon appears)
    but then it boots again and again and i'm stuck into that cycle ..
    tried to press both buttons more than 10 seconds without success ...
    Thanks for the help

    It sounds like you need a new battery?
    How old is the battery?
    I'm not an expert, but I think Li-ion batteries are better at delivering a steady voltage, even at low charge levels (minimizing the 'memory effect'), but once they go bad they drop off a cliff. At least, that's what I've heard.

  • TS4268 When i go to settings and i go to facetime it says waiting for activaton but when i click on my apple id on top of it, it doesn't take me to go activate it, where exactly do i have to go do activation? do i have to see only hotmail? or somewhere?

    When i go to settings and i go to facetime it says waiting for activaton but when i click on my apple id on top of it, it doesn't take me to go activate it, where exactly do i have to go do activation? do i have to see only hotmail? or somewhere? i am on my iphone 4 6.1.3

    Hi debinarizona,
    I see the Handoff setting under "Settings > General > Handoff & Suggested Apps".
    Connect your iPhone, iPad, and iPod touch using Continuity
    Best Regards,
    Nubz

  • Hey, I'm trying to install Adobe Flash on my Macbook Air. At a certain point it asks for my password but it doesn't take it. So I cannot continue installment. I have reset my password already. Still the same problem. How can I continue to install when it

    Hey, I'm trying to install Adobe Flash on my Macbook Air. At a certain point it asks for my password but it doesn't take it. So I cannot continue installment. I have reset my password already. Still the same problem. How can I continue to install when it keeps asking for a password it doesn't recognize over and over again? How many times do I have to reset it then? Advice please

    You have to provide your computer's administrator password in order to install Flash Player.

  • Control image to report doesn't take all width

    I want to add and print a control to my report, but the control image doesn't take all the width avalaible on my report.
    It's stretched before the margin.
    Take a look to my exemple in attachement
    thanks
    Attachments:
    print_panel.vi ‏38 KB

    Hi,
    I regret to say that the image size is a known bug with the Report Generator. There is currently no workaround for this issue. The image size cannot be greater than a 1� margin on both sides. I hope you�ll be able to work around this. The issue will be fixed in a future version of LV.
    Danny G.
    Applications Engineer
    National Instruments

  • I have never had to enter a password to access mail. However, recently, I keep being asked for password on my ****** address. Only on my macbook. (which, btw, has a version number the drop down doesn't offer as a choice. I had to putt 9.4)

    I have never had to enter a password to access mail.
    However, recently, I keep being asked for password on my ***** address.
    Only on my macbook. (which, btw, has a version number your drop down doesn't offer as a choice. I had to putt 9.4)
    When I look up the account the "password" is a long string of gobbledygook. Something I would never do.
    But when I attempt to use that pw I still can't get in.
    I have no trouble accessing that email account on my mac mini. Just on the macbook.
    <Edited by Host>

    Maiko,
    I'm confess I'm still trying to get a handle on your problem. You do a fantastic job of describing it ... but I'm just trying to picture it accurately in my head.
    I think, were I in your shoes, I'd begin by looking at what the debug page has to say for the specific destination in which you're interested in fixing. In other words, I'm not clear on where, exactly, this destination points ...
    Destination illinois.edu.1945806043
    Is that your site, or the division within your site that you want to fix? "Normally", you do not need to specify a site handle to get to your site within your transfer CGI ... if you say "uillinois.edu", it's enough to transfer your users to iTunes U ... but every site still has a handle, and you could, if you wanted to, actually specify it in your transfer CGI. For example, this:
    Destination uic.edu.1139051993
    is for my entire site ... it's my site handle. Whereas this:
    Destination uic.edu.1991288441
    is for a division within my site ... but it's impossible to tell the difference between "site" and "division" from just the handle (I mean, if I didn't say "this is a site" and "this is a division", there'd be no way for you to know). So when I look at your creds and permissions on your debug page, I can't quite tell if they give you download access for your site, or for the specific division you want to fix. If you could open the debug page with your division as destination (or confirm that that's what we're looking at), it'd rule out some things.

  • After I download my music to library and put it on the cloud can I delete my library so it doesn't take up space on my hard drive?

    After I download my music into library and put it on the cloud, can I delete my library so it doesn't take up space on my hard drive.

    I thought maybe it would be a little easier to understand where I am getting all these numbers from if I gave you guys some screenshots.
    Here is the information for the original files (pulled straight from the card onto the external):
    Here is the information for the FCP Library:
    Here is the information for the folder within the FCP Library called "Original Media":
    And finally, here is the information for the folder within the FCP Library Called "High Quality Media":

  • I have limited space left on my iphone.  How do I send music from my iPhone back to the cloud so it doesn't take up all my space, if I decide I want different music?

    I have limited space left on my iphone.  How do I send music from my iPhone back to the cloud so it doesn't take up all the space on my phone, if I decide I want different music?

    You don't send it back to the cloud since it never left the cloud.
    You can delete indovidual songs from the iPod, or if all music is available in your iTunes library on your computer, you can remove the music from your iPhone via the iTunes sync process.

  • My laptop doesn't take CDs. Can I download Adobe Photoshop Elements 6 directly from the Adobe website?  I have the original Elements 6 CD Serial Number registered with Adobe.

    Is there a way to download Adobe Photoshop Elements 6 onto my laptop?
    i have the original CD but the laptop doesn't take CDs.   I had my CD registered with Adobe when I first purchased it and am hoping I could do a software download via Adobe website. Am I wrong?
    If it is possible to do so, where do I start?

    Thank you, Barbara.  My husband and I thought that may be the case.
    Thanks and have a nice day.
    Ewa
    On Sun, Jul 27, 2014 at 8:15 PM, Barbara B. <[email protected]>

  • ITunes says this computer is authorized, but it doesn't take

    Just moved my stuff to a new iMac G5. Of course, I couldn't play my Music Store downloads, so I provided my apple id and password and authorized my computer to play them. iTunes confirmed that my computer was now authorized. However, it still won't let me play the music! When I try to play it, I get the same "not authorized" message again. This happens whether I log out and log in again or restart. I keep repeating the authorization process, but it doesn't take.
    Any suggestions?

    Okay, my problem is solved.
    It turns out I had TWO iTunes accounts:
    [email protected]
    and
    username (without the @mac.com)
    I had thought that I only had one account, the mac.com account.
    After iTunes support told me that I had two accounts, I logged in using the other one and was able to authorize my songs.
    Hope this helps someone else!

  • Since I updated my iPad 2 to OS 8, when I hit the home key, I get a "sign in to iCloud" message. When I enter my password, it doesn't take it but Settings shows I'm signed in to iCloud.....not sure why

    since I updated my iPad 2 to OS 8, when I hit the home key, I get the message "sign in to iCloud". I enter my password but it doesn't take it. When I go into settings, it sows iCloud is on. Nor'easters sure how to stop this

    Try signing out and signing back into iCloud. This worked for me.

  • When I click on the iPhone in itunes, It doesn't take me to the management tab, where it shows storage and usage?

    My iPhone, when I click on '(name)iPhone, It doesn't take me to the settings, the storage, usage music etc. it just stays on the previous tab I was on, how do I actually get to my iPhone settings, i can't find an answer anywhere! It works with my iPod 5th generation, but not my iPhone help!!

    Press CTRL-L to show the location of the currently playing song.
    iTunes Keyboard Shortcuts (Mac)
    iTunes Keyboard Shortcuts (Win)
    tt2

  • I'm trying to sync my iphone in IPhoto. I get this message "our MobileMe account information is not correct. The provided login or password is not valid." when I click on the "Open MobileMe Preferences" button, it doesn't take me there.  Help please.

    I'm trying to sync my iphone in IPhoto. I get this message "your MobileMe account information is not correct". "The provided login or password is not valid." when I click on the "Open MobileMe Preferences" button, it doesn't take me there.  Help please.

    Mobile me has been discontinued for over a year.  What system  and iPhoto versions are you running?
    How are you trying to sync?  With Photo Stream or thru iTunes?
    Do you have an iCloud preference pane in your System preferences?
    Do you meet the minimum requirements for iCloud and Photo Stream?
    iCloud: System requirements
    iCloud: Photo Stream FAQ
    OT

  • Why is the picture quality so bad? It just doesn't take good picture it's blurry.

    Why is the picture quality so bad? It just doesn't take good pictures it's blurry.

    Hi there Amitabhavin,
    You may find the troubleshooting steps in the article below helpful.
    iPhone: Hardware troubleshooting
    http://support.apple.com/kb/ts2802
    Camera isn't functioning or has undesired image quality
    If the screen shows a closed lens or black image, force quit the Camera app.
    If you do not see the Camera app on the Home screen, try searching for it in Spotlight. If the camera does not show up in the search, check to make sure that Restrictions are not turned on by tappingSettings > General > Restrictions.
    Ensure the camera lens is clean and free from any obstructions. Use a microfiber polishing cloth to clean the lens.
    Cases can interfere with the camera and the flash. Try gently cleaning the lens with a clean dry cloth or removing the case if you see image or color-quality issues with photos.
    Try turning iPhone off and then back on.
    Tap to focus the camera on the subject. The image may pulse or briefly go in and out of focus as it adjusts.
    Try to remain steady while focusing:Still images: Remain steady while taking the picture. If you move too far in any direction, the camera automatically refocuses to the center.
    Note: If you take a picture with iPhone turned sideways, it is automatically saved in landscape orientation.
    Video: Adjust focus before you begin recording. You can also tap to readjust focus while recording. Exiting the Camera application while recording will stop recording and will save the video to the Camera Roll.
    Note: Video-recording features are not available on original iPhone or iPhone 3G.
    If your iPhone has a front and rear camera, try switching between them to verify if the issue persists on both.
    -Griff W. 

Maybe you are looking for

  • Blue screen when trying to connect ipod

    When trying to connect my ipod to my computer it reboots it into a blue screen that looks something like this... STOP: 000000007F (0000000008, 0X80154000 etc, etc.) minidump something something. I looked in my minidump folder but there was nothing in

  • Help with vusb and printer

    Recently purchased an EA4500 router.  I'm using an old HP 4L laserjet and have it connected to the router via the USB port.  I have 2 Mac's and installed vusb on both.  I can successfully print from both Mac's, however I have to manually disconnect a

  • How to save the structure of a formatted text in adf faces output component

    Hi all please help me. I need to display my formatted text (with line breaks) in the jsf page. How can i do this. If i use OutputText all my line break ("\n") are ignored, the same effect with OutputFormatted component. I have tried to substitute lin

  • How can I embed a song into a keynote presentation?

    how can I embed a song into a keynote presentation?

  • Show messages from another component

    Hello, I have an application with several components, and I would like to know that I do to show messages from one component to another. Thank you