Snap two mc together and they become one...

So,
I've been playing around with this idea but I'm stuck, so I hope some of you might have an idea... I browsed the forum and found similar post but none of them addressing my specific case...
The story goes like this:
by clicking some buttons on stage I create two different instances of 2 movieClips (from the library) called Event and State..
I want the instances of Event to snap to the State movieclips when they touch (this part works, see the code below), and if they do snap together I'd like them to move as one... So the Event instance should stick to the State instance and the two become as one....
The snapping code is
function snap(e:MouseEvent):void //each Event mc will have an eventlistener for a mouse click
          var len:int = this.numChildren;
          var g:DisplayObject = this.getChildByName("sta"); //each State instance has been renamed "sta"
          for (var k:int = 0; k < len; k++)
                    if (e.target.hitTestObject(g))
                              e.target.x = g.x - 150;
                              e.target.y = g.y;

That's actually what I'm figuring out right now even though it's still not working... I found this nice explanation about target and similar...http://theflashconnection.com/book/export/html/45
Anyway what I tried to do is creating the Eve and assign them an eventListener for dragging and not.
var eve:MovieClip = new event_graphic();
eventArray.push(eve);                             //all new created eve is added to an array and assigned 5                                                                              //listeners
for (var i:int = 0; i<eventArray.length; i++)
                    eventArray[i].buttonMode = true;
                    eventArray[i].addEventListener(MouseEvent.MOUSE_DOWN, drag);
                    eventArray[i].addEventListener(MouseEvent.MOUSE_UP, noDrag);
                    eventArray[i].addEventListener(MouseEvent.CLICK, snap);
the same happens for the State... the function snap is like this now (see the comments on the side)
function snap(e:MouseEvent):void
          var len:int = this.numChildren;                             
// finds eve and sta in the display list
          var g:DisplayObject = this.getChildByName("sta");
          var h:DisplayObject = this.getChildByName("eve");
          for (var k:int = 0; k < len; k++)       
//for each obj in the display list check wether eve touches sta
                    if (e.target.hitTestObject(g))
                              h.x = g.x - 100;
                              h.y = g.y - 4;
//eve should snap in position (not working)
          var container:MovieClip = new MovieClip();   
//if they touch add them to a new MovieClip container
          container.addChild(g);                                            
          container.addChild(h);
          container.addEventListener(MouseEvent.MOUSE_DOWN, drag); 
//add a listener for it to be draggable
          container.addEventListener(MouseEvent.MOUSE_UP, noDrag);
          container.buttonMode = true;                         
//this should turn the cursor to a hand but it doesn't... as if container didn't exist
          trace(container.numChildren);           
//here is what I find most confusing because it returns 2, and that is correct being Eve (h) and Sta (g) its //children, so the MC is there on stage somewhere
so it seems like it succesfully created an empty MovieCLip, assigns the children H and G but just doesn't make them draggable....
I also tried to declare the container outside the snap function, same results...
Here are the drag, noDrag functions
function drag(e:MouseEvent):void
          e.currentTarget.buttonMode = true;  
          e.currentTarget.startDrag();
//both e.target and e.currentTarget don't work!!!
function noDrag(e:MouseEvent):void
          e.currentTarget.buttonMode = false;
          e.currentTarget.stopDrag();

