[AIR] Drag Problem (parent & children can receive d&d and HTML Control)

Hi,
I have a problem regarding drag and drop in AIR. The d&d involving parent & children that can receive d&d event and the children can contain HTML control. You might want to copy and paste the code below to get a better idea.
The objectives are:
1. If you drag the green object and drop it in the black area, it should alert "Parent Drop"
2. If you drag the green object and drop it in the magenta (purple) color, it should alert "Child Drop"
3. If you drag the green object and drop it in the white (HTML control) color, it should alert "HTML Drop"
The problems:
1. drag green object to black area, to magenta area, and back again to black area. Drop it, the alert is not shown
2. drag green object to the white area (HTML control). Drop it, the alert is not shown
Many thanks.
The Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
     <mx:VBox verticalGap="0" x="50" y="50" width="200" height="200" backgroundColor="#000000" horizontalAlign="center" dragEnter="onParentDragEnter(event)" dragDrop="onParentDrop(event)">
          <mx:Canvas id="canvas1" width="50" height="50" backgroundColor="#00ff00" mouseMove="onMouseMove(event)"/>
          <mx:HTML id="html" width="50" height="50" dragEnter="onHtmlDragEnter(event)" dragDrop="onHtmlDrop(event)"/>
          <mx:Canvas id="canvas2" width="60" height="50" backgroundColor="#ff00ff" dragEnter="onChildDragEnter(event)" dragDrop="onChildDrop(event)"/>
     </mx:VBox>
     <mx:Script>
          <![CDATA[
               import mx.controls.Alert;
               import mx.events.DragEvent;
               import mx.managers.DragManager;
               import mx.core.DragSource;
               public function init():void
                    html.htmlText = '<div style="font-size:small">HTML Control</div>';
               public function onMouseMove(event:MouseEvent):void
                    var dragInitiator:Canvas = event.currentTarget as Canvas;
                    var ds:DragSource = new DragSource();
                    ds.addData("item", "item");
                    DragManager.doDrag(dragInitiator, ds, event, dragInitiator);
               public function onChildDragEnter(event:Event):void
                    trace("onChildDragEnter");
                    DragManager.acceptDragDrop(event.currentTarget as Canvas);
               public function onParentDragEnter(event:Event):void
                    trace("onParentDragEnter");
                    DragManager.acceptDragDrop(event.currentTarget as VBox);
               public function onChildDrop(event:DragEvent):void
                    trace("onchilddrop");
                    Alert.show("Child Drop");
               public function onParentDrop(event:DragEvent):void
                    trace("onparentdrop");
                    Alert.show("Parent Drop");
               public function onHtmlDragEnter(event:DragEvent):void
                    DragManager.acceptDragDrop(event.currentTarget as HTML);
               public function onHtmlDrop(event:DragEvent):void
                    Alert.show("HTML Drop");
          ]]>
     </mx:Script>
</mx:WindowedApplication>

The parent drop issue is because there can only be one drag acceptor and you don't get another dragEnter event when the mouse leaves the child (since technically, it never left the parent). This isn't as big an issue as it might seem, since generally you wouldn't have both a parent and a child that could take the drop. The ways to fix this are to use the dragOver event in addition to dragEnter or you could handle the dragExit event dispatched by the child and set the drag acceptor back to the parent.
The HTML control issue is a bit trickier. HTML content has its own drag-and-drop system that operates a bit differently than the ActionScript version. I don't think there is a way to intercept the events before they are handled by the WebKit HTML engine. You can accept a drop in HTML/JavaScript code as described here: http://help.adobe.com/en_US/as3/dev/WS6717AA0A-2B7D-4728-86DC-7D60F919E6B4.html.

