Ayman
Ayman

Reputation: 95

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

Upvotes: 1

Views: 2431

Answers (4)

FilippoG
FilippoG

Reputation: 586

Sample at x2 size. Then scale the bitmap at 50%. It will look exactly like the original clip.

Upvotes: 0

Ayman
Ayman

Reputation: 95

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.

Upvotes: 2

kachingy123
kachingy123

Reputation: 197

I can't comment yet due to lack of rep, so I kinda have to put it here...

When I go to the link given, the problem being described does not appear.

Am I missing something?

Addition: You may try to adjust the sharpness of the textfield?

Also, perhaps consider when the bitmap is being made because everything might not be adjusted, but the bitmap may be created at that point?

Note: I still have not been able to get the grey that you showed in your post.

Upvotes: 1

Saad
Saad

Reputation: 28486

are you refreshing the bg? so before you draw btmd redraw the BG to clear the previously drawn bitmap data

Upvotes: 1

Related Questions