2 * Copyright (C) 2005, 2006, 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 * Test for stopping and playing the _root
24 * The _root movie has two frames.
25 * In frame1, there's a sprite which contains 3 frames.
26 * In each of the sprite's 3 frames, there is a red square.
27 * In frame2, there is black square.
29 * The sprite will check the counter defined in _root, and then
30 * conditionally stops and plays the _root.
32 * Normally, you can see both the red and black squares.
34 * run as ./root_stop_test
41 #include "ming_utils.h"
43 #define OUTPUT_VERSION 6
44 #define OUTPUT_FILENAME "root_stop_test.swf"
47 //actions in _root movie, defines a counter
48 SWFAction
action_in_root(void);
49 SWFAction
action_in_root()
52 ac
= compileSWFActionCode(" \
58 //actions in sprite, conditionally stops and plays the _root
59 SWFAction
action_in_sprite(void);
60 SWFAction
action_in_sprite()
63 ac
= compileSWFActionCode(" \
74 main(int argc
, char** argv
)
78 // SWFMovieClip dejagnuclip;
83 const char *srcdir
=".";
88 //fprintf(stderr, "Usage: %s <mediadir>\n", argv[0]);
94 SWFMovie_setDimension(mo
, 800, 600);
96 //dejagnuclip = get_dejagnu_clip((SWFBlock)get_default_font(srcdir), 10, 0, 0, 800, 600);
97 //SWFMovie_add(mo, (SWFBlock)dejagnuclip);
98 //SWFMovie_nextFrame(mo);
100 ac2
= action_in_sprite();
101 sh2
= make_fill_square (300, 300, 60, 60, 255, 0, 0, 255, 0, 0);
102 mc
= newSWFMovieClip();
106 SWFMovieClip_add(mc
, (SWFBlock
)sh2
);
107 SWFMovieClip_add(mc
, (SWFBlock
)ac2
);
108 SWFMovieClip_nextFrame(mc
);
112 ac1
= action_in_root();
113 SWFMovie_add(mo
, (SWFBlock
)ac1
);
114 it
= SWFMovie_add(mo
, (SWFBlock
)mc
); //add the movieClip to the _root
115 SWFDisplayItem_setName(it
, "mc_in_root"); //name the movieclip
116 SWFMovie_nextFrame(mo
);
119 sh1
= make_fill_square(270, 270, 120, 120, 255, 0, 0, 0, 0, 0);
120 SWFMovie_add(mo
, (SWFBlock
)sh1
); //add the black square to the _root's 2nd frame
121 SWFMovie_nextFrame(mo
);
124 puts("Saving " OUTPUT_FILENAME
);
125 SWFMovie_save(mo
, OUTPUT_FILENAME
);