Similar Messages

  • HT4623 My texts have stopped getting through to one of my contacts. I can phone him and I can receive his calls and messages. I am the only one of his contacts whose  texts are not getting through. We have both restarted our iphones but the problem contin

    My texts have stoipped getting through to one of my contacts. I can phone him and I can receive his calls and messages. I am the only one of his contacts whose  texts are not getting through. We have both restarted our iphones but the problem continues.

    Have you talked to your carrier (or your friend to his)?  Could be an issue at their end.

  • Iphone 5s cannot call out any calls, but still can receive incoming calls and sms

    Hi
    anyone experiencing this problem? After buying iphone 5s less than 2 months which I never did in the past, I could no longer make any phone calls out, yet i still can receive incoming calls and data.
    Could someone kindly assist in this? 

    Contact your carrier. Phone functions are a carrier responsibility. Have them check your account. Are you seeing any error messages?

  • My wife had an iPad for a year and synced to our computer with no problem.  I recently received an ipad2 and when I tried to sync using separate apple and iTunes passwords, under her computer user name, it appears I over-road her account and synced all he

    My wife had an iPad for a year and synced to our computer with no problem.  I recently received an ipad2 and when I tried to sync using separate apple and iTunes passwords, under her computer user name, it appears I over-road her account and synced all her apps with my apps on my iPad.  I then set myself up as a new user on our computer and tried to sync.  I now get the error that my iPad is synced to another library.  How can I start over without erasing all my data on the iPad?

    Go back to her login.  Unless you deliberately erased apps, they should all be there, both yours and hers!  Then, you need to set up each iPad separately.  You will notice that they have separate names for that very purpose.
    There is no problem with multiple Apple IDs on the same iTunes on the same computer except...  Apps are permanently associated with the ID that was originally used to obtain them.  If you choose to update an app from inside iTunes and you're logged into the "wrong" ID, you must log out and back in again.
    On the bright side, you can configure either or both iPads to sync with apps and music and movies, etc. from either or both IDs.  Further, if you choose to update the apps from the iPads themselves, there is no need to log out/in.  The device handles that.  All you need is the correct password.  In my case, I use the same password for both IDs to make things easier.

  • My itunes wont auto sync my iphone 4 after i connect it to itunes. But it can auto sync when i connect it to my old laptop. what's the problem that it can't auto sync and when i did a backup in my new laptop, it was corrupted the next day.

    But it can auto sync when i connect it to my old laptop. what's the problem that it can't auto sync and when i did a backup in my new laptop, it was corrupted the next day and i was forced to use back a backup which i did in my old laptop 4 months ago. do i have to reinstall the itunes? will my backups be corrupted after i sync again? pls guide.
    P.S/ its the latest version of the itunes whenever i did the backups.

    iPod touches or any iDevices from Apple sync only to one computer. If you sync to a different computer, all your music will be replace with the music from the new computer's iTunes. If the music were purchased from iTunes, you can re-download them again otherwise the music on iPod touch will be deleted. Do you have iTunes backup? 

  • My iMac suddenly has a USB problem. I can connect to drives and printers. I am able to pul info off from drives. When I try to send info to a drive or printer, the connection is lost. All USB ports appear to have the same problem. Can anyone help?

    My iMac suddenly has a USB problem. I can connect to drives and printers. I am able to pul info off from drives. When I try to send info to a drive or printer, the connection is lost. All USB ports appear to have the same problem. Can anyone help?

    Please do 2-3 SMC and PRAM resets back to back and retest. Also use new cables, they can go bad.
    Intel iMac SMC and PRAM resets

  • My iphone 4 did not make call. It can receive calls, send and receive sms, internet is working. How can I solve this problem?

    My iphone 4 did not make calls but I receive calls, send and receive sms, emails, etc. How may I solve it?

    I am having the same problem with ios 4.3.5

  • Can receive, send new and forward but cannot reply or reply all in mail all

    I'm using Tiger 10.4.11 and am suddenly experiencing a problem with Mail. I can receive emails and send new but cannot reply or reply all. When I click either the reply or reply all button, nothing happens, not even the spinning ball of death. Have tried the dropdown menu and the keyboard shortcut but same issue.
    Anyone else experienced the same problem or know how to fix this please?

    Ms. Gibbs, welcome to the discussion groups!
    Mail accesses Address Book to make sense of addresses, etc., whether or not you have anything in Address Book. When you start Address Book, are there any problems?
    Another thing to try after that, is kind of a "standard Mail fix to try": rebuild the Envelope Index.
    To do this, quit Mail. Then in Finder, find ~/Library/Mail/Envelope Index and move it to Trash. (~ is your Home Directory.) Then start up Mail. It will say something about importing mail... it is just rebuilding the Envelope Index file.
    -fred

  • Air drop problem: My macbook can see the imac but not vice versa.

    Thats about it, When I open air drop on my imac i cant see my macbook but when i open air drop on my mac book I can see my imac, help?

    I had the same problem on my mac mini. 
    Makes sure your computer is on the following list.
    Only the following Apple computers are able to take advantage of the Air Drop feature:
    MacBook Pro (Late 2008 or newer)
    MacBook Air (Late 2010 or newer)
    MacBook (Late 2008 or newer)
    iMac (Early 2009 or newer)
    Mac mini (Mid 2010 or newer)
    Mac Pro (Early 2009 with AirPort Extreme card, or Mid 2010)

  • I'm trying to access a forum that requires a user name and password.  When I do it on my mac it tells me the password is incorrect but when I do it on my iPad, I can access it without any problem.  I can confirm the username and password are the same

    I am trying to access a forum for which you need a username and password but it keeps telling me the username/password i've entered are incorrect.  Bizarrely, when I enter the same username/password combination on my iPad, it grants access without any problem. 
    What could be causing this, is it an issue with cookies, caches or similar.  How can I resolve it?  The forum administrator is at a loss as to what the problem is.

    Try the following steps in Safari to see if they help:
    1) First try clearing the Safari cache.  To do this pull down the Safari menu and select 'Empty cache...', then try logging into the site again.
    2) If the issue continues then reset Safari by pulling down the Safari menu and select'Reset Safari...'. You will be presented with a list of items that can be reset. I suggest selecting the 'Reset saved names and passwords', and 'Remove all website data' options at a minimum.
    Here is a list of the options and what they do. I pulled it from the Safari help page.
    Clear history:
    Clears the list of webpages you viewed.
    Reset Top Sites:
    Clears any changes you made to Top Sites, such as adding or pinning sites. If you also clear your history, your Top Sites page reverts to showing the webpage previews displayed when you first installed Safari.
    Remove all webpage preview images:
    Clears any thumbnail images Safari saved of webpages you viewed.
    Clear the Downloads window:
    Clears the list of files you downloaded from websites. Only the names are removed; the files themselves are still on your disk until you remove them.
    Remove all website icons:
    Removes website icons, which are small graphics that help identify sites on the Internet. You see them in the Safari address field and bookmarks list, and other places. These icons are stored on your computer.
    Remove saved names and passwords:
    Removes user names and passwords that Safari automatically fills in at websites that require them (if the AutoFill feature is turned on).
    Remove other AutoFill form text:
    Removes some personal information, such as telephone numbers, that Safari uses to automatically fill in forms on webpages (if the AutoFill feature is turned on). Removing AutoFill information does not remove information from your address book.
    Close all Safari windows:
    If you don’t close all Safari windows, someone could use the Back and Forward buttons to view the webpages you visited.
    Reset all location warnings:
    Clears any information websites saved about your location.
    Remove all website data:
    Removes cookies, tracking information, and other data that websites stored on your computer.

  • (URGENT) problem with JTable: can't catch ENTER and control focus in JTable

    I hava a JTable and a AbstractTableModel.
    Here is what i want to DO.
    When I press the ENTER or TAB I want to set focus to cell wich is 2 position away from the the sell I am editing
    on the same row in the JTable. How can I do this.
    in fact, that is my real question HOW to ?
    When I press the ENTER or TAB in JTABLE I want to tell to JTable which cell to grab the focus

    In the UI is defined the InputMap/ActionMap pair to respond to keys. There is defined an action for ENTER. I have had the same problem, and the only thing that worked for me was to clear the actionMap, and reassign some keys to their original action, and some (e.g. ENTER, TAB) to my actions. This worked. With TAB is harder beacuse i guess it's deeper in the JVM implemented, but after a while i've managed to overwrite that too.

  • My MacBook Air 13" dors not start or receive power. And it worked fine last time I used it.

    Last time I used my Mac, I upgraded my IPhone and Powered up my IPod shuffle. The 2nd before the first. I was charging my Mac. Powered off and closed it. No it is dead. And the charger does not light whilst trying to charge. Black and dead.

    Take it in for service.

  • How can I best monitor and/or control Temp & Fans

    I want to be able to monitor all temperature sensors (an application which tells me when things are too hot, not just gives me teperature numbers).
    I want to be able to monitor and tweek the fans.
    Actually software that monitors all the sensors would be perfect.
    I don't mind if there needs to be several seperate applications or one that does many things.

    No, you really don't want to do that. Monitoring temperatures is fine, and you can do that with one of the tools mentioned here:
    http://osxdaily.com/2011/07/11/display-cpu-temperature-in-the-mac-os-x-menu-bar/
    However, you should never tweak the fans to try to control temperatures! You do not know the hardware better than Apple's engineers, and they've designed the fans to work the way they do for a reason. If your computer overheats, there is a hardware problem somewhere, and rather than cover it up by messing with the fans (and possibly doing further damage by allowing the problem to persist), you should get it fixed.

  • How do I import/drag a downloaded template with 2 folders, PSD and HTML into GoLive 7?

    The index page looks fine in Preview but broken up in Layout. I tried the Import feature, and dragging the folders and files that came with the template into a new site. No luck. THANKS

    Try posting in the GoLive or Dreamweaver forums... this one is about general discussions on the forums themselves...
    Dreamweaver, click on Dreamweaver:
    http://forums.adobe.com/community/dreamweaver
    GoLive... Click on where you want to go...
    http://forums.adobe.com/community/golive
    Hope that helps...

  • Problem in activating the Funds Management BCS and Availability Control

    Hi experts.
    After running the program RGLIUGEN to generate the required includes in program SAPLGLIU, the generated programs come with syntax errors. When I manually correct the errors ,the program post the budgets and budget releases but does not update values for availability control to the effect that whenever one tries to post any amount against the budget, we get the following error  :
    Overall budget exceeded by 100.00 USD (FM PB Availability Control) for document item 00001
    All suggestions will be appreciated

    The following tolerance limits regarding payroll entries are currently configured in the system. Once the 90% level of the budget is exceeded, the system will generate one notice. After the 100% is reached, the system will repeat the notice every time an entry occurs.
    90%      Warning message – Internal mail (only once)
    100%    Warning message – Internal mail (repeatedly)

