Capture CTRL+A, CTRL+C keys/events in flex
How to capture CTRL+A, CTRL+C events in flex? It looks like they are special keys/combinations.
As I understand in Flex 3.4 I can capture CTRL+A by capturi开发者_Python百科ng Event.SELECT_ALL
, and CTRL+C by capturing Event.COPY
. BUT it complains that there are no SELECT_ALL
static const in Event class.
I'm using Flex SDK 3.4 and Flex Builder for Linux (Ubuntu).
public function MyCanvas()
{
super();
focusEnabled = true;
addEventListener(Event.SELECT_ALL, onSelectAll); // It complains here
addEventListener(Event.COPY, onCopy); // and here
}
According to Flex 3.4 language reference there is SELECT_ALL in Event class. What version of Flex SDK are you using? Can you post example of your code?
Update: It seems the SELECT_ALL has been added in Flash Player 10. Based on this.
I don't see this from the API, but it could be an issue of targeting the right Flash player version.
You're probably not targeting Flash 10. In Project > Properties > Flex Compiler, make sure you've set either Require Flash Version: 10.0.0 (under HTML Wrapper -- yours may read 9.x.x) or otherwise specified the compiler argument -target-player=10.0.0. That ought to do the trick.
精彩评论