Hi coders, I am trying to get a mirror effect to work. The effect has a
number of x and y reflections in a set sized mc (this case a 240x180), which
is intended to result in a tiled effect (the more reflections the smaller
the tile)
Senoculars tutorial on the matrix is pretty comprehensive but I can't quite
get my creation to work, below is the function i have written so far, if
anyone could enlighten me would be great:
public function mirror(mc:MovieClip):Void
{
var mcSnapshot:BitmapData=new BitmapData(240,180,false);
mcSnapshot.draw(mc);
var mcMirror=mc.createEmptyMovieClip('mcMirror',1);
var mirrorBmpd:BitmapData=new BitmapData(240,180,false);
var totalReflections=_reflectionsInX*_reflectionsInY;
var xUnit=240/_reflectionsInX, yUnit=180/_reflectionsInY;
var a=1/_reflectionsInX;
var d=1/_reflectionsInY;
for(var i=0; i<totalReflections; i++){
var xc=i%_reflectionsInX;
var yc=Math.floor(i/_reflectionsInY);
var xReverse = (xc%2) ? 1 : -1;
var yReverse = (yc%2) ? 1 : -1;
var m:Matrix=new
Matrix(a*xReverse,0,0,d*yReverse,xc*xUnit,yc*yUnit);
mirrorBmpd.draw(mcSnapshot,m);
}
mcMirror.attachBitmap(mirrorBmpd,1);
}
Best,
Pete
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com