/* * Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * */ /* * Zou Lunkai, address@hidden */ #include #include #include #include "ming_utils.h" #define OUTPUT_VERSION 6 #define OUTPUT_FILENAME "_target_in_function1.swf" int main(int argc, char** argv) { SWFMovie mo; SWFMovieClip mc1, mc2, mc3, dejagnuclip; SWFDisplayItem it1, it2, it3; const char *srcdir="."; if ( argc>1 ) srcdir=argv[1]; else { fprintf(stderr, "Usage: %s \n", argv[0]); return 1; } Ming_init(); mo = newSWFMovieWithVersion(OUTPUT_VERSION); SWFMovie_setDimension(mo, 800, 600); SWFMovie_setRate (mo, 1); dejagnuclip = get_dejagnu_clip((SWFBlock)get_default_font(srcdir), 10, 0, 0, 800, 600); SWFMovie_add(mo, (SWFBlock)dejagnuclip); SWFMovie_nextFrame(mo); // 1st frame mc1 = newSWFMovieClip(); add_clip_actions(mc1, " testvar = 'mc1_var'; " " _root.check_equals(_root.mc1.testvar, 'mc1_var'); " " func = function () {" "_root.check_equals(this, _root.mc2);" "asm{" "push 'checkpoint' " "push '' " "push 11 " //_target "getproperty " "setvariable " "}; " " _root.check_equals(checkpoint, '/mc1'); " //check current target " _root.check_equals(testvar, 'mc1_var');" "};"); SWFMovieClip_nextFrame(mc1); mc2 = newSWFMovieClip(); add_clip_actions(mc2, " func2 = _root.mc1.func;" " func2();" " stop(); "); SWFMovieClip_nextFrame(mc2); it1 = SWFMovie_add(mo, (SWFBlock)mc1); SWFDisplayItem_setDepth(it1, 10); SWFDisplayItem_setName(it1, "mc1"); it2 = SWFMovie_add(mo, (SWFBlock)mc2); SWFDisplayItem_setDepth(it2, 20); SWFDisplayItem_setName(it2, "mc2"); SWFMovie_nextFrame(mo); //2nd frame add_actions(mo, "totals(); stop();"); SWFMovie_nextFrame(mo); //3rd frame //Output movie puts("Saving " OUTPUT_FILENAME ); SWFMovie_save(mo, OUTPUT_FILENAME); return 0; }