Babaloo
April 14th, 2009, 09:42 AM
Hi everyone :krazy:
I'm extending a tutorial from Flashtuts by Michael Chen (http://flash.tutsplus.com/tutorials/effects/create-a-slick-image-revealer-in-flash-using-actionscript-3/).
My goal is to have the grid fill in random, masking the image for a transition, as the famed Mask Effect transition from Flash-filter.
This is what i got so far:
http://joaomiguelaliano.com/flush/banner.html
AS3:
var maskImg:MovieClip = new MovieClip();
addChild(maskImg);
imageToReveal_mc.mask = maskImg;
imageToReveal_mc.cacheAsBitmap=true;
maskImg.cacheAsBitmap=true;
var xPos:Number = imageToReveal_mc.x;
var yPos:Number = imageToReveal_mc.y;
var spacingX:Number = 70;
var spacingY:Number = 70;
var maxXPos:Number = imageToReveal_mc.x + imageToReveal_mc.width + spacingX;
var maxYPos:Number = imageToReveal_mc.y + imageToReveal_mc.height + spacingY;
function revealImage():void {
var ca:quadroAnimado = new quadroAnimado();
ca.x = xPos;
ca.y = yPos;
maskImg.addChild(ca);
var randoX:Number = Math.floor(Math.random()*10);
var randoY:Number = Math.floor(Math.random()*4);
for (var i:Number = 1; i < 50; i++) {
xPos = spacingX*randoX;
yPos = spacingY*randoY;
}
trace("X: "+randoX);
trace("Y: "+randoY);
//trace("For: "+i);
}
var timer:Timer = new Timer(20);
timer.addEventListener(TimerEvent.TIMER, onTimer);
timer.start();
function onTimer(evt:TimerEvent):void {
revealImage();
}So I can fill in the grid, but I need to id the recticles so that they don't stack n top of each other, filling in only where the mask's still missing, until the transiton is completed.
I'm looking into miniml's grid (http://www.reflektions.com/miniml/template_permalink.asp?id=276), maybe I'll find something there, tho I'm not sure it's AS3, which I'm trying to catch up to.
I'm extending a tutorial from Flashtuts by Michael Chen (http://flash.tutsplus.com/tutorials/effects/create-a-slick-image-revealer-in-flash-using-actionscript-3/).
My goal is to have the grid fill in random, masking the image for a transition, as the famed Mask Effect transition from Flash-filter.
This is what i got so far:
http://joaomiguelaliano.com/flush/banner.html
AS3:
var maskImg:MovieClip = new MovieClip();
addChild(maskImg);
imageToReveal_mc.mask = maskImg;
imageToReveal_mc.cacheAsBitmap=true;
maskImg.cacheAsBitmap=true;
var xPos:Number = imageToReveal_mc.x;
var yPos:Number = imageToReveal_mc.y;
var spacingX:Number = 70;
var spacingY:Number = 70;
var maxXPos:Number = imageToReveal_mc.x + imageToReveal_mc.width + spacingX;
var maxYPos:Number = imageToReveal_mc.y + imageToReveal_mc.height + spacingY;
function revealImage():void {
var ca:quadroAnimado = new quadroAnimado();
ca.x = xPos;
ca.y = yPos;
maskImg.addChild(ca);
var randoX:Number = Math.floor(Math.random()*10);
var randoY:Number = Math.floor(Math.random()*4);
for (var i:Number = 1; i < 50; i++) {
xPos = spacingX*randoX;
yPos = spacingY*randoY;
}
trace("X: "+randoX);
trace("Y: "+randoY);
//trace("For: "+i);
}
var timer:Timer = new Timer(20);
timer.addEventListener(TimerEvent.TIMER, onTimer);
timer.start();
function onTimer(evt:TimerEvent):void {
revealImage();
}So I can fill in the grid, but I need to id the recticles so that they don't stack n top of each other, filling in only where the mask's still missing, until the transiton is completed.
I'm looking into miniml's grid (http://www.reflektions.com/miniml/template_permalink.asp?id=276), maybe I'll find something there, tho I'm not sure it's AS3, which I'm trying to catch up to.