2 * Copyright (C) 2005, 2006, 2007, 2009, 2010,
3 * 2011 Free Software Foundation, Inc.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
30 #include "ming_utils.h"
32 #define OUTPUT_VERSION 5
33 #define OUTPUT_FILENAME "frame_label_test.swf"
37 main(int argc
, char** argv
)
40 SWFMovieClip mc1
, mc11
, dejagnuclip
;
41 SWFDisplayItem it1
, it11
;
44 const char *srcdir
=".";
49 fprintf(stderr
, "Usage: %s <mediadir>\n", argv
[0]);
54 mo
= newSWFMovieWithVersion(OUTPUT_VERSION
);
55 SWFMovie_setDimension(mo
, 800, 600);
56 SWFMovie_setRate (mo
, 12.0);
58 dejagnuclip
= get_dejagnu_clip((SWFBlock
)get_default_font(srcdir
), 10, 0, 0, 800, 600);
59 SWFMovie_add(mo
, (SWFBlock
)dejagnuclip
);
60 add_actions(mo
, "x1=0; x2=0; x3=0; x4=0; x5=0; x6=0; x7=0; x8=0;");
61 SWFMovie_nextFrame(mo
); /* 1st frame of _root */
64 mc11
= newSWFMovieClip();
65 sh_red
= make_fill_square (100, 300, 60, 60, 255, 0, 0, 255, 0, 0);
66 SWFMovieClip_add(mc11
, (SWFBlock
)sh_red
);
67 add_clip_actions(mc11
, "stop();");
68 SWFMovieClip_nextFrame(mc11
);
69 SWFMovieClip_nextFrame(mc11
);
70 SWFMovieClip_nextFrame(mc11
);
72 add_clip_actions(mc11
, "_root.x1 = 'mc11_frame4'; stop(); ");
73 SWFMovieClip_labelFrame(mc11
, "frame4");
74 SWFMovieClip_nextFrame(mc11
);
75 add_clip_actions(mc11
, "_root.x2 = 'mc11_frame5'; stop(); ");
76 SWFMovieClip_labelFrame(mc11
, "frame5");
77 SWFMovieClip_nextFrame(mc11
);
78 add_clip_actions(mc11
, "_root.x3 = 'mc11_frame6'; stop(); ");
79 SWFMovieClip_labelFrame(mc11
, "frame6");
80 SWFMovieClip_nextFrame(mc11
);
83 mc1
= newSWFMovieClip();
84 sh_red
= make_fill_square (200, 300, 60, 60, 255, 0, 0, 255, 0, 0);
85 SWFMovieClip_add(mc1
, (SWFBlock
)sh_red
);
86 add_clip_actions(mc1
, "stop();");
87 it11
= SWFMovieClip_add(mc1
, (SWFBlock
)mc11
);
88 SWFDisplayItem_setDepth(it11
, 10);
89 SWFDisplayItem_setName(it11
, "mc11");
90 SWFMovieClip_nextFrame(mc1
);
91 SWFMovieClip_nextFrame(mc1
);
92 SWFMovieClip_nextFrame(mc1
);
94 add_clip_actions(mc1
, "_root.x4 = 'mc1_frame4'; stop(); ");
95 SWFMovieClip_labelFrame(mc1
, "frame4");
96 SWFMovieClip_nextFrame(mc1
);
97 add_clip_actions(mc1
, "_root.x5 = 'mc1_frame5'; stop(); ");
98 SWFMovieClip_labelFrame(mc1
, "frame5");
99 SWFMovieClip_nextFrame(mc1
);
100 add_clip_actions(mc1
, "_root.x6 = 'mc1_frame6'; stop(); ");
101 SWFMovieClip_labelFrame(mc1
, "frame6");
102 SWFMovieClip_nextFrame(mc1
);
103 add_clip_actions(mc1
, "_root.x7 = 'mc1_frame7'; stop(); ");
104 SWFMovieClip_labelFrame(mc1
, "frame7");
105 SWFMovieClip_nextFrame(mc1
);
106 add_clip_actions(mc1
, "_root.x8 = 'mc1_frame8'; stop(); ");
107 SWFMovieClip_labelFrame(mc1
, "frame8");
108 SWFMovieClip_nextFrame(mc1
);
109 add_clip_actions(mc1
, "_root.x9 = 'small_first'; stop(); ");
110 SWFMovieClip_labelFrame(mc1
, "small_first");
111 SWFMovieClip_nextFrame(mc1
);
112 add_clip_actions(mc1
, "_root.x9 = 'Small_first'; stop(); ");
113 SWFMovieClip_labelFrame(mc1
, "Small_first");
114 SWFMovieClip_nextFrame(mc1
);
115 add_clip_actions(mc1
, "_root.x10 = 'mc1_frame10'; stop(); ");
116 SWFMovieClip_labelFrame(mc1
, "frame10");
117 SWFMovieClip_nextFrame(mc1
);
118 add_clip_actions(mc1
, "_root.x11 = 'Big_first'; stop(); ");
119 SWFMovieClip_labelFrame(mc1
, "Big_first");
120 SWFMovieClip_nextFrame(mc1
);
121 add_clip_actions(mc1
, "_root.x11 = 'big_first'; stop(); ");
122 SWFMovieClip_labelFrame(mc1
, "big_first");
123 SWFMovieClip_nextFrame(mc1
);
126 /* place _root.mc1 */
127 it1
= SWFMovie_add(mo
, (SWFBlock
)mc1
);
128 SWFDisplayItem_setDepth(it1
, 20);
129 SWFDisplayItem_setName(it1
, "mc1");
130 SWFMovie_nextFrame(mo
); /* 2nd frame of _root */
133 add_actions(mo
, " gotoAndPlay('/mc1:frame4'); " //GotoLabel
134 " gotoAndPlay('mc1:frame5'); " //GotoLabel
135 " gotoAndPlay('/mc1/:6'); " //GotoLabel
136 " lable = '/mc1/mc11/:frame4'; "
137 " gotoAndPlay(lable); " //GotoExpression
138 " lable = '/mc1/mc11/:5'; "
139 " gotoAndPlay(lable); " //GotoExpression
140 " "CALLFRAME
"('/mc1/mc11/:frame6'); "
141 " "CALLFRAME
"('mc1:7'); "
142 " "CALLFRAME
"('mc1/:frame8'); "
143 " "CALLFRAME
"('mc1/:Small_first'); "
144 " "CALLFRAME
"('mc1/:Frame10'); "
145 " "CALLFRAME
"('mc1/:big_first'); ");
147 SWFMovie_nextFrame(mo
); /* 3rd frame of _root */
151 /* GotoExpression and callFrame support target_path */
152 check_equals(mo
, "_root.x1", "'mc11_frame4'");
153 check_equals(mo
, "_root.x2", "'mc11_frame5'");
154 check_equals(mo
, "_root.x3", "'mc11_frame6'");
155 check_equals(mo
, "_root.x7", "'mc1_frame7'");
156 check_equals(mo
, "_root.x8", "'mc1_frame8'");
157 check_equals(mo
, "_root.x9", "'small_first'");
158 check_equals(mo
, "_root.x10", "'mc1_frame10'");
159 check_equals(mo
, "_root.x11", "'Big_first'");
160 /* seems that GotoLabel does not support target_path */
161 check_equals(mo
, "_root.x4", "0");
162 check_equals(mo
, "_root.x5", "0");
163 check_equals(mo
, "_root.x6", "0");
164 add_actions(mo
, " "CALLFRAME
"('/:1'); ");
165 check_equals(mo
, "_root.x1", "0");
166 check_equals(mo
, "_root.x2", "0");
167 check_equals(mo
, "_root.x3", "0");
168 add_actions(mo
, " _root.totals(); stop(); ");
169 SWFMovie_nextFrame(mo
); /* 4th frame of _root */
173 puts("Saving " OUTPUT_FILENAME
);
174 SWFMovie_save(mo
, OUTPUT_FILENAME
);