public function draw(source:IBitmapDrawable, matrix:Matrix = null,
colorTransform:ColorTransform = null, blendMode:String = null,
clipRect:Rectangle = null, smoothing:Boolean = false):void {
drawWithQuality(source, matrix, colorTransform,
blendMode, clipRect,
smoothing);
}
public function drawWithQuality(source:IBitmapDrawable,
matrix:Matrix=null, colorTransform:ColorTransform=null,
blendMode:String=null, clipRect:Rectangle=null, smoothing:Boolean=false,
quality:String=null):void {
if (source is BitmapData){
var bmd:BitmapData = source as BitmapData;
fromImage(bmd.ctx);
}else if(source is TextField){
var tf:TextField = source as TextField;
tf.__draw(ctx,matrix);
}else if (source is Sprite){
var sp:Sprite = source as Sprite;
sp.graphics.draw(ctx, sp.worldMatrix, 1,
sp.blendMode,
sp.transform.colorTransform);
}else if (source is Shape){
var sha:Shape = source as Shape;
sha.graphics.draw(ctx, sha.worldMatrix, 1,
sha.blendMode,
sha.transform.colorTransform);
}
}
pls use this code.
or just input a new matrix.
package
{
import flash.display.*;
import flash.events.Event;
public class TestDraw extends Sprite
{
public function TestDraw ()
{
var shape : Shape = new Shape ();
shape.graphics.lineStyle (1, 0xFFFFFF, 0.5);
shape.graphics.beginFill (0xFF0080, 0.75);
shape.graphics.drawCircle (100, 100, 100);
//addChild (shape);
var data : BitmapData = new BitmapData (300, 300, true,
0x800080FF);
data.draw (shape);
var bitmap : Bitmap = new Bitmap (data);
bitmap.x = bitmap.y = 10;
addChild (bitmap);
/*
stage.addEventListener (Event.RESIZE, resize);
}
private function resize (e : Event) : void
{
graphics.clear ();
graphics.beginFill (Math.random () * 0xFFFFFF, 0.75);
graphics.drawRect (10, 10, stage.stageWidth - 20,
stage.stageHeight -
20);
*/
}
}
}
--
View this message in context:
http://apache-flex-development.2333347.n4.nabble.com/why-can-not-open-this-code-tp53169p53185.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.