私の環境
私がMingをコンパイルした環境はWindowsXP上でMSYSとMinGWを用いたものです。
簡単な例
#include<stdio.h>
#include"src/ming.h"
int main()
{
SWFMovie movie;
SWFShape shape;
SWFDisplayItem item;
SWFMovieClip sprite;
SWFFill fill;
SWFAction action;
Ming_useSWFVersion(6);
movie = newSWFMovie();
shape = newSWFShape();
sprite = newSWFMovieClip();
action = compileSWFActionCode(
"this._x =100;this._y=100;this.onEnterFrame=function(){_x +=1;};");
//use Shape and create circle
fill = SWFShape_addSolidFill(shape,255,0,0,150);
SWFShape_setRightFill(shape,fill);
SWFShape_drawCircle(shape,2.1);
SWFMovieClip_add(sprite,(SWFBlock)shape);
SWFMovieClip_add(sprite,(SWFBlock)action);
SWFMovieClip_nextFrame(sprite);
SWFMovie_add(movie,(SWFBlock)sprite);
SWFMovie_save(movie,"action.swf",-1);
}
こんなんできます
|
Spriteの例
#include<stdio.h>
#include"src/ming.h"
int main()
{
int i;
SWFMovie movie;
SWFDisplayItem item;
SWFMovieClip sprite;
SWFShape shape;
SWFFill fill;
SWFMovieClip attached;
SWFAction action;
SWFAction attached_act;
SWFCharacter cha;
Ming_useSWFVersion(6);
movie = newSWFMovie();
shape = newSWFShape();
sprite = newSWFMovieClip();
attached =newSWFMovieClip();
action = compileSWFActionCode(
"var i=0; _root.onEnterFrame =function(){if(i<50){_root.attachMovie('mc','mc'+i,i); _root['mc'+(i-1)]._y+=i*3;_root['mc'+(i-1)]._x+=i*3;i++;}};"
);
attached_act = compileSWFActionCode(
"_x =100;_y=10;onEnterFrame=function(){_x +=4*Math.random()*Math.random()-4*Math.random()*Math.random();_y+= 4*Math.random()*Math.random()-4*Math.random()*Math.random();};"
);
fill = SWFShape_addSolidFill(shape,255,0,0,150);
SWFShape_setRightFill(shape,fill);
SWFShape_drawCircle(shape,2.1);
SWFMovieClip_add(attached,(SWFBlock)shape);
SWFMovieClip_add(attached,(SWFBlock)attached_act);
SWFMovieClip_nextFrame(attached);
SWFMovieClip_add(sprite,(SWFBlock)attached);
SWFMovieClip_nextFrame(sprite);
SWFMovie_addExport(movie,(SWFBlock)attached,"mc");
SWFMovie_writeExports(movie);
SWFMovie_add(movie,(SWFBlock)action);
SWFMovie_nextFrame(movie);
SWFMovie_save(movie,"f.swf",-1);
}
こんなんできます
目標
SWFMovie_importCharacterの使い方がいまいちわからない。
|