Check this: flag effect :)

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 :slight_smile:

Argh! I don’t know French! Time to get out the old English - French dictionary… :slight_smile:

could you post your example?

I want to see what it looks like!

All right, I’ll translate it.

Here’s an example (with a couple of scrollbars):

:beam:

its good as an MX version - keeps it simple :slight_smile:

wow - great work!!

Wow… that is excellent Ilyas!!!

It looks really good if you split it into 100 pieces and put the quality on low.

wow POm ,…oh
I mean ilyaslamasse :trout:

Can anyone help me, I’m trying to do that effect but I can’t :h:

Ilyas, that is some excellent work everywhere.

Right-click on “Bandera 2” in the Library, and go to Linkage. Click the first option (the Linkage name will be Bandera 2). Then export.

You don’t need the clip on the stage because it gets put there by the AS.

(to make it bigger, enlarge it inside the MC)

Thanks, now one more question, I need to load the jpg file from an HTTP location so here is the .FLA file again

What I did was this:

loadMovie(“http://www.macromedia.com/images/shared/product_boxes/80x92/box_contribute_80x92.jpg”, Pelicula1);

/*** Linkage name of the clip ***/
clip= attachMovie(Pelicula1, Pelicula1);

Can you help me?

I’m not sure it will work with an externally loaded picture. Why not just put the picture in the swf?

btw cool effect Ilyas

The problem is that I wanna use it for all the flags of all countries in the swf file so that’s why I’m trying to load it externally

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.