+static int c_button(map_t*args) {
+ char*name = lu(args, "name");
+ s_button(name);
+ return 0;
+}
+static int current_button_flags = 0;
+static int c_on_press(map_t*args)
+{
+ char*position = lu(args, "position");
+ if(!strcmp(position, "inside")) {
+ current_button_flags |= BC_OVERUP_OVERDOWN;
+ } else if(!strcmp(position, "outside")) {
+ //current_button_flags |= BC_IDLE_OUTDOWN;
+ syntaxerror("IDLE_OVERDOWN not supported by SWF");
+ } else if(!strcmp(position, "anywhere")) {
+ current_button_flags |= /*BC_IDLE_OUTDOWN|*/BC_OVERUP_OVERDOWN|BC_IDLE_OVERDOWN;
+ }
+ char*action = "";
+ readToken();
+ if(type == RAWDATA) {
+ action = text;
+ s_buttonaction(current_button_flags, action);
+ current_button_flags = 0;
+ }
+ else
+ pushBack();
+ return 0;
+}
+static int c_on_release(map_t*args)
+{
+ char*position = lu(args, "position");
+ if(!strcmp(position, "inside")) {
+ current_button_flags |= BC_OVERDOWN_OVERUP;
+ } else if(!strcmp(position, "outside")) {
+ current_button_flags |= BC_OUTDOWN_IDLE;
+ } else if(!strcmp(position, "anywhere")) {
+ current_button_flags |= BC_OVERDOWN_OVERUP|BC_OUTDOWN_IDLE|BC_OVERDOWN_IDLE;
+ }
+ char*action = "";
+ readToken();
+ if(type == RAWDATA) {
+ action = text;
+ s_buttonaction(current_button_flags, action);
+ current_button_flags = 0;
+ }
+ else
+ pushBack();
+ return 0;
+}
+static int c_on_move_in(map_t*args)
+{
+ char*position = lu(args, "state");
+ if(!strcmp(position, "pressed")) {
+ current_button_flags |= BC_OUTDOWN_OVERDOWN;
+ } else if(!strcmp(position, "not_pressed")) {
+ current_button_flags |= BC_IDLE_OVERUP;
+ } else if(!strcmp(position, "any")) {
+ current_button_flags |= BC_OUTDOWN_OVERDOWN|BC_IDLE_OVERUP|BC_IDLE_OVERDOWN;
+ }
+ char*action = "";
+ readToken();
+ if(type == RAWDATA) {
+ action = text;
+ s_buttonaction(current_button_flags, action);
+ current_button_flags = 0;
+ }
+ else
+ pushBack();
+ return 0;
+}
+static int c_on_move_out(map_t*args)
+{
+ char*position = lu(args, "state");
+ if(!strcmp(position, "pressed")) {
+ current_button_flags |= BC_OVERDOWN_OUTDOWN;
+ } else if(!strcmp(position, "not_pressed")) {
+ current_button_flags |= BC_OVERUP_IDLE;
+ } else if(!strcmp(position, "any")) {
+ current_button_flags |= BC_OVERDOWN_OUTDOWN|BC_OVERUP_IDLE|BC_OVERDOWN_IDLE;
+ }
+ char*action = "";
+ readToken();
+ if(type == RAWDATA) {
+ action = text;
+ s_buttonaction(current_button_flags, action);
+ current_button_flags = 0;
+ }
+ else
+ pushBack();
+ return 0;
+}
+static int c_on_key(map_t*args)
+{
+ char*key = lu(args, "key");
+ if(strlen(key)==1) {
+ /* ascii */
+ if(key[0]>=32) {
+ current_button_flags |= 0x4000 + (key[0]*0x200);
+ } else {
+ syntaxerror("invalid character: %c"+key[0]);
+ return 1;
+ }
+ } else {
+ /* TODO:
+ <ctrl-x> = 0x200*(x-'a')
+ esc = = 0x3600
+ space = = 0x4000;
+ */
+ syntaxerror("invalid key: %s",key);
+ }
+ char*action = "";
+ readToken();
+ if(type == RAWDATA) {
+ action = text;
+ s_buttonaction(current_button_flags, action);
+ current_button_flags = 0;
+ }
+ else
+ pushBack();
+ return 0;
+}
+