Ejemplo n.º 1
0
static void MingSWFCircle(double x, double y, double r, const pGEcontext gc, pDevDesc RGD)
{
	MingSWFDesc *MGD = (MingSWFDesc *)RGD->deviceSpecific;
	SWFShape circle = newSWFShape();
	SWFMovieClip mcCircle;
	SWFDisplayItem display_item;
	char strBuffer[1024];

	mcCircle = newSWFMovieClip();
	sprintf(strBuffer,"var Label = \"x=<b>%.2f</b>, y=%.2f\\nradius is %.2f\";",x,y,r);
	SWFMovieClip_add(mcCircle, (SWFBlock) newSWFAction(strBuffer));


	if (gc->fill){
		SWFShape fcircle; 
		SWFFillStyle fill;
		fcircle = newSWFShape();
		SWFShape_movePenTo(fcircle, x, y);
		MINGSWF_SET_COLOR(MGD,gc->fill);
		fill = newSWFSolidFillStyle(MGD->red,MGD->green,MGD->blue,MGD->alpha);
        SWFShape_setRightFillStyle(fcircle, fill);
		Fixed_SWFShape_drawCircle(fcircle, r<2.0?2.0:r, 0 , 360);
		/*SWFMovie_add(MGD->movie, (SWFBlock) fcircle);*/
		SWFMovieClip_add(mcCircle, (SWFBlock) fcircle);
	}

	SWFShape_movePenTo(circle, x, y);
	MINGSWF_SET_COLOR(MGD,gc->col);
	MINGSWF_SET_LINE(MGD,circle,gc);
	/* curve drawing is flawed with setLine2() for some reason */
	/*SWFShape_setLine(circle,gc->lwd,MGD->red,MGD->green,MGD->blue,MGD->alpha);*/

	/* SWFShape_drawCircle(circle, (int)(r<2.0?2.0:r)); */
	Fixed_SWFShape_drawCircle(circle, r<2.0?2.0:r, 0 , 360);
	/*SWFDisplayItem_moveTo(SWFMovie_add(MGD->movie, (SWFBlock) circle) , x, y);*/
	/* SWFMovie_add(MGD->movie, (SWFBlock) circle);*/
	/* destroySWFShape(circle); */
	if (gc->fill){
		/*destroySWFFillStyle(fill);*/
	}

	SWFMovieClip_add(mcCircle, (SWFBlock) circle);
	SWFMovieClip_nextFrame(mcCircle);

	/* Add Label Actions */
	MingSWF_SetLabelActions(SWFMovie_add(MGD->movie, (SWFBlock) mcCircle));

#ifdef MINGSWFDEBUG
	Rprintf("Circle(x=%f,y=%f,r=%f,gc=0x%x,RGD=0x%x)\n",x,y,r,gc,RGD);
	Rprintf("\tuser coords: x=%f,y=%f\n",fromDeviceX(x,GE_NDC,MGD->RGE),fromDeviceY(y,GE_NDC,MGD->RGE));
#endif
}
Ejemplo n.º 2
0
void
add_clip(SWFMovie mo, char* file, char* name,
		char* url, int x, int y)
{
	FILE *fd;
	SWFJpegBitmap bm;
	SWFShape sh;
	SWFMovieClip mc;
	SWFDisplayItem it;
	SWFAction ac;
	char action[1024];

	printf("Adding %s\n", file);

	fd = fopen(file, "r");
	if ( ! fd ) {
		perror(file);
		exit(1);
	}
	bm = newSWFJpegBitmap(fd);
	sh = newSWFShapeFromBitmap((SWFBitmap)bm, SWFFILL_CLIPPED_BITMAP);
	mc = newSWFMovieClip();
	SWFMovieClip_add(mc, (SWFBlock)sh);
	SWFMovieClip_nextFrame(mc); /* showFrame */
	it = SWFMovie_add(mo, (SWFBlock)mc);
	SWFDisplayItem_setName(it, name);
	SWFDisplayItem_moveTo(it, x, y);

	/* "Click" handler */
	sprintf(action, " \
%s.onPress = function () { \
	_root.CoverArtLoader.loadClip('%s', coverart); \
}; \
Ejemplo n.º 3
0
SWFDisplayItem
add_static_mc(SWFMovie mo, const char* name, int depth, int x, int y, int width, int height)
{
	SWFShape sh;
	SWFMovieClip mc;
	SWFDisplayItem it;

	sh = make_fill_square (-(width/2), -(height/2), width, height, 255, 0, 0, 255, 0, 0);
	mc = newSWFMovieClip();
	SWFMovieClip_add(mc, (SWFBlock)sh);

	SWFMovieClip_nextFrame(mc);

	it = SWFMovie_add(mo, (SWFBlock)mc);
	SWFDisplayItem_setDepth(it, depth); 
	SWFDisplayItem_moveTo(it, x, y); 
	SWFDisplayItem_setName(it, name);
	SWFDisplayItem_addAction(it, newSWFAction(
			"_root.note(this+' onClipConstruct');"
			" _root.check_equals(typeof(_root), 'movieclip');"
		        " if ( isNaN(_root.depth3Constructed) ) {"
			"	_root.depth3Constructed=1; "
			" 	_root.note('_root.depth3Constructed set to '+_root.depth3Constructed);"
			" } else {"
			"	_root.depth3Constructed++;"
			" 	_root.note('_root.depth3Constructed set to '+_root.depth3Constructed);"
			" }"
			), SWFACTION_CONSTRUCT);

	return it;
}
Ejemplo n.º 4
0
void swfClip(double x0, double x1, double y0, double y1, pDevDesc dd)
{
#ifdef SWF_DEBUG
    Rprintf("clip called\n");
#endif
    pswfDesc swfInfo = (pswfDesc) dd->deviceSpecific;
    SWFShape shape = newSWFShape();
    SWFFillStyle fill;
    
    /* Set previous clip layer to the appropriate depth */
    if(swfInfo->currentClip)
    {
        SWFDisplayItem_endMask(swfInfo->currentClip);
    }
    
    /* Create new clip layer */
    fill = newSWFSolidFillStyle(0xFF, 0xFF, 0xFF, 0xFF);
    SWFShape_setRightFillStyle(shape, fill);
    SWFArray_append(swfInfo->array, (SWFObject) fill);
    
    SWFShape_movePenTo(shape, x0, y0);
    SWFShape_drawLineTo(shape, x1, y0);
    SWFShape_drawLineTo(shape, x1, y1);
    SWFShape_drawLineTo(shape, x0, y1);
    SWFShape_drawLineTo(shape, x0, y0);
    SWFShape_end(shape);
    swfInfo->currentClip = SWFMovieClip_add(swfInfo->currentFrame, (SWFBlock) shape);
    SWFDisplayItem_setMaskLevel(swfInfo->currentClip, 99999);
}
Ejemplo n.º 5
0
void
add_clip_actions(SWFMovieClip mo, const char* code)
{
	SWFAction ac;
	ac = compileSWFActionCode(code);
	SWFMovieClip_add(mo, (SWFBlock)ac);
}
Ejemplo n.º 6
0
/* TODO: respect hadj */
void swfTextUTF8(double x, double y, const char *str, double rot, double hadj, const pGEcontext gc, pDevDesc dd)
{
#ifdef SWF_DEBUG
    Rprintf("textUTF8 called\n");
    Rprintf("** family = %s, font = %d\n", gc->fontfamily, gc->fontface);
    Rprintf("** textUTF8(str[0] = %d, str[1] = %d, str[2] = %d, str[3] = %d)\n",
            str[0], str[1], str[2], str[3]);
#endif
    pswfDesc swfInfo = (pswfDesc) dd->deviceSpecific;
    SWFShape text = newSWFShape();
    SWFDisplayItem text_display;
    /* Convert UTF-8 string to Unicode array */
    int maxLen = strlen(str);
    wchar_t *unicode = (wchar_t *) calloc(maxLen + 1, sizeof(wchar_t));
    int len = utf8towcs(unicode, str, maxLen);
    
    FT_Face face = swfGetFTFace(gc, swfInfo);
    double fontSize = gc->ps * gc->cex;

    swfSetTextColor(text, gc, swfInfo);
    SWFShape_addString(text, unicode, len, fontSize, face,
                       &(swfInfo->outlnFuns));
    
    text_display = SWFMovieClip_add(swfInfo->currentFrame, (SWFBlock) text);
    SWFDisplayItem_moveTo(text_display, x, y);
    SWFDisplayItem_rotate(text_display, rot);
}
Ejemplo n.º 7
0
static void
embed_image(SWFMovie movie, char *f)
{
	SWFFill fill;
	SWFBitmap bm;
	SWFShape shape;
	SWFMovieClip clip;
	SWFDisplayItem it, it2;
	FILE *raster;
	SWFInput in;
	int height, width;
	char *name;

        if (!(raster = fopen (f, "rb")))
        {
                fprintf (stdout, "%s: %s\n", f, strerror (errno));
		exit(1);
        }

        if (!(in = newSWFInput_file(raster)))
        {
                fprintf (stdout, "Can't create SWFInput from file\n");
		exit(1);
        }

        if (!(bm = newSWFBitmap_fromInput (in)))
        {
                fprintf (stdout, "Error creating bitmap");
		exit(1);
        }

	height = SWFBitmap_getHeight(bm);
	width = SWFBitmap_getWidth(bm);


	shape = newSWFShape();
  
	SWFShape_movePenTo(shape, 0, 0);

	fill = SWFShape_addBitmapFill(shape, bm, SWFFILL_CLIPPED_BITMAP);
	SWFShape_setRightFill(shape, fill);
	SWFShape_drawLineTo(shape, width, 0);
	SWFShape_drawLineTo(shape, width, height);
	SWFShape_drawLineTo(shape, 0, height);
	SWFShape_drawLineTo(shape, 0, 0);

	clip = newSWFMovieClip();
	it2 = SWFMovieClip_add(clip, (SWFBlock)shape);
	SWFMovieClip_nextFrame(clip);

	it = SWFMovie_add(mo, (SWFBlock)clip);

	name = base_name(f);

	SWFDisplayItem_setName(it, name);

	free(name);

}
Ejemplo n.º 8
0
EXPORT BOOL WINAPI mc_add(SWFDisplayItem *p1, SWFBlock block, int p3, int p4)
{
	lstrcpy(funcname, "mc_add");
	*p1 = SWFMovieClip_add(mhsp_movieclip, block);
	if (!mhsp_item) {
		mhsp_item = *p1;
	}
	return 0;
}
Ejemplo n.º 9
0
void
add_xtrace_function_clip(SWFMovieClip mc, SWFBlock font, int depth, int x, int y, int width, int height)
{
	SWFTextField tf;
	SWFDisplayItem it;
	int flags;

	tf = newSWFTextField();

	SWFTextField_setFont(tf, font);

	/* setting flags seem unneeded */
	flags = 0;
	//flags |= SWFTEXTFIELD_USEFONT;
	flags |= SWFTEXTFIELD_WORDWRAP;
	//flags |= SWFTEXTFIELD_NOEDIT;
	SWFTextField_setFlags(tf, flags);

	/* Add all ascii chars */
	SWFTextField_addChars(tf, asciichars);
	SWFTextField_addString(tf, " - xtrace enabled -\n");

	SWFTextField_setBounds(tf, width, height);

	/*
	 * Hopefully we have a *single* _root.
	 */
	SWFTextField_setVariableName(tf, "_root._trace_text");

	/*
	 * Set flags explicitly so that the field is selectable
	 * and you can cut&paste results.
	 * (the default seems to include SWFTEXTFIELD_NOSELECT)
	 */
	SWFTextField_setFlags(tf, SWFTEXTFIELD_NOEDIT);

	/*SWFTextField_setHeight(tf, 240);*/
	/*SWFTextField_setColor(tf, 0x00, 0x00, 0x00, 0xff);*/
	/*SWFTextField_setAlignment(tf, SWFTEXTFIELD_ALIGN_LEFT);*/
	/*SWFTextField_setLeftMargin(tf, 0);*/
	/*SWFTextField_setRightMargin(tf, 0);*/
	/*SWFTextField_setIndentation(tf, 0);*/
	/*SWFTextField_setLineSpacing(tf, 40);*/
	/*SWFTextField_setLineSpacing(tf, 40);*/

	it = SWFMovieClip_add(mc, (SWFBlock)tf);
	SWFDisplayItem_moveTo(it, x, y);
	SWFDisplayItem_setDepth(it, depth);
	SWFDisplayItem_setName(it, "_xtrace_win");

	add_clip_actions(mc,
		" _root.xtrace = function (msg) { "
		" _root._trace_text += msg + '\n'; "
		"};");

}
Ejemplo n.º 10
0
EXPORT BOOL WINAPI mc_addSound(SWFDisplayItem *p1, char *file, int flags, int p4)
{
	FILE *fp = fopen(file, "rb");
	if (!fp) {
		return 1;
	}
	lstrcpy(funcname, "mc_addSound");
	*p1 = SWFMovieClip_add(mhsp_movieclip, newSWFSound(fp, (byte)flags));
	if (!mhsp_item)
		mhsp_item = *p1;
	return 0;
}
Ejemplo n.º 11
0
void
add_window(SWFMovie mo, int x, int y)
{
	SWFShape sh_window;
	SWFFillStyle fstyle;
	SWFMovieClip mc_window;
	SWFDisplayItem it;

	sh_window = newSWFShape();
	fstyle = SWFShape_addSolidFillStyle(sh_window, 0,0,0,255);
	SWFShape_setRightFillStyle(sh_window, fstyle);
	SWFShape_movePenTo(sh_window, 170, 170);
	SWFShape_drawLine(sh_window, -170, 0);
	SWFShape_drawLine(sh_window, 0, -170);
	SWFShape_drawLine(sh_window, 170, 0);
	SWFShape_drawLine(sh_window, 0, 170);

	mc_window = newSWFMovieClip();
	SWFMovieClip_add(mc_window, (SWFBlock)sh_window);
	SWFMovieClip_add(mc_window, (SWFBlock)newSWFAction(
		"_root.xcheck(getBytesLoaded() < _root.getBytesLoaded());"
		"_root.xcheck(getBytesTotal() < _root.getBytesTotal());"
	));
	SWFMovieClip_nextFrame(mc_window); /* showFrame */

	it = SWFMovie_add(mo, (SWFBlock)mc_window);
	SWFDisplayItem_setName(it, "window"); 
	SWFDisplayItem_moveTo(it, x, y);

    SWFDisplayItem_addAction(it, compileSWFActionCode(
        "_root.note('Click on \"Load PNG\" to load a PNG movie here.');"
        ),
		SWFACTION_ROLLOVER);

	SWFDisplayItem_addAction(it, compileSWFActionCode(
		"delete _level0.window.onMouseDown;"
		),
		SWFACTION_ROLLOUT);

}
Ejemplo n.º 12
0
SWFMovieClip
get_static_mc(int width, int height, int r, int g, int b)
{
  SWFShape sh = get_shape(width, height, r, g, b);
  SWFMovieClip mc = newSWFMovieClip();

  SWFMovieClip_add(mc, (SWFBlock)sh);

  SWFMovieClip_nextFrame(mc);

  return mc;

}
Ejemplo n.º 13
0
SWFMovieClip
get_dejagnu_clip(SWFBlock font, int depth, int x, int y, int width, int height)
{
	SWFMovieClip mc = newSWFMovieClip();
	SWFAction ac = get_dejagnu_actions();

	add_xtrace_function_clip(mc, font, depth, x, y, width, height);

	SWFMovieClip_add(mc, (SWFBlock)ac);

	SWFMovieClip_nextFrame(mc);

	return mc;
}
Ejemplo n.º 14
0
void swfLine(double x1, double y1, double x2, double y2, const pGEcontext gc, pDevDesc dd)
{
#ifdef SWF_DEBUG
    Rprintf("line called\n");
#endif
    pswfDesc swfInfo = (pswfDesc) dd->deviceSpecific;
    SWFShape shape = newSWFShape();
    swfSetLineStyle(shape, gc, swfInfo);
    
    SWFShape_movePenTo(shape, x1, y1);
    swfDrawStyledLineTo(shape, x2, y2, gc);
    SWFShape_end(shape);
    SWFMovieClip_add(swfInfo->currentFrame, (SWFBlock) shape);
}
Ejemplo n.º 15
0
SWFDisplayItem
add_button(SWFMovie mo)
{
	SWFDisplayItem it;
	SWFMovieClip mc, mc1;
	SWFButtonRecord br;
	SWFShape sh1, sh2, sh3, sh4, sh1a, sh2a, sh3a, sh4a;
	SWFButton bu = newSWFButton();
	mc = newSWFMovieClip();

	sh1 = make_fill_square(0, 0, 40, 40, 0, 0, 0, 0, 0, 0);
	sh1a = make_fill_square(30, 30, 5, 5, 128, 128, 128, 128, 128, 128);
	sh2 = make_fill_square(0, 0, 40, 40, 255, 0, 0, 255, 0, 0);
	sh2a = make_fill_square(30, 30, 5, 5, 128, 0, 0, 128, 0, 0);
	sh3 = make_fill_square(0, 0, 40, 40, 0, 255, 0, 0, 255, 0);
	sh3a = make_fill_square(30, 30, 5, 5, 0, 128, 0, 0, 128, 0);
	sh4 = make_fill_square(0, 0, 40, 40, 255, 255, 0, 255, 255, 0);
	sh4a = make_fill_square(30, 30, 5, 5, 128, 128, 0, 128, 128, 0);

	/* Higher depth DisplayObject is intentionally added before lower depth one */
	br = SWFButton_addCharacter(bu, (SWFCharacter)sh1a, SWFBUTTON_HIT);
	SWFButtonRecord_setDepth(br, 2);
	br = SWFButton_addCharacter(bu, (SWFCharacter)sh1, SWFBUTTON_HIT);
	SWFButtonRecord_setDepth(br, 1);

	/* Higher depth DisplayObject is intentionally added before lower depth one */
	br = SWFButton_addCharacter(bu, (SWFCharacter)sh2a, SWFBUTTON_UP );
	SWFButtonRecord_setDepth(br, 2);
	br = SWFButton_addCharacter(bu, (SWFCharacter)sh2, SWFBUTTON_UP );
	SWFButtonRecord_setDepth(br, 1);

    mc1 = newSWFMovieClip();
    br = SWFButton_addCharacter(bu, (SWFCharacter)mc1, SWFBUTTON_UP);
	SWFButtonRecord_setDepth(br, 8);

    br = SWFButton_addCharacter(bu, (SWFCharacter)mc1, SWFBUTTON_DOWN);
	SWFButtonRecord_setDepth(br, 7);

    br = SWFButton_addCharacter(bu, (SWFCharacter)mc1, SWFBUTTON_HIT);
	SWFButtonRecord_setDepth(br, 9);

	it = SWFMovieClip_add(mc, (SWFBlock)bu);
	SWFDisplayItem_setName(it, "button");
	SWFMovieClip_nextFrame(mc); /* showFrame */


	it = SWFMovie_add(mo, (SWFBlock)mc);
	return it;
}
Ejemplo n.º 16
0
void
add_button(SWFMovie mo, int x, int y, const char* label, SWFAction ac)
{
	SWFMovieClip btnclip = newSWFMovieClip();
	SWFFont font = get_default_font(mediadir);
	SWFDisplayItem it;
	SWFTextField tf = get_label(label, font);

	SWFMovieClip_add(btnclip, (SWFBlock)tf);
	SWFMovieClip_nextFrame(btnclip);

	it = SWFMovie_add(mo, (SWFBlock)btnclip);
	SWFDisplayItem_moveTo(it, x, y);
	SWFDisplayItem_addAction(it, ac, SWFACTION_PRESS);
}
Ejemplo n.º 17
0
SWFMovieClip
get_static_mc(int width, int height)
{
  SWFShape sh;
  SWFMovieClip mc;

  sh = make_fill_square (-(width/2), -(height/2), width, height, 255, 0, 0, 255, 0, 0);
  mc = newSWFMovieClip();
  SWFMovieClip_add(mc, (SWFBlock)sh);

  SWFMovieClip_nextFrame(mc);

  return mc;

}
Ejemplo n.º 18
0
void swfCircle(double x, double y, double r, const pGEcontext gc, pDevDesc dd)
{
#ifdef SWF_DEBUG
    Rprintf("circle called\n");
#endif
    pswfDesc swfInfo = (pswfDesc) dd->deviceSpecific;
    SWFShape shape = newSWFShape();
    swfSetLineStyle(shape, gc, swfInfo);
    swfSetFillStyle(shape, gc, swfInfo);
    
    SWFShape_movePenTo(shape, x, y);
    SWFShape_drawCircle(shape, r);
    SWFShape_end(shape);
    SWFMovieClip_add(swfInfo->currentFrame, (SWFBlock) shape);
}
Ejemplo n.º 19
0
static void
add_rectangle (SWFMovieClip clip, int r, int g, int b)
{
  SWFShape shape;
  SWFFillStyle fill;

  shape = newSWFShape ();
  fill = SWFShape_addSolidFillStyle (shape, r, g, b, 255);
  SWFShape_setRightFillStyle (shape, fill);
  SWFShape_drawLineTo (shape, 50, 0);
  SWFShape_drawLineTo (shape, 50, 50);
  SWFShape_drawLineTo (shape, 0, 50);
  SWFShape_drawLineTo (shape, 0, 0);

  SWFMovieClip_add (clip, (SWFBlock) shape);
}
Ejemplo n.º 20
0
static int
add_imports()
{
	int i;
	SWFMovieClip mc;
	SWFDisplayItem di;
	SWFAction ac;
	struct stat statbuf;

	mc = newSWFMovieClip();

	for (i=0; i<numimport_specs; i++)
	{
		char *spec = import_specs[i];
		char *file = strtok(spec, ":");
		char *sym;
		char unchecked = 0;

   		if ( -1 == stat(file, &statbuf) )
		{
			unchecked = 1;
		}

		printf("Importing symbols from ");
		if ( unchecked ) printf("[UNAVAILABLE] ");
		printf("%s:", file);
		fflush(stdout);
		while ((sym=strtok(NULL, ",")))
		{
			SWFCharacter ch;

			printf(" %s", sym);
			fflush(stdout);
			ch = SWFMovie_importCharacter(mo, file, sym);
			SWFMovieClip_add(mc, (SWFBlock)ch);
		}
		printf("\n");
	}

	SWFMovieClip_nextFrame(mc);
	di = SWFMovie_add(mo, (SWFBlock)mc);
	SWFDisplayItem_setName(di, "__shared_assets");
	ac = newSWFAction("__shared_assets._visible=false;");
	SWFMovie_add(mo, (SWFBlock)ac);

	return 1;
}
Ejemplo n.º 21
0
EXPORT BOOL WINAPI mc_addSound_buf(HSPEXINFO *hei, int p2, int p3, int p4)
{
	unsigned char *buf;
	int size;
	byte flags;
	SWFDisplayItem *p1;
	lstrcpy(funcname, "mc_addSound_buf");
	p1 = (SWFDisplayItem *)hei->HspFunc_prm_getv();
	buf = (unsigned char *)hei->HspFunc_prm_getv();
	size = hei->HspFunc_prm_geti();
	flags = hei->HspFunc_prm_getdi(0);
	*p1 = SWFMovieClip_add(mhsp_movieclip, newSWFSound_fromInput(newSWFInput_allocedBuffer(buf, size), flags));
	if (!mhsp_item) {
		mhsp_item = *p1;
	}
	return 0;
}
Ejemplo n.º 22
0
SWFDisplayItem
add_static_mc(SWFMovie mo, const char* name, int depth)
{
  SWFShape  sh;
  SWFMovieClip mc;
  SWFDisplayItem it;

  mc = newSWFMovieClip();
  sh = make_fill_square (300, 300, 60, 60, 255, 0, 0, 255, 0, 0);
  SWFMovieClip_add(mc, (SWFBlock)sh);  
  SWFMovieClip_nextFrame(mc);

  it = SWFMovie_add(mo, (SWFBlock)mc);
  SWFDisplayItem_setDepth(it, depth); 
  SWFDisplayItem_setName(it, name);

  return it;
}
Ejemplo n.º 23
0
void
addRedSquareExport(SWFMovie mo)
{
	SWFShape sh;
	SWFMovieClip mc;

	sh = make_fill_square (0, 0, 60, 60, 255, 0, 0, 255, 0, 0);
	mc = newSWFMovieClip();

	SWFMovieClip_add(mc, (SWFBlock)sh);
	/* This is here just to turn the clip into an active one */
	add_clip_actions(mc, "onRollOver = function() {};");
	SWFMovieClip_nextFrame(mc);

	SWFMovie_addExport(mo, (SWFBlock)mc, "redsquare");

	SWFMovie_writeExports(mo);
}
Ejemplo n.º 24
0
SWFDisplayItem
add_static_mc(SWFMovie mo, const char* name, int depth, int x, int y, int width, int height)
{
  SWFShape sh;
  SWFMovieClip mc;
  SWFDisplayItem it;

  sh = make_fill_square (-(width/2), -(height/2), width, height, 255, 0, 0, 255, 0, 0);
  mc = newSWFMovieClip();
  SWFMovieClip_add(mc, (SWFBlock)sh);

  SWFMovieClip_nextFrame(mc);

  it = SWFMovie_add(mo, (SWFBlock)mc);
  SWFDisplayItem_setDepth(it, depth); 
  SWFDisplayItem_moveTo(it, x, y); 
  SWFDisplayItem_setName(it, name);

  return it;
}
Ejemplo n.º 25
0
void swfPolyline(int n, double *x, double *y, const pGEcontext gc, pDevDesc dd)
{
#ifdef SWF_DEBUG
    Rprintf("polyline called\n");
    Rprintf("** polyline(n = %d, (x0, y0) = (%f, %f), (x1, y1) = (%f, %f))\n",
        n, x[0], y[0], x[1], y[1]);
#endif
    pswfDesc swfInfo = (pswfDesc) dd->deviceSpecific;
    SWFShape shape = newSWFShape();
    int i = 0;
    
    swfSetLineStyle(shape, gc, swfInfo);
    
    SWFShape_movePenTo(shape, x[0], y[0]);
    for(i = 1; i < n; i++)
    {
        swfDrawStyledLineTo(shape, x[i], y[i], gc);
    }
    SWFShape_end(shape);
    SWFMovieClip_add(swfInfo->currentFrame, (SWFBlock) shape);
}
Ejemplo n.º 26
0
void swfPolygon(int n, double *x, double *y, const pGEcontext gc, pDevDesc dd)
{
#ifdef SWF_DEBUG
    Rprintf("polygon called\n");
#endif
    pswfDesc swfInfo = (pswfDesc) dd->deviceSpecific;
    SWFShape shape = newSWFShape();
    int i = 0;
    
    /* First fill the polygon with no stroke, then draw polyline additionally */
    swfSetFillStyle(shape, gc, swfInfo);
    
    SWFShape_movePenTo(shape, x[0], y[0]);
    for(i = 1; i < n; i++)
    {
        SWFShape_drawLineTo(shape, x[i], y[i]);
    }
    SWFShape_drawLineTo(shape, x[0], y[0]);
    SWFShape_end(shape);
    SWFMovieClip_add(swfInfo->currentFrame, (SWFBlock) shape);
    swfPolyline(n, x, y, gc, dd);
}
Ejemplo n.º 27
0
int main(int argc, char* argv[])
{

    SWFMovie mo;
    SWFMovieClip mc1, mc2, mc3, mc4, dejagnuclip;
    SWFDisplayItem it;
    SWFAction ac;
    SWFInitAction initac;

    const char *srcdir=".";
    if (argc > 1) srcdir = argv[1];
    else {
        fprintf(stderr, "Usage: %s <mediadir>\n", argv[0]);
        return 1;
    }

    Ming_init();
    mo = newSWFMovieWithVersion(OUTPUT_VERSION);
    SWFMovie_setDimension(mo, 800, 600);
    SWFMovie_setRate (mo, 12.0);

    add_actions(mo,
            "if (!_global.hasOwnProperty('arr')) { _global.arr = []; };"
            "_global.ch = function(a, b) {"
            "   trace(a);"
            "   if (typeof(b)=='undefined' || (typeof(b)=='boolean' && b)) {"
            "       _global.arr.push(a);"
            "   };"
            "};"
            "this.onEnterFrame = function() { "
            "   _global.ch('onEnterFrame', false);"
            "};"
            );

    SWFMovie_nextFrame(mo);

    //  MovieClip 1 
    mc1 = newSWFMovieClip(); // 1 frames 

    // SWF_EXPORTASSETS 
    SWFMovie_addExport(mo, (SWFBlock)mc1, "Segments_Name");
    SWFMovie_writeExports(mo);

    //  MovieClip mc3 has two frames. In each frame a different MovieClip
    //  is placed with the name Segments.
    mc3 = newSWFMovieClip(); // 2 frames 

    //  MovieClip 2 
    mc2 = newSWFMovieClip(); // 1 frames 

    // Add mc2
    it = SWFMovieClip_add(mc3, (SWFBlock)mc2);
    SWFDisplayItem_setDepth(it, 1);
    SWFDisplayItem_setName(it, "Segments");

    // Frame 2
    SWFMovieClip_nextFrame(mc3);

    // Remove mc2
    SWFDisplayItem_remove(it);

    // Add mc1
    it = SWFMovieClip_add(mc3, (SWFBlock)mc1);
    SWFDisplayItem_setDepth(it, 1);
    SWFDisplayItem_setName(it, "Segments");

    SWFMovieClip_nextFrame(mc3);

    // End mc3


    // This is frame 1 of the main timeline

    // Put our sprite mc3 on stage.
    it = SWFMovie_add(mo, (SWFBlock)mc3);
    SWFDisplayItem_setDepth(it, 1);
    SWFDisplayItem_setName(it, "mc");

    //  mc4 is just for executing init actions.
    mc4 = newSWFMovieClip(); 
    SWFMovie_addExport(mo, (SWFBlock)mc4, "__Packages.Bug");
    SWFMovie_writeExports(mo);
    
    dejagnuclip = get_dejagnu_clip((SWFBlock)get_default_font(srcdir), 10,
                0, 0, 800, 600);
    SWFMovie_add(mo, (SWFBlock)dejagnuclip);

    ac = newSWFAction(
        "_global.loops = 0;"
        "_global.c = 0;"
        "if( !_global.Bug ) {"
        "   _global.Bug = function () {"
        "       this.onUnload = function() { "
        "           _global.ch('dynamic unload: ' + this.c);"
        "       }; "
        "       this.onLoad = function() { "
        "           _global.ch('dynamic load: ' + this.c);"
        "       }; "
        "       this.c = _global.c;"
        "       _global.ch('ctor: ' + _global.c);"
        "       _global.c++;"
        "   };"
        "};"
    );

    initac = newSWFInitAction_withId(ac, 4);
    SWFMovie_add(mo, (SWFBlock)initac);
    
    ac = newSWFAction("Object.registerClass('Segments_Name',Bug);");
    initac = newSWFInitAction_withId(ac, 1);
    SWFMovie_add(mo, (SWFBlock)initac);
    add_actions(mo, "_global.ch('Frame ' + "
                            "_level0._currentframe + ' actions: ' "
                            "+ _level0.mc.Segments.c);");

    // Frame 2 of the main timeline
    SWFMovie_nextFrame(mo);
    add_actions(mo, "_global.ch('Frame ' + "
                            "_level0._currentframe + ' actions: ' "
                            "+ _level0.mc.Segments.c);");
    
    add_actions(mo,
        "    if (_global.loops < 5) {"
        "        _global.loops++;"
        "        gotoAndPlay(2);"
        "   }"
        "   else {"
        "      delete this.onEnterFrame;"
        "      gotoAndPlay(4);"
        "   };"
        );
    
    SWFMovie_nextFrame(mo);
    
    check_equals(mo, "_global.arr.length", "20");
    check_equals(mo, "_global.arr[0]", "'Frame 2 actions: undefined'");
    check_equals(mo, "_global.arr[1]", "'ctor: 0'");
    xcheck_equals(mo, "_global.arr[2]", "'Frame 3 actions: 0'");
    xcheck_equals(mo, "_global.arr[3]", "'dynamic load: 0'");
    check_equals(mo, "_global.arr[4]", "'Frame 2 actions: 0'");
    check_equals(mo, "_global.arr[5]", "'Frame 3 actions: 0'");
    check_equals(mo, "_global.arr[6]", "'Frame 2 actions: 0'");
    check_equals(mo, "_global.arr[7]", "'ctor: 1'");
    check_equals(mo, "_global.arr[8]", "'dynamic unload: 0'");
    xcheck_equals(mo, "_global.arr[9]", "'Frame 3 actions: 0'");
    check_equals(mo, "_global.arr[11]", "'Frame 2 actions: 0'");
    check_equals(mo, "_global.arr[12]", "'Frame 3 actions: 1'");
    check_equals(mo, "_global.arr[13]", "'Frame 2 actions: 1'");
    check_equals(mo, "_global.arr[14]", "'ctor: 2'");
    check_equals(mo, "_global.arr[15]", "'dynamic unload: 1'");
    xcheck_equals(mo, "_global.arr[16]", "'Frame 3 actions: 1'");
    xcheck_equals(mo, "_global.arr[17]", "'dynamic load: 2'");
    check_equals(mo, "_global.arr[18]", "'Frame 2 actions: 1'");
    check_equals(mo, "_global.arr[19]", "'Frame 3 actions: 2'");
    xcheck_equals(mo, "_global.arr.toString()",
		    "'Frame 2 actions: undefined,ctor: 0,Frame 3 actions: 0,dynamic load: 0,Frame 2 actions: 0,Frame 3 actions: 0,Frame 2 actions: 0,ctor: 1,dynamic unload: 0,Frame 3 actions: 0,dynamic load: 1,Frame 2 actions: 0,Frame 3 actions: 1,Frame 2 actions: 1,ctor: 2,dynamic unload: 1,Frame 3 actions: 1,dynamic load: 2,Frame 2 actions: 1,Frame 3 actions: 2'");

    SWFMovie_nextFrame(mo);
    add_actions(mo, "totals(21); stop();");
    
    SWFMovie_nextFrame(mo);

    // SWF_END 
    SWFMovie_save(mo, OUTPUT_FILENAME);

    return 0;
}
Ejemplo n.º 28
0
int
main(int argc, char** argv)
{
	SWFMovie mo;
	SWFMovieClip mc1, mc2, dejagnuclip;
	SWFDisplayItem it;
	SWFShape  sh1,sh2;
	SWFAction ac1, ac2;
	int i;

	const char *srcdir=".";
	if ( argc>1 ) 
		srcdir=argv[1];
	else
	{
   		//fprintf(stderr, "Usage: %s <mediadir>\n", argv[0]);
   		//return 1;
	}

	Ming_init();
	mo = newSWFMovie();
	SWFMovie_setDimension(mo, 800, 600);
	SWFMovie_setRate (mo, 1.0);

	dejagnuclip = get_dejagnu_clip((SWFBlock)get_default_font(srcdir), 10, 0, 0, 800, 600);
	SWFMovie_add(mo, (SWFBlock)dejagnuclip);
	SWFMovie_nextFrame(mo); 

	sh1 = make_fill_square (0, 220, 60, 60, 255, 0, 0, 255, 0, 0);
	sh2 = make_fill_square (30, 250, 60, 60, 255, 0, 0, 0, 0, 0);
	
	it = SWFMovie_add(mo, (SWFBlock)sh1);  
	SWFDisplayItem_setName(it, "sh1"); 
	SWFDisplayItem_setDepth(it, 3); //place the sh1 DisplayObject at depth 3
	
	it = SWFMovie_add(mo, (SWFBlock)sh2);  
	SWFDisplayItem_setName(it, "sh2"); 
	SWFDisplayItem_setDepth(it, 3); //place the sh2 DisplayObject at depth 3 again!

	add_actions(mo, "note('Placed red shape sh1 and black shape sh2 at the same depth 3. Should both be visible, red on top.');");

	xcheck_equals(mo, "sh1", "sh2");
	check_equals(mo, "typeof(sh1)", "'movieclip'");
	xcheck_equals(mo, "typeof(sh2)", "'movieclip'");

	SWFMovie_nextFrame(mo); 

	mc1 = newSWFMovieClip();
	it = SWFMovieClip_add(mc1, (SWFBlock)sh1);
	SWFDisplayItem_setName(it, "sh1");
	SWFDisplayItem_moveTo(it, 100, 0);
	SWFMovieClip_nextFrame(mc1);

	mc2 = newSWFMovieClip();
	it = SWFMovieClip_add(mc2, (SWFBlock)sh2);
	SWFDisplayItem_setName(it, "sh1");
	SWFDisplayItem_moveTo(it, 100, 0);
	SWFMovieClip_nextFrame(mc2);

	it = SWFMovie_add(mo, (SWFBlock)mc2);  
	SWFDisplayItem_setName(it, "mc2"); 
	SWFDisplayItem_setDepth(it, 4); //place the mc2 sprite at depth 3 again!

	it = SWFMovie_add(mo, (SWFBlock)mc1);  
	SWFDisplayItem_setName(it, "mc1"); 
	SWFDisplayItem_setDepth(it, 4); //place the mc1 sprite at depth 3

	add_actions(mo, "note('Placed red sprite mc1 and black sprite mc2 at the same depth 4. Should both be visible, black on top.');");

	xcheck_equals(mo, "typeof(mc1)", "'movieclip'");
	check_equals(mo, "typeof(mc2)", "'movieclip'");
	check(mo, "mc1._name != mc2._name");
	check_equals(mo, "mc1.getDepth()", "mc2.getDepth()");

	// TODO: use SWFMovie_replace and see if it would replace
	//       only one or both DisplayObjects at target depth
	//       (not that we can trust Ming stability here..)

	add_actions(mo, "_root.totals(7); stop();");

	SWFMovie_nextFrame(mo); 


	//Output movie
	puts("Saving " OUTPUT_FILENAME );
	SWFMovie_save(mo, OUTPUT_FILENAME);

	return 0;
}
Ejemplo n.º 29
0
int
main(int argc, char** argv)
{
  SWFMovie mo;
  SWFMovieClip mc1, mc2, dejagnuclip;
  SWFDisplayItem it1, it2;
  SWFShape  sh1,sh2;

  const char *srcdir=".";
  if ( argc>1 ) 
    srcdir=argv[1];
  else
  {
      //fprintf(stderr, "Usage: %s <mediadir>\n", argv[0]);
      //return 1;
  }

  Ming_init();
  Ming_useSWFVersion (OUTPUT_VERSION);
  
  mo = newSWFMovie();
  SWFMovie_setDimension(mo, 800, 600);
  SWFMovie_setRate(mo, 6);

  // Frame 1: Place dejagnu clip

  dejagnuclip = get_dejagnu_clip((SWFBlock)get_default_font(srcdir), 10, 0, 0, 800, 600);
  SWFMovie_add(mo, (SWFBlock)dejagnuclip);
  add_actions(mo, "mc1Constructed=0; mc2Constructed=0; mc3Constructed=0; mc4Constructed=0;");
  SWFMovie_nextFrame(mo); 
  
  //
  // Frame 2: 
  //   Place red static movieClip1 DisplayObject at depth 3 (-16381)
  //   Place black static movieClip1 DisplayObject at depth 4 (-16380)
  //
  sh1 = make_fill_square (300, 300, 60, 60, 255, 0, 0, 255, 0, 0);
  mc1 = newSWFMovieClip();
  SWFMovieClip_add(mc1, (SWFBlock)sh1); 
  SWFMovieClip_nextFrame(mc1);
  
  it1 = SWFMovie_add(mo, (SWFBlock)mc1);  //add movieClip1 to the _root
  SWFDisplayItem_setDepth(it1, 3);
  SWFDisplayItem_setName(it1, "movieClip1"); //name movieClip1
  SWFDisplayItem_addAction(it1, newSWFAction(
    "_root.note(this+' constructed');"
    "_root.mc1Constructed++;"
    ), SWFACTION_CONSTRUCT);


  sh2 = make_fill_square (330, 270, 120, 120, 0, 0, 0, 0, 0, 0);
  mc2 = newSWFMovieClip();
  SWFMovieClip_add(mc2, (SWFBlock)sh2);  
  SWFMovieClip_nextFrame(mc2); 

  it2 = SWFMovie_add(mo, (SWFBlock)mc2);  //add movieClip2 to the _root
  SWFDisplayItem_setDepth(it2, 4);
  SWFDisplayItem_setName(it2, "movieClip2"); //name movieClip2
  SWFDisplayItem_addAction(it2, newSWFAction(
    "_root.note(this+' constructed');"
    "_root.mc2Constructed++;"),
      SWFACTION_CONSTRUCT);
  
  SWFMovie_nextFrame(mo);  

  // Frame3: nothing new
  SWFMovie_nextFrame(mo);  
  
  // Frame4: remove "movieClip1" and "movieClip2"
  
  SWFDisplayItem_remove(it1);
  SWFDisplayItem_remove(it2);
  SWFMovie_nextFrame(mo); 
  
  //
  // Frame5: 
  //   Place red static movieClip3 DisplayObject at depth 3 (-16381) with ratio set to 2.0
  //   Place black static movieClip4 DisplayObject at depth4 (-16380) with ratio set to 0.0
  //

  it1 = SWFMovie_add(mo, (SWFBlock)mc1);  //add movieClip3 to the _root
  SWFDisplayItem_setDepth(it1, 3);
  SWFDisplayItem_setName(it1, "movieClip3"); //name movieClip3
  SWFDisplayItem_setRatio(it1, 2.0); // It's important to set this, don't why yet.
  SWFDisplayItem_addAction(it1, newSWFAction(
    "_root.note(this+' constructed');"
    "_root.mc3Constructed++;"
    ), SWFACTION_CONSTRUCT);
  
  it2 = SWFMovie_add(mo, (SWFBlock)mc2);  //add movieClip4 to the _root
  SWFDisplayItem_setDepth(it2, 4);
  SWFDisplayItem_setName(it2, "movieClip4"); //name movieClip4
  SWFDisplayItem_setRatio(it2, 0.0); // It's important to set this, don't why yet.
  SWFDisplayItem_addAction(it2, newSWFAction(
    "_root.note(this+' constructed');"
    "_root.mc4Constructed++;"
    ), SWFACTION_CONSTRUCT);
  
  SWFMovie_nextFrame(mo); 
  
  //
  // Frame4: check, gotoAndStop(3), check..
  //
  check_equals(mo, "typeof(movieClip1)", "'undefined'");
  check_equals(mo, "typeof(movieClip2)", "'undefined'");
  check_equals(mo, "typeof(movieClip3)", "'movieclip'");
  check_equals(mo, "typeof(movieClip4)", "'movieclip'");
  check_equals(mo, "_root.mc1Constructed", "1");
  check_equals(mo, "_root.mc2Constructed", "1");
  check_equals(mo, "_root.mc3Constructed", "1");
  check_equals(mo, "_root.mc4Constructed", "1");
  
  SWFMovie_add(mo, (SWFBlock)newSWFAction( "gotoAndStop(3);"));
  
  check_equals(mo, "typeof(movieClip1)", "'movieclip'");
  check_equals(mo, "typeof(movieClip2)", "'undefined'");
  // the difference of movieClip3 and movieClip4 was caused by the ratio value
  check_equals(mo, "typeof(movieClip3)", "'undefined'");
  check_equals(mo, "typeof(movieClip4)", "'movieclip'");
  check_equals(mo, "_root.mc1Constructed", "2");
  check_equals(mo, "_root.mc2Constructed", "1");
  check_equals(mo, "_root.mc3Constructed", "1");
  check_equals(mo, "_root.mc4Constructed", "1");
  
  SWFMovie_add(mo, (SWFBlock)newSWFAction( "totals(); stop();" ));
  SWFMovie_nextFrame(mo);

  //Output movie
  puts("Saving " OUTPUT_FILENAME );
  SWFMovie_save(mo, OUTPUT_FILENAME);

  return 0;
}
Ejemplo n.º 30
0
int
main(int argc, char** argv)
{
  SWFMovie mo;
  SWFMovieClip  mc1, mc2, dejagnuclip;
  SWFDisplayItem it1, it2;
  SWFShape  sh_red;

  /* For the button duplication test */
#if MING_VERSION_CODE >= 00040400
  SWFButton but;
  SWFButtonRecord br;
#endif

  const char *srcdir=".";
  if ( argc>1 ) 
    srcdir=argv[1];
  else
  {
      fprintf(stderr, "Usage: %s <mediadir>\n", argv[0]);
      return 1;
  }

  Ming_init();
  mo = newSWFMovieWithVersion(OUTPUT_VERSION);
  SWFMovie_setDimension(mo, 800, 600);
  SWFMovie_setRate (mo, 12.0);

  dejagnuclip = get_dejagnu_clip((SWFBlock)get_default_font(srcdir), 10, 0, 0, 800, 600);
  SWFMovie_add(mo, (SWFBlock)dejagnuclip);
  add_actions(mo, "x1=0; x2=0; x3=0;");
  SWFMovie_nextFrame(mo);  /* 1st frame */

  
  mc1 = newSWFMovieClip();
  sh_red = make_fill_square (100, 300, 60, 60, 255, 0, 0, 255, 0, 0);
  SWFMovieClip_add(mc1, (SWFBlock)sh_red);  
  add_clip_actions(mc1, "stop();");
  SWFMovieClip_nextFrame(mc1);

  mc2 = newSWFMovieClip();
  sh_red = make_fill_square (100, 200, 60, 60, 255, 0, 0, 255, 0, 0);
  SWFMovieClip_add(mc2, (SWFBlock)sh_red);  
  add_clip_actions(mc2, "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"); 
  SWFDisplayItem_addAction(it2,
    compileSWFActionCode(" _root.note('onClipLoad triggered'); "
                         " _root.x1 = _root.x1 + 1; "),
    SWFACTION_ONLOAD);  
  SWFDisplayItem_addAction(it2,
    compileSWFActionCode(" _root.note('onClipEnterFrame triggered'); "
                         " _root.x2 = _root.x2 + 1; "),
    SWFACTION_ENTERFRAME);  
  SWFDisplayItem_addAction(it2,
    compileSWFActionCode(" _root.note('onClipUnload triggered'); "
                         " _root.x3 = _root.x3 + 1; "),
    SWFACTION_UNLOAD); 

  add_actions(mo, " mc1.onLoad = function () {}; "
                  " mc1.prop1 = 10; "
                  " duplicateMovieClip('mc1', 'dup1', 1); "
                  " mc2.onLoad = function () {}; "
                  " duplicateMovieClip('mc2', 'dup2', 2); " );
  SWFMovie_nextFrame(mo); /* 2nd frame */
  
  
  check_equals(mo, "mc1.prop1", "10");
  check_equals(mo, "typeof(mc1.onLoad)", "'function'");
  check_equals(mo, "mc1.getDepth()", "-16374");
  /* user defined property will not be duplicated */
  check_equals(mo, "dup1.prop1", "undefined");  
  /* user defined event handler will not be duplicated */
  check_equals(mo, "typeof(dup1.onLoad)", "'undefined'"); 
  check_equals(mo, "dup1.getDepth()", "1");
  /* check user defined onLoad */
  check_equals(mo, "typeof(mc2.onLoad)", "'function'");
  /* onClipEvent does not define a function */
  check_equals(mo, "typeof(mc2.onEnterFrame)", "'undefined'");
  /* user defined event handler will not be duplicated */
  check_equals(mo, "typeof(dup2.onLoad)", "'undefined'"); 
  check_equals(mo, "_root.x1", "2");
  check_equals(mo, "_root.x2", "2");
  SWFMovie_nextFrame(mo); /* 3rd frame */
  
  SWFDisplayItem_remove(it1);
  SWFDisplayItem_remove(it2);
  add_actions(mo, " dup2.removeMovieClip(); ");

  SWFMovie_nextFrame(mo); /* 4th frame */
  
#if MING_VERSION_CODE >= 00040400

  /* Create a button, add it to mc1 */
  but = newSWFButton();
  br = SWFButton_addCharacter(but, (SWFCharacter)sh_red, SWFBUTTON_UP);
  SWFButtonRecord_setDepth(br, 10);
  it1 = SWFMovie_add(mo, (SWFBlock)but);
  SWFDisplayItem_setName(it1, "button");

  /* Sanity check */
  check_equals(mo, "typeof(button)", "'object'");

  add_actions(mo,
          "trace(button);"
          "dupl = MovieClip.prototype.duplicateMovieClip;"
          "button.dupl = dupl;"
          "o = { x: 4 };"
          "d = button.dupl('buttdup', 201, o);"
          );
  
  xcheck_equals(mo, "typeof(d)", "'object'");
  xcheck_equals(mo, "'' + _root.buttdup", "'_level0.buttdup'");
  check_equals(mo, "_root.buttdup", "d");
  
  /* initobj not used */
  check_equals(mo, "_root.buttdup.x", "undefined");
#endif

  add_actions(mo,
          "t = new Object();"
          "t.dupl = dupl;"
          "o2 = { x: 44 };"
          "d2 = t.dupl('objdup', 202, o2);"
          "trace(_root.objdup);"
          );

  /* Does not work on plain objects */
  check_equals(mo, "typeof(d2)", "'undefined'");
  check_equals(mo, "typeof(_root.objdup)", "'undefined'");

  SWFMovie_nextFrame(mo); /* 5th frame */

  check_equals(mo, "_root.x1", "2");
  check_equals(mo, "_root.x2", "3");
  check_equals(mo, "_root.x3", "2");  
  add_actions(mo, " _root.totals(); stop(); ");
  SWFMovie_nextFrame(mo); /* 5th frame */
  //Output movie
  puts("Saving " OUTPUT_FILENAME );
  SWFMovie_save(mo, OUTPUT_FILENAME);

  return 0;
}