Similar Messages

  • I bougt a new  Macbook pro in 02/26/2013, in  11/25/ 2013, my trackpad become bulging, they exchange the trackpad, but not the bulging battery.  I went there yesterday, with different problem, and they said one screw  came off from the  truckpad again!

    I bought a new  Macbook pro in 02/26/2013 from Apple Canadian Ices -003.  Than I could not use it, because  my cursor uncontrollably  was jumping around the screen, I was  resumed my trackpad become bulging, Than on11/25/ 2013 they changed my trackpad for free, because was manufactoring defect,  but not the bulging battery.  They said that is do not needed.  Since that my cursor is quiet often quivering, I think my Macbook has serious  manufacturing defect. But they said no, during a year period I went to  the genius bar at least 15 times, with this and similar problems.   I went there yesterday, with different problems, and they said one of the screws  came off from my   truck pad, therefore they need to fix it and change it.  I said: -  What,  how, what  is the real problem?  A screw does not comes off just like that?  They will change my trackpad again, but not the battery. They said  has to rebuild the operation system, I'm  saving all of my data right now! I would like to exchange the battery too, or maybe get a new Macbook. My Macbook is 2010 China model. How long I would have this trackpad  problem? What are you suggesting?

    If it's a 2010 as you say towards the end of your post, it's out of warranty. The battery isn't covered in that case. Why don't you just buy a new battery if that's your concern? If it's a 2013 as you say up at the top, it shouldn't have a bulging battery. How do you know it does? If it really does, ask for the store manager and explain the problem.

  • There are two transactions ZJPVCS303 and ZJPVCS303_US for one single Report

    When run as a batch program, (currently this is the case), or withT-Code ZJPVCS303 the selection screen is unchanged (except for additional sales area above)
    - When run as T-Code ZJPVCS303_UL (UL stands for Upload) the selection screen is changed.  The unix file option is no longer available, and the user is able to upload a local file (in the same format as the current unix file, but tab delimited) to the program for processing.
    Requirements:
    There are two transactions ZJPVCS303 and ZJPVCS303_US for one single Report.
    ->When ZJPVCS303 Transaction is executed, the file is uploaded from the Application
      server to SAP R/3. The selection screen parameters would be:
      Logical Filename:
      Sales Organization:
      Distribution Channel:
      Division:
    ->When ZJPVCS303_US Transaction is executed, the file is uploaded from the Presentation Server
      to SAP R/3. When this transaction is executed, it should not have the 'Logical
      Filename' parameter anymore on the selection-screen. Instead it should only have
      Local File name on the presentation server:
      Sales Organization:
      Distribution Channel:
      Division:
        The same thing is applicable for the other transaction ZJPVCS303. When transaction ZJPVCS303
    is executed, it should not have the 'Local Filename' parameter anymore on the selection-screen. Instead it should only have
    Logical Filename:
    Sales Organization:
    Distribution Channel:
    Division:
    So how should I make these parameters invisible depending on the transaction codes execution.
    I have an idea of using MODIF ID, LOOPING AT SCREEN...MODIFY SCREEN.
    I have an idea of using SY-TCODE.
    EX:
    AT SELECTION-SCREEN OUTPUT.
    IF SY-TCODE = 'ZJPVCS303'.
    LOOP AT SCREEN.
    IF SCREEN-GROUPID = 'GRP'.
       SCREEN-INPUT   = 0.
       SCREEN-INVISIBLE = 1.
       MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    ELSEIF SY-TCODE = 'ZJPVCS303_US'.
    LOOP AT SCREEN.
    IF .....
    ENDLOOP.
    ENDIF.
    ENDIF.
    But I am not able to get the output which I require. Please help me out.

    Hello Rani
    Basically the transaction determines whether upload starts from application server (AS) or presentation server (PC). Thus, you will have the following parameter:
    PARAMETERS:
      p_as_fil          TYPE filename   MODIF ID unx,  " e.g. Unix server
      p_pc_fil          TYPE filename   MODIF ID wnd.  " e.g. Windows PC
    AT SELECTION-SCREEN OUTPUT.
      CASE syst-tcode.
    *   transaction(s) for upload from server (AS)
        WHEN 'ZJPVCS303.
          LOOP AT screen.
            IF ( screen-group1 = 'UNX' ).
              screen-input = 0.
              screen-invisible = 1.
              MODIFY screen.
            ENDIF.
          ENDLOOP.
    *   transaction(s) for upload from local PC (PC)
        WHEN 'ZJPVCS303_US.
          LOOP AT screen.
            IF ( screen-group1 = 'WND' ).
              screen-input = 0.
              screen-invisible = 1.
              MODIFY screen.
            ENDIF.
          ENDLOOP.
       WHEN others.
       ENDCASE.
    Regards
      Uwe

  • HT4314 I have two ipods in my house that were set up under the same email.  I have since assigned two different emails.  How can I change the game center account so that is not shared by both ipods because it is for two different users and they are not ha

    I have two ipods in my house that were set up under the same email.  I have since assigned two different emails.  How can I change the game center account so that is not shared by both ipods because it is for two different users and they are not happy?

    By "game center account", do you mean Apple ID?
    If so, you can change it.
    1. Tap settings and navigate to iTunes and App Stores
    2. Tap "Apple ID" and then tap "Sign Out"
    3. Log in with a different ID.

  • HT2905 My itunes looks nothing like the examples in this tutorial.  I do not have "display exact duplicates" or "date added".  Can someone please help me remove duplicate songs?  Also, I downloaded two audio books and they are showing up in my song list.

    My itunes looks nothing like the examples in this tutorial.  I do not have "display exact duplicates" or "date added".  Can someone please help me remove duplicate songs?  Also, I downloaded two audio books and they are showing up in my song list. Why???

    'Show duplicates' is now under the 'View' menu. To see the 'Date added' column go to 'View options' from the 'View' menu and check it in the section under 'Stats'.
    Click an audiobook once to select it and hit command-i (Mac) or control-i (Windows). Go to the 'Options' tab and set 'Media Kind' to 'Audiobook'.

  • I downloaded the latest iOS7 to my iPad and then the screen went blank and would not respond.   I have tried pressing the two buttons together and briefly get the Apple logo but still can not start up, the logo disappears.   I have tried connecting the iP

    I downloaded the latest iOS7 to my iPad and then the screen went blank and would not respond.   I have tried pressing the two buttons together and briefly get the Apple logo but still can not restart, the logo disappears.   I have tried connecting to my iMac to restore the iPad but the device does not show up (I have an old iMac).   What else can I do?

    You need to be running Snow Leopard 10.6.8 at the very least in order to sync your iPad with iTunes so you could update your Mac, if it can be updated, and if you care to do so.
    If that's not an option, you will have to find someone that can restore the device for you with their computer running iTunes or make an appointment at an Apple Store and ask them to restore the device for you.
    I hope that you have an iCloud backup, because you will lose everything on the device when it is restored.
    Snow Leopard can still be purchased in the U.S. Apple Online Store.
    http://store.apple.com/us/product/MC573Z/A/mac-os-x-106-snow-leopard
    Also, I would not give up on the reset technique....holding down on the sleep and home buttons at the same time until the Apple logo appears. It takes about 10-15 seconds and sometimes just a little longer to get the logo to appear.

  • Cocatenate the two fields ERDAT and ERZET in one field

    Hello Friends, Please suggest how to Cocatenate the two fields ERDAT and ERZET in one field . in my ZTABLE.ERDAT IS DATE 8 and ERZET tims 6
    so what should  be the new ZCOMBO field length and type
    Please give the ABAP Code to write that in Exit to Populate this Cocatenation of these two fields.
    Thanks
    Sincerely
    Soniya Kapoor

    Hi Soniya,
    Declare the field as Timestamp and use Convert To timestamp statement for Concatenating Date and Time into a single field
    CONVERT for Timestamps
    Converts a timestamp into the correct date and time for the current time zone.
    Syntax
    CONVERT TIME STAMP <tst> TIME ZONE <tz> INTO DATE <d> TIME <t>.
    CONVERT DATE <d> TIME <t> INTO TIME STAMP <tst> TIME ZONE <tz>.
    As long as <tst> has type P(8) or P(11) with 7 decimal placed, and <tz> has type C(6), the time stamp <tst> will be converted to the correct date <d> and time <t> for the time zone <tz>.
    Regards,
    Abhishek

  • HT1918 I been trying to buy a movie on my account but Ive having a hard time buying it because it gives me two passcode questions and I forgot one of them I wanted to know if I can get help on that ?

    I been trying to buy a movie on my account but Ive been having a hard time buying it because it gives me two passcode questions and I forgot one of them I wanted to know if I can get help on that ?

    Frequently asked questions about Apple ID - http://support.apple.com/kb/HE37 --> Can I change the answers to the security questions for my Apple ID?  --> Yes. You can change the answers to the security questions provided when you originally signed up for your Apple ID. Go to My Apple ID (http://appleid.apple.com/) and click Manage your account.
    Forgotten security questions - https://discussions.apple.com/message/18402551  and https://discussions.apple.com/message/18625296
    More involved forgotten question issues - https://discussions.apple.com/thread/3961813

  • Two Palm PDAs and iSync on one account - Synchronization not complete

    I have set up two Palm devices with iSync on one account on my computer. It was my understanding that if I do a HotSync on each device with the Mac, all three devices should have the same information. I am finding that this is partially true. If I add information to a card in my contacts database on any device, that flows through. However, if I remove a card from the computer or either device, it does not flow through to the other devices or computer after I do a HotSync on each device.
    What can be done to keep all devices fully synchronized?
    iMac (20in, Late 2006)   Mac OS X (10.4.8)  

    Changes are pulled from and pushed to various devices in your pool according to a 'plan' maintained by the truth database, and not all changes are necessarily passed around completely in a single session.
    You can read this document to get an idea of how the Sync Services framework operates:
    http://developer.apple.com/macosx/syncservices.html
    If a second and subsequent synchronization does not transfer the record modifications or deletions, you can reset the truth database by launching iSync, opening the Preferences… dialog, and pressing the Reset Sync History button, then following the instructions which appear and synchronizing once again.

  • I have two windows open and accidently closed one of them. There does not seem any option to restore that window I accidentally closed.

    I had multiple windows opened and accidentally closed one of the windows. How do I restore the window I accidentally closed?

    You can use this button to go to the currently used Firefox profile folder:
    *Help > Troubleshooting Information > Profile Directory: Show Folder (Linux: Open Directory; Mac: Show in Finder)
    *http://kb.mozillazine.org/Profile_folder_-_Firefox
    Windows hides some file extensions by default.
    Among them are .html and .ini and .js and .txt, so you may only see file name without file extension.
    You can see the real file type (file extension) in the properties of the file via the right-click context menu in Windows Explorer.

  • I downloaded two movies yesterday and they are not downloading and it says to go to my downloads and I don't know we're they are can u help me

    I've tried going to the movies section and they are there and trying to play them that doesn't work it says uve purchased but not downloaded go to downloads so I pressed the download thing under that it says it doesn't work go to downloads in iTunes and in iTunes my downloads aren't there

    Look in the Videos app.
    George

  • If I have two iTunes accounts, and only want one to update my apps why does the other account keep opening?

    Here's the issue-I have two iTunes accounts, yet account #1 always comes up when I want to update my apps. This occurs even when account #2 is logged in and has been synced from desktop to iPad. Additionally,Account #2 is logged in on the iPad and yet account #1 prompt appears when updating. Interestingly account #2 functions normal for iTunes purchases but not apps purchases. Any suggestions?

    Apps will ALWAYS be tied to the account from which they were purchased.  You will always have to update the apps from the account from which they were purchased.

  • Comparing two cells together and highlighting duplicates

    Hello
    I have two lists of emails that are of different length. I'd like to compare these two lists and highlight any duplicates, so that I don't send any email twice to the same person.
    How is this done in Numbers'09?
    Thanks!

    jknuutila wrote:
    Never mind, I got Yvan's formula to work now, thanks both for your help!
    JK,
    Yvan's formula and mine are functionally equivalent, but assume different table names. (Yvan posted before I finished composing my answer and I opted to let mine stand when I noticed.) Of course you must always take care to either make your table names match the equation or make the equation match your table names. And of course, the proper parameter separators must be used.
    We can often avoid problems with parameter separators in our examples, and we can be careful to use simple, plain English, if we suspect that you are in a location where the semicolon replaces the comma as a separator, and where English may not be the first language. This requires that you edit your Profile Data to show your country/location. The more we know about you, the easier this becomes.
    Best regards,
    Jerry

  • How to get two Results  - Sum and Average for one KeyFigure

    I have "Material" in Rows and "Cal Year/Month" in Columns and also KeyFigure "Qty" in Columns.
    The Results (Yellow) of "Qty" is defined as "Avg of all values <>0". This works fine but how do I get two Results - one is a "Sum" and the other "Avg" for just one KeyFigure. The output basically should look like below:
          Cal Yr/Month  01/2006   02/2006   03/2006...    Result        Result
    Material                   Qty       Qty           Qty       Sum of Qty   Avg of Qty
    ABC                       100         0             200            300             150     
    DEF                       100         200          300            600             200     
    GHI                        500         300          400           1200            400

    Hi Srinivas,
    I think you must use Restricted Key Figures and Formula.
    Do not introduce CALMONTH in columns, but restrict 12 times the Key Figure Qty with 0CALMONTH3, that is 01-02-03-...
    Then create a Formula that is the Sum of all Restricted KF and call it SUM.
    Then copy the previous Formula (SUM) and call it AVG and give the option of Average of all Values <>0.
    Try.
    Ciao.
    Riccardo.

  • Combine two existing responibility and make it one

    Hi,
    I have this user requesting me to combine OM Inquiry and Shipping Inquiry into 1 New Responsibility.
    Can anyone please help me in how to create a new responsibility by combining existing two responsibilities ?
    Thanks

    Juggernaut wrote:
    5. Now navigate to System Administrator -> Application -> Menu.
    6. Crate a new Menu [Menu3] and attach Menu1 and Menu2 as sub Menus for Menu3I did this and saved the new menu, but when I am trying to query it, the new Menu doesn't show up ..!!If you save the three menus then you should be able to find them -- You need to query Menu3 here.
    Secondly, in one existing responsibility, under the menu exclusion, many function show up. So when I create this new responsibility, will all these menu exclusion has to be done for the new responsibility or it will take automatically ?It has to be done manually.
    Another thing, the "Data Group" and "Request Group" is different for the existing responsibilities, so do I have to create new request group and data group too ??Yes.
    Thanks,
    Hussein

