I recreated the flag effect from Lifaros ( http://www.actionscript.cl ) for someone on another board, but completely scripted. All you have to do is change the first line of code (put the linkage name of your clip instead of girlie).
IMPORTANT NOTE: the registration point of the clip should be the top left corner.
/*** Author: Ilyas USAL (pom)
Credits: lifaros
Date: 20/01/2003
TRANSLATED!! ***/
/*** Linkage name of the clip ***/
clip="girlie";
/*** Constants ***/
startX=10; // position of left hand of image
startY=10; // position of left hand of image
amplitude=5; // amplitude of oscillations
angleIncrement=1; // speed of oscillations
periode=8; // period of oscillations
clips=[]; // array that will contain the duplicated clips
/*** Functions
- init: initialize variables width and height
- drawMask: draws a mask of given width and height
- oscillate: makes a slice oscillate
- splitImage: splits the image into a given amount of slices
***/
function init(){
this.createEmptyMovieClip("container",0);
container.attachMovie(clip,clip,0);
container._x=startX;
container._y=startY;
width=container._width;
height=container._height;
container.removeMovieClip();
}
function drawMask(targ,width,height){
var mask=targ.createEmptyMovieClip("mask",1);
mask.beginFill(0,100);
mask.lineTo(width,0);
mask.lineTo(width,height);
mask.lineTo(0,height);
mask.endFill();
return mask;
}
function oscillate(targ){
targ._y=startY+amplitude*Math.sin(targ.angle/periode);
targ.angle+=angleIncrement;
}
function splitImage(slices){
var j=1;
for (var i=0;i < slices;i++){
clips.push(createEmptyMovieClip("container"+j,j++));
clips*.attachMovie(clip,clip,0);
clips*._x=startX;
clips*._y=startY;
clips*.angle=i;
var index=width/slices;
var mask=drawMask(clips*,index,height);
mask._x=i*index;
mask._y=0;
clips*.setMask(mask);
clips*.onEnterFrame=function(){
// a=this._name.substr(9);
// this._y+= a%2 ? 1 : -1;
oscillate(this);
}
}
}
/*** Run the functions ***/
init();
splitImage(30);
Sorry, it’s in French :beam:
Edit: now available in English
Well you could create create individual swfs for each flag and then load them into another swf. It would take time but I think you could probably get in a groove and get in done in an hour or less.
Creating engaging and entertaining content for designers and developers since 1998.