|
Colorful
Egg - download
this sample files
This
sample shows how to add a right-mouse-click menu and how to handle
the menu clicks events in the windowless flash using fscommands.

- In
Frame 1, we add the menu items and declare the event handling
frame label:
var
cmdID;
// Add right-mouse-click menu items
// The command sequences decide the order of menu item
fscommand("fas.rmenu.addseperator", "3");//
This is in the last position.
fscommand("fas.rmenu.additem", "1,Red color");
fscommand("fas.rmenu.additem", "2,Blue color");
// This is in the first position.
//Set
default Check value
_root.showFlag = TRUE;
fscommand("fas.rmenu.checkitem", "1,TRUE");
//
The following command declares the menu event handler frame
is labeled with menuEvent, and pass the cmdID as the identifier
of the menu item clicked.
fscommand("fas.event.Menu", "_root.menuEvent,_root.cmdID");
-
We
draw a blue circle in frame 2, and a red circle in frame 3.
And add a "stop();" in each frame. This will make
the flash to stop at frame 2 and show the blue circle at first.
- At
frame 4, we give this frame label name as "menuEvent"
which is same as we declare by the fscommand
"fas.event.Menu"
in frame 1. So whenever the menu items are clicked, iceProjector
will execute the actionscripts in this frame.
- Add
the actionscripts in frame 4 as below to handle the mouse click
event in this frame. The variable "cmdID" denotes which
menu item is clicked.
switch (cmdID) { case "1" : fscommand("fas.rmenu.checkitem", "1,TRUE"); fscommand("fas.rmenu.checkitem", "2,FALSE"); gotoAndPlay(2); break; case "2" : fscommand("fas.rmenu.checkitem", "2,TRUE"); fscommand("fas.rmenu.checkitem", "1,FALSE"); gotoAndStop(3); break; }
|