# Check this: flag effect :)

**URL:** https://forum.kirupa.com/t/check-this-flag-effect/11719
**Category:** flash
**Created:** [January 21, 2003, 1:55pm UTC](https://forum.kirupa.com/t/check-this-flag-effect/11719 "2003-01-21T13:55:09Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![pom](https://avatars.discourse-cdn.com/v4/letter/p/f07891/32.png) [@pom](https://forum.kirupa.com/u/pom)
#### Post date: [January 21, 2003, 1:55pm UTC](https://forum.kirupa.com/t/check-this-flag-effect/11719/1 "2003-01-21T13:55:09Z")

</div>

I recreated the flag effect from Lifaros ( [http://www.actionscript.cl](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.

```auto
/*** 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 🙂

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [January 21, 2003, 1:57pm UTC](https://forum.kirupa.com/t/check-this-flag-effect/11719/2 "2003-01-21T13:57:24Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [January 21, 2003, 1:59pm UTC](https://forum.kirupa.com/t/check-this-flag-effect/11719/3 "2003-01-21T13:59:01Z")

</div>

could you post your example?

I want to see what it looks like!

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [January 21, 2003, 2:01pm UTC](https://forum.kirupa.com/t/check-this-flag-effect/11719/4 "2003-01-21T14:01:09Z")

</div>

All right, I’ll translate it.

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [January 21, 2003, 2:02pm UTC](https://forum.kirupa.com/t/check-this-flag-effect/11719/5 "2003-01-21T14:02:30Z")

</div>

:beam:

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [January 21, 2003, 2:09pm UTC](https://forum.kirupa.com/t/check-this-flag-effect/11719/6 "2003-01-21T14:09:01Z")

</div>

its good as an MX version - keeps it simple 🙂

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [January 21, 2003, 3:39pm UTC](https://forum.kirupa.com/t/check-this-flag-effect/11719/7 "2003-01-21T15:39:39Z")

</div>

wow - great work!!

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [January 22, 2003, 3:20pm UTC](https://forum.kirupa.com/t/check-this-flag-effect/11719/8 "2003-01-22T15:20:32Z")

</div>

Wow… that is excellent Ilyas!!!

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [January 23, 2003, 8:12am UTC](https://forum.kirupa.com/t/check-this-flag-effect/11719/9 "2003-01-23T08:12:58Z")

</div>

wow POm ,…oh  
I mean ilyaslamasse :trout:

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 8, 2004, 10:31pm UTC](https://forum.kirupa.com/t/check-this-flag-effect/11719/10 "2004-09-08T22:31:29Z")

</div>

> [@jimhere](#):
>
> You gotta paste the code in a frame and library/linkage any picture MC “girlie”. Yep, girlie.

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 8, 2004, 11:16pm UTC](https://forum.kirupa.com/t/check-this-flag-effect/11719/11 "2004-09-08T23:16:33Z")

</div>

Ilyas, that is some excellent work everywhere.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 8, 2004, 11:48pm UTC](https://forum.kirupa.com/t/check-this-flag-effect/11719/12 "2004-09-08T23:48:02Z")

</div>

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)

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 9, 2004, 12:00am UTC](https://forum.kirupa.com/t/check-this-flag-effect/11719/13 "2004-09-09T00:00:25Z")

</div>

> [@jimhere](#):
>
> 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](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?

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 9, 2004, 12:10am UTC](https://forum.kirupa.com/t/check-this-flag-effect/11719/14 "2004-09-09T00:10:58Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 9, 2004, 2:12pm UTC](https://forum.kirupa.com/t/check-this-flag-effect/11719/15 "2004-09-09T14:12:22Z")

</div>

> [@CanadianGuy](#):
>
> 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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 9, 2004, 7:56pm UTC](https://forum.kirupa.com/t/check-this-flag-effect/11719/16 "2004-09-09T19:56:39Z")

</div>

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.
