1

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

Ayman
  • 95
  • 2
  • 10
  • 2
    I must be blind the only difference is see between the 3 images is one has a gray area in the background no blur effect – The_asMan Mar 17 '11 at 19:26
  • yes i know it's a little difference between both of them, but you can visit http://palwork.net/publisher/v2/ and see the ugly result when you try to turn the page – Ayman Mar 17 '11 at 19:29
  • I'm not seeing it either, but I would try doing this: render the text as normal for the duration of the page view phase and only draw it to bitmap during the flip phase. That way you minimise the visual impact of any blur _and_ it stays selectable (useful in the case of a recipe) – Oliver Turner Mar 18 '11 at 07:01

4 Answers4

2

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.

Ayman
  • 95
  • 2
  • 10
1

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

Saad
  • 26,316
  • 15
  • 48
  • 69
  • doen't work, i tried to clear it and redraw it again and the same problem still showing up, please check the problem http://palwork.net/publisher/v2 and try to turn a page and see how ugly it show up – Ayman Mar 17 '11 at 19:34
  • Is page the MovieClip that contains the text? because I try cache the text as a bitmap, then add it to the overall page. also try to enable bitmap smoothing: bitmap.smoothing = true; – Saad Mar 17 '11 at 22:44
1

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.

kachingy123
  • 197
  • 1
  • 12
  • yes you may see the website in small size, see it in fullscreen for example so the book will change it location and then try to turn a page and you will see thad effect. – Ayman Mar 17 '11 at 21:22
0

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

FilippoG
  • 546
  • 3
  • 16