2 * Copyright (C) 2007, 2009, 2010, 2011 Free Software Foundation, Inc.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 * Zou Lunkai, zoulunkai@gmail.com
22 * This file was intended to test reverse execution of frame tags.
23 * However, the concept of reverse execution may be deprecated someday.
26 * frame2: move mc to (300, 300)
28 * frame4: move mc to (900, 900)
29 * frame5: remove mc and goto frame3
37 #include "ming_utils.h"
39 #define OUTPUT_VERSION 6
40 #define OUTPUT_FILENAME "reverse_execute_PlaceObject2_test1.swf"
44 main(int argc
, char** argv
)
47 SWFMovieClip mc
, dejagnuclip
;
50 const char *srcdir
=".";
55 fprintf(stderr
, "Usage: %s <mediadir>\n", argv
[0]);
60 mo
= newSWFMovieWithVersion(OUTPUT_VERSION
);
61 SWFMovie_setDimension(mo
, 800, 600);
62 SWFMovie_setRate (mo
, 12.0);
64 dejagnuclip
= get_dejagnu_clip((SWFBlock
)get_default_font(srcdir
), 10, 0, 0, 800, 600);
65 SWFMovie_add(mo
, (SWFBlock
)dejagnuclip
);
67 mc
= newSWFMovieClip();
68 sh
= make_fill_square (0, 0, 60, 60, 255, 0, 0, 255, 0, 0);
69 SWFMovieClip_add(mc
, (SWFBlock
)sh
);
70 SWFMovieClip_nextFrame(mc
);//1st frame
72 /* add mc to _root and name it as "mc" */
74 it
= SWFMovie_add(mo
, (SWFBlock
)mc
);
75 SWFDisplayItem_setDepth(it
, 10);
76 SWFDisplayItem_setName(it
, "mc");
77 SWFMovie_nextFrame(mo
); /* 1st frame */
79 SWFDisplayItem_move(it
, 300.0, 300.0);
80 check_equals(mo
, "_root.mc._x", "300");
81 SWFMovie_nextFrame(mo
); /* 2nd frame */
83 check_equals(mo
, "_root.mc._x", "300");
84 SWFMovie_nextFrame(mo
); /* 3rd frame */
86 SWFDisplayItem_move(it
, 600.0, 600.0);
87 check_equals(mo
, "_root.mc._x", "900");
88 SWFMovie_nextFrame(mo
); /* 4th frame */
90 SWFDisplayItem_remove(it
);
91 add_actions(mo
, " if(stopflag != 1) gotoAndPlay(3); stopflag = 1; ");
92 SWFMovie_nextFrame(mo
); /* 5th frame */
95 add_actions(mo
, " _root.totals(); stop(); ");
96 SWFMovie_nextFrame(mo
); /* 6th frame */
99 puts("Saving " OUTPUT_FILENAME
);
100 SWFMovie_save(mo
, OUTPUT_FILENAME
);