No Copy and Paste for Flash App?

I have been playing with the Actionscript 3 Context Menu when building a Flash app. I found that I couldn’t add menu like “Cut”, “Copy” and “Paste” into the context menu. Any other word (like “Edit”) would work. My conclusion therefore is it may not be possible to build a Flash app (running inside a browser) to have copy and paste command.

However, the same actionscript will work if the app is published as an AIR app. So on a postive side, copy and paste may be possible for AIR app. Yet to be confirmed.

 I don’t have a Flash Lite 4 phone so I cannot test if Flash Lite 4 app would have Copy and Paste function.

Below is the AS3 code I used:

stage.showDefaultContextMenu = false;   // for Flash app only.

var edit_cmi:ContextMenuItem = new ContextMenuItem(“Edit”);
edit_cmi.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, doSelect);

// Cut, Copy and Paste are for AIR app only.

var cut_cmi:ContextMenuItem = new ContextMenuItem(“Cut”);
cut_cmi.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, doSelect);

var copy_cmi:ContextMenuItem = new ContextMenuItem(“Copy”);
copy_cmi.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, doSelect);

var paste_cmi:ContextMenuItem = new ContextMenuItem(“Paste”);
paste_cmi.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, doSelect);

var cm:ContextMenu = new ContextMenu();

myBox_mc.contextMenu = cm;

function doSelect(e:ContextMenuEvent):void
 trace (e.currentTarget.label);


~ by brianchau on August 28, 2010.

2 Responses to “No Copy and Paste for Flash App?”

  1. That’s an interesting discovery. Did you test to see if it’s just the words “Cut”, “Copy”, and “Paste” that cause problems vs the actual functionality involved in copying and pasting? It’s possible that you could still have the same functionality as copy/paste, but with different names if so.

    • I have not tested the actual functionalities yet. Since my last post, I have checked that there are Event classes like Event.CUT, Event.COPY and Event.PASTE in AS3 for Flash player 10, AIR 1.5 and Flash Lite 4. So these functions should be available. Not sure why I cannot use these words though.
      I should also point out that selectable Text fields have “Cut”, “Copy” and “Paste” natively already.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: