Is there a way to make DrawTriangles use anti aliasing like it does in the native flash UI.
Code below uses a movieclip on the stage called “testBitmap_mc” that has stuff inside it and then it draws a triangle and flips it.
import flash.display.Bitmap;
import flash.display.BitmapData;
var myBitmapData:BitmapData = new BitmapData(testBitmap_mc.width+1, testBitmap_mc.height, true, 0x00ffffff);
myBitmapData.draw(testBitmap_mc,null,null,null,null,true);
removeChild(testBitmap_mc);
var bitmap:Sprite = new Sprite();
addChild(bitmap);
drawBitmap(myBitmapData, 0);
var counter:Number = 0;
var forwards:Boolean = true;
bitmap.x = testBitmap_mc.x;
bitmap.y = testBitmap_mc.y;
function drawBitmap(myBitmapData:BitmapData, percentDone:Number)
{
//var bitmap:Bitmap = new Bitmap(myBitmapData);
bitmap.graphics.clear();
bitmap.graphics.beginBitmapFill(myBitmapData);
bitmap.graphics.drawTriangles(
Vector.<Number>([myBitmapData.width *0 + myBitmapData.width * percentDone ,myBitmapData.height *0+ myBitmapData.height*percentDone * .25, myBitmapData.width * .7,0, 0,myBitmapData.height * .7]),
Vector.<int>([0,1,2]),
Vector.<Number>([0,0, .7,0, 0,.7]));
//bitmap.graphics.drawRect(0,0, myBitmapData.width, myBitmapData.height);
bitmap.graphics.endFill();
}
addEventListener(Event.ENTER_FRAME, rollShard);
function rollShard(e:Event)
{
if(forwards)
{
counter+=.05;
if(counter >=1)
{
forwards = false;
counter -=.05;
}
}
else
{
counter-=.05;
if(counter <=-1)
{
forwards = true;
counter +=.05;
}
}
drawBitmap(myBitmapData, counter);
}