Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Drag and drop between apps using as3

Guest
Dec 01, 2012 Dec 01, 2012

Giddayguys

Just researching the drag and drop capabilities of AS3 in Air, specifically dragging data out of an AIR app into a non air app.  Do you have any control over what happens to the data after getting to the non-Air app?  eg if I click a datagrid in AIR, and it copied text from the column to the clipboard, and then I drag out of AIR into, say, Windows notepad, can I paste the clipboard's data by dropping?

Thanks

TOPICS
ActionScript
1.7K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Dec 02, 2012 Dec 02, 2012

Wow I thought flash.desktop was all AIR, my mistake, thanks for the info as always kglad!

And #8 is still correct, there is no simple interface from AIR via drag and drop to another app. The main reason is other apps need to be programmed to even receive the win32 message and know how to handle it. Some apps may allow it but you must abide by their API to accomplish that. Less you make a win32 ANE, the chances are the simple answer to your question is no, that is not possible (for good reasons).

Translate
Community Expert ,
Dec 01, 2012 Dec 01, 2012

you can paste the code by using the os paste command(s).

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 01, 2012 Dec 01, 2012

How would you hook that paste command into any external app the user drops the drag into? I'm very familiar with internal and external->internal drag and drop but I haven't seen any native support or ANEs for AIR to interface with other processes running in such a way so I'd like to know how to use the OS paste commands to paste into the "dropped" app. My initial impression was this isn't possible without some serious (perhaps impossible) ANE extension. Win32 to win32 messaging is pretty easy but I'd love to know if I missed something built into AIR for this. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 01, 2012 Dec 01, 2012

anything saved to the clipboard (and flash can save to the clipboard) is available to the os paste command.  there's no drag/drop from/to the clipboard so that part makes no sense.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 01, 2012 Dec 01, 2012

Care to elaborate on what you mean by there's no drag and drop to the clipboard or where that fits? And flash cannot save to the clipboard itself unless I am wildly mistaken.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 01, 2012 Dec 01, 2012

check the as3 clipboard class: flash can both read and write to the clipboard:

import flash.desktop.ClipboardFormats;

var s:String = "flash to clipbaord";

Clipboard.generalClipboard.setData(ClipboardFormats.TEXT_FORMAT, s);

// your next os paste will be "flash to clipboard"

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 01, 2012 Dec 01, 2012

Yeah - I've just been using:

var my_datagrid_row = Number(event.rowIndex)

System.setClipboard(my_datagrid[my_datagrid_row]["FRUIT"]);

...in the click function for my datagrid called by:

my_datagrid.addEventListener(ListEvent.ITEM_CLICK, my_datagrid_clicked);

It copies the data from that row/column by clicking it, ready for manual pasting wherever, but I was wondering if this could be converted to a drag and drop to a non AIR app?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 01, 2012 Dec 01, 2012

Yeah setting clipboard wasn't what I'm talking about kglad, that is simple. Making it useful in any [insert random application] is the challenge. You can't just take the clipboard and dump it in another app without some win32 programming.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 02, 2012 Dec 02, 2012

no, as i mentioned in my first two responses, you have to "paste" the clipboard contents into your app.   though, if your app is coded to read the clipboard or you add that code like sinious mentioned in 7 you're good.

but clearly there's nothing you can encode in app1 (eg, a flash app) that would enable some functionality in an unrelated app2.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 02, 2012 Dec 02, 2012

Wow I thought flash.desktop was all AIR, my mistake, thanks for the info as always kglad!

And #8 is still correct, there is no simple interface from AIR via drag and drop to another app. The main reason is other apps need to be programmed to even receive the win32 message and know how to handle it. Some apps may allow it but you must abide by their API to accomplish that. Less you make a win32 ANE, the chances are the simple answer to your question is no, that is not possible (for good reasons).

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 02, 2012 Dec 02, 2012

Thanks guys. Confirmed my suspicions. And it makes sense.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 03, 2012 Dec 03, 2012
LATEST

You're welcome and good luck!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines