Masks

Someone posted this on another forum:

http://reticul.free.fr/flash/ – some bare breasts here but it’s not the point (really…)

And the code:

//
makeCadre("http://www.flashxpress.net/images/vache.jpg", 1);
makeCadre("http://www.flashxpress.net/images/vache.jpg", 2);
checkLoad();
//
function makeCadre(fichier, indice) {
    newMC = "img"+indice;
    this.createEmptyMovieClip(newMC, indice);
    this[newMC].createEmptyMovieClip('image', 1);
    this[newMC].image.loadMovie(fichier);
    this[newMC].createEmptyMovieClip('cache', 2);
    with (this[newMC].cache) {
        beginFill(0xFF0000, 0);
        lineTo(1, 0);
        lineTo(1, 400);
        lineTo(0, 400);
        endFill();
    }
}
function checkLoad() {
    this.onEnterFrame = function() {
        if ((this.img1.image.getBytesLoaded() == this.img1.image.getBytesTotal() && this.img1.image.getBytesLoaded()>0) && (this.img2.image.getBytesLoaded() == this.img2.image.getBytesTotal() && this.img2.image.getBytesLoaded()>0)) {
            img1.image.setMask(img1.cache);
            img2.image.setMask(img2.cache);
            largeur1 = 0;
            largeur2 = img1.image._width;
            monIt = setInterval(flowEffect, 50);
            this.onEnterFrame = null;
        }
    };
}
function flowEffect() {
    img2._x = largeur1-0.5;
    img1.cache._width = largeur1;
    img2.image._x = -largeur1;
    img2._xscale = largeur2*100;
    largeur2--;
    largeur1++;
    if (largeur2<0) {
        clearInterval(monIt);
    }
}

I love that kind of things, just thought I’d share… =)

That effect is pretty nifty :slight_smile:

whoa, that’s hot.

I was talking about the mask effect!! :trout:

oh, whu?

:trout:

thats amazing…

the flash effect is pretty cool too

:stuck_out_tongue:

lol… i love that :slight_smile:

[edit]

hm… can you actually call a function before it’s declared? :q:

*Originally posted by ahmed *
**lol… i love that :slight_smile:

[edit]

hm… can you actually call a function before it’s declared? :q: **
:sure:

ahmed, hasn’t anyone taught you about stacks? :stuck_out_tongue:

When Flash compiles the code, it pushes everything onto a stack according to importance. Functions are up there. You can bury prototypes deep within the deepest depths of movieclips within movieclips and you would still be able to call the prototype from the first frame of the main stage.

Once the prototypes and functions are defined, Flash moves down the stack (functions, events, loops, etc).

I know sen (:love:**) is gonna correct me in some sense or another…:sigh:

lol, i didn’t know that… thanks for clearing it up! :slight_smile:

cool, mon frere!
c koi, cet “autre forum”?
nice chicks, nice code!

C’est www.flashxpress.net/forum

C’est dans la partie Flash MX Actionscript, un gars qui s’appelle Max3d :slight_smile:

Kirupaforums.com is an international forum, please don’t use your native language. This may eventually get you banned. Let this be a warning!

cheers!
ahmed :bad:

I’ll strike first, then :evil:

Pourquoi? C’est juste français! :stuck_out_tongue:

Pom, tu aimes mon mal français? C’est terrible, non?

kors et mærkeligt sprog… :sure:

Ka’ I så opføre jer ordentligt!! :evil:

… as for the functions thing :wink: :love:

its just a matter of syntax where Flash will defined

function functionName(){

before

functionName = function(){

the second version following order of operations in definition
So if you’re used to using functionName = function, your functions can’t be used before their definition. However, at the same time, function functionName(){ function declarations can’t be defined within other operations. i.e.

go()

function go(){
	trace("GO!")
	if (true){
		function newFunc(){
			trace("YES!")
		}
	}else{
		function newFunc(){
			trace("NO!")
		}
	}
	
	newFunc()
}

/* output:
GO!
*/

lol, if (true)

:sure:

Thor >> Your French is perfect and you know it :stuck_out_tongue:

Sen >> Now that is ****ed up :-\

*Originally posted by senocular *
**
its just a matter of syntax where Flash will defined
**

wheew, I did that as soon as I woke up … lol

*Originally posted by Ilyas Masa *
Thor >> Your French is perfect and you know it :stuck_out_tongue:
Thanks, pom. Actually, I don’t know it. Since I don’t have my teacher drilling every è’s and é’s and a misplaced ‘s’ in the ‘tu’ form of a verb and other whatnots, I don’t really know if anything I say in french is correct. I haven’t practiced in so long…