swf_SetTagPos(tag, 0);
int t;
if(tag->id == ST_DOABC) {
- /* the strange 72 tag from flex doesn't have abc flags */
U32 abcflags = swf_GetU32(tag);
DEBUG printf("flags=%08x\n", abcflags);
- char*classname = swf_GetString(tag);
+ char*name= swf_GetString(tag);
+ if(*name)
+ printf("#name: %s\n", name);
}
U32 version = swf_GetU32(tag);
if(version!=0x002e0010) {
#include "swfabc_ops.c"
-void swf_AddButtonLinks(SWF*swf, char stop_each_frame)
+void swf_AddButtonLinks(SWF*swf, char stop_each_frame, char events)
{
int num_frames = 0;
int has_buttons = 0;
abc_getlex(f,buttonname);
abc_getlex(f,"flash.events::MouseEvent");
abc_getproperty(f, "::CLICK");
- sprintf(functionname, "::clickLink1");
+ sprintf(functionname, "::clickbutton%d", swf_GetDefineID(tag));
abc_getlex(f,functionname);
abc_callpropvoid(f, "::addEventListener" ,2);
abc_callpropvoid(f, "[package]::stop", 0);
}
needs_framescript = 1;
+
+ abc_method_body_t*h =
+ abc_class_method(cls, "::void", functionname, 1, "flash.events::MouseEvent");
+ h->max_stack = 6;
+ h->local_count = 2;
+ h->init_scope_depth = 10;
+ h->max_scope_depth = 11;
+ abc_getlocal_0(h);
+ abc_pushscope(h);
+
+ ActionTAG*oldaction = swf_ButtonGetAction(tag);
+ if(oldaction && oldaction->op == ACTION__GOTOFRAME) {
+ int framenr = GET16(oldaction->data);
+ if(framenr>254) {
+ fprintf(stderr, "Warning: Couldn't translate jump to frame %d to flash 9 actionscript\n", framenr);
+ }
+ if(!events) {
+ abc_findpropstrict(h,"[package]::gotoAndStop");
+ abc_pushbyte(h,framenr+1);
+ abc_callpropvoid(h,"[package]::gotoAndStop", 1);
+ } else {
+ char framename[80];
+ sprintf(framename, "frame%d", framenr);
+ abc_getlocal_0(h); //this
+ abc_findpropstrict(h, "[package]flash.events::TextEvent");
+ abc_pushstring(h, "link");
+ abc_pushtrue(h);
+ abc_pushtrue(h);
+ abc_pushstring(h, framename);
+ abc_constructprop(h,"[package]flash.events::TextEvent", 4);
+ abc_callpropvoid(h,"[package]::dispatchEvent", 1);
+ }
+ } else if(oldaction && oldaction->op == ACTION__GETURL) {
+ if(!events) {
+ abc_findpropstrict(h,"flash.net::navigateToURL");
+ abc_findpropstrict(h,"flash.net::URLRequest");
+ abc_pushstring(h,oldaction->data); //url
+ abc_constructprop(h,"flash.net::URLRequest", 1);
+ abc_callpropvoid(h,"flash.net::navigateToURL", 1);
+ } else {
+ abc_getlocal_0(h); //this
+ abc_findpropstrict(h, "[package]flash.events::TextEvent");
+ abc_pushstring(h, "link");
+ abc_pushtrue(h);
+ abc_pushtrue(h);
+ abc_pushstring(h,oldaction->data); //url
+ abc_constructprop(h,"[package]flash.events::TextEvent", 4);
+ abc_callpropvoid(h,"[package]::dispatchEvent", 1);
+ }
+ } else if(oldaction) {
+ fprintf(stderr, "Warning: Couldn't translate button code of button %d to flash 9 abc action\n", id);
+ }
+ abc_returnvoid(h);
+ swf_ActionFree(oldaction);
}
if(tag->id == ST_SHOWFRAME) {
if(f) {
tag = tag->next;
}
- c = abc_class_method(cls, "::void", "::clickLink1", 1, "flash.events::MouseEvent");
- c->max_stack = 3;
- c->local_count = 2;
- c->init_scope_depth = 10;
- c->max_scope_depth = 11;
- abc_getlocal_0(c);
- abc_pushscope(c);
- abc_findpropstrict(c,"flash.net::navigateToURL");
- abc_findpropstrict(c,"flash.net::URLRequest");
- abc_pushstring(c,"http://www.quiss.org/");
- //abc_pushstring(c,"file:///home/kramm/c/swftools/lib/modules/test2.html");
- abc_constructprop(c,"flash.net::URLRequest", 1);
- abc_callpropvoid(c,"flash.net::navigateToURL", 1);
- abc_returnvoid(c);
-
abc_script_t*s = abc_initscript(file, 0, 0);
c = (abc_method_body_t*)dict_getdata(file->method_bodies, s->method->method_body_index);