Hello.
I have a problem and im not sure how to solve it (with the BlitMask technic).
Currently Im trying to create a mask (which I can more around the stage) that shows only a fragment (lets say 50x50) of the main movie clip.The main MC (lets name it Rainbow) has elements that are moving in it (like i black ball that goes from 1 corner to the other corner and then repeats that infinitely ).
So what it is supposed to be happening is this: There is the main MC which stays at stage.x and stage.y and then there is my little new element (lets name it frac ( from fraction )), which i can move freely anywhere on the stage. This element (frac) shows that portion of the main MC every single frame, so when the ball in the main MC moves through that area ( the area that frac specified to watch ), frac shows that movement in itself.
I currently have made it work with using flash.geom.Matrix; and bitmapData;.
it is something like this:
public class Main extends MovieClip
{
private var bmd:BitmapData;
private var countainer:Sprite = new Sprite();
private var bm:Bitmap = new Bitmap();
private var myRainbow:Rainbow = new Rainbow();//the moving MC
public function Main()
{
this.addChild( myRainbow )
myRainbow.x = stage.x;
myRainbow.y = stage.y;
bmd = new BitmapData( 50, 50 );
bm.x = 0;
bm.y = 0
countainer.addChild( bm );
addChild( countainer )
countainer.x = 100
countainer.y = 100
addEventListener(Event.ENTER_FRAME, onFrame);
addEventListener(MouseEvent.MOUSE_UP, drop);
}
private function onFrame( event:Event )
{
bmd.draw( myRainbow, new Matrix( 1, 0, 0, 1, 0, 0 ), null, null, new Rectangle( 0, 0, 50, 50 ) );
// the last two numbers of the Matrix show the starting point of where the mask will show
bm.bitmapData = bmd;
}
}
But with this solution the performance is extremely poor.
So I searched the net in a more performance friendly solution and found the BlitMask technic.
So is there a way of doing this with the BlitMask???
to be more clear I`ve uploaded the fla- file that I`ve made with the code above so you can see what Im doing
the link is : https://drive.google.com/file/d/0B5u6hrR2w7UEYmFHbHdlWnlWNjA/edit?usp=sharing