apache-flexactionscript-3flash-cs4bitmapdata

in AS3, Drawing TextField into BitmapData get a bad effect when parent get moved ( changing x, y )?


having a problem while drawing a complex combinations of TextFields into BitmapData in as3, and i can't understand the reason for that, so please help me with it.

The problem happens when i change the parent's (x,y) or (width, height) and the drawn object got a bad effect like left blur.

I attached an image of what going, and here is a snippet of the code :

//defining TextField object
var textField:TextField = new TextField();
textField.embedFonts = true;
textField.width = width;
textField.selectable = false;
textField.border = true;

var stylesheet:StyleSheet = new StyleSheet();
stylesheet.parseCSS(css);
textField.styleSheet = stylesheet;


textField.multiline = true;
textField.autoSize   = TextFieldAutoSize.LEFT;
textField.antiAliasType  = AntiAliasType.ADVANCED;
textField.wordWrap = true;
textField.condenseWhite = true;

textField.htmlText = "<p>"+text+"</p>";

//after adding it to a MovieClip i draw it into a BitmapData
var btmd:BitmapData = new BitmapData(width, height);
btmd.draw(this.page,null,null,null,null, true);

enter image description here


Solution

  • Thanks for your help,

    the reason behind this ugly problem is setting the x, y for the Object (or) parents with long float values. the solve is by setting the x, y to int.

    In other words,

    BitmapData.draw( obj );
    

    obj.x, obj.y should be Integers, or an ugly effect will be affected the drawn object.