Maybe you are looking for

  • Trying to capture HDV with a Canon HV30    CS4

    I am new to this HD video.Im trying to capture to PPRO cs4 and not sure what settings to use.When I first start out I have my new project set to HDV after that it takes me to new sequence panel there I have selected the preset HDV 1080p30 (Im hoping

  • Video or wmv file attachments

    I am unable to open or view many emails that have video or wmv attachments. I understand that Safari may not be the vehicle to enable this? Id there another browser that I should download?

  • Reg : Using ABAP OO in Workflow

    Hi All, I have very simple question and this is the place where I am still lacking in workflow? 1. How do I identify when to use ABAP class and when to use BOR in workflow? 2. How do I identify which class to be used? Do we have any similar to BOR (S

  • Special Character Handling (&) in the payload content in PI 7.1

    Hello All, My Scenario is Idoc to File. I need to handle some special characters like "&" in  XML payload content in PI 7.1. I am receiving & character in the text field. eg: <RECORD>    <BEGDA>20100901</BEGDA>    <STAT1>A</STAT1>    <NAME1>Grandview

  • Network Accounts - Red Dot disappeared?

    Afternoon all We have 12x iMacs on an Active Directory network. We have the usual 1-2 minute wait after boot before network accounts are available - however 10.8 gave us that red dot that clears once accounts are available, but in Mavericks there's a