Maybe you are looking for

  • How to connect Apple TV to projector and home theater system?

    I have an Optoma HD20 projector that I have a long hdmi cable connected to and plugged that into my Apple TV. I also have an older home theater system that does not have an optical audio input. So I bought an adapter to go from optical audio to RCA c

  • ATI Radeon 4870 on K9AGM2-L ?

    Hello, I am planning to buy a new ATI radeon 4870 video card. But I need at least 2 SATA because I am using 2 SATA HDDs. It is a double slot video card solution and I see it is long...Does anyone have such card installed on this mobo MSI K9AGM2-L? Do

  • Console link to source not working/ struts-config.xml visual

    - Running jboss/tomcat under the NitroX server debugging, a stack trace is spit out. I click on the line in the stack trace that references my code, and it gives me: 'Source not found for x.y.z '. This used to work when I ran under the jbossIDE serve

  • Connection timed out. I tryed all the forums and help sites to change settings and firewall's

    Connection timed out. I tryed all the frums suggestions chaged proxy to auto. And others, and closed windows firewall, still says connection timed out. IE works. Still cant get firefox to work. == This happened == Every time Firefox opened == after u

  • Oracle Parallel Server Overview PDF

    The Oracle Parallel Server Overview PDF file seems corrupted; can't browse past page 1. http://otn.oracle.com/deploy/availability/pdf/Oracle8i_Parallel_Server_Whitepaper.pdf (from http://otn.oracle.com/deploy/performance/content.html)