views:

2255

answers:

2

Hi,

I have a Canvas A with scrollpolicy on, A has one unique Child canvas B which has no scrolling.

A is the container of B which is a whiteboard like tool.

If i dont set width and height of B, he will resize accordingly to A size, up to a certain point where A has scrollbars which is the good Behavior.

However since B canvas seems to be resized on the fly whenever I dynamically add or move an element it gets a little bit slower.

I can solve it by setting a percent width and height of 100% to B, when i do a

 var bmd:BitmapData = new BitmapData(
                B.width, B.height, false, 0xffffff
            );
 bmd.draw(B);

B would be actually A view (with scrollbars).

If i remove percent height and width it will be the whole canvas as expected.

What would be perfect is keeping the percent height and width while child width is smaller than parent A width. When B width become larger then A the percent width should stop.

In which function of B should i handle such code ? is it updatelist() ?

THanks !

A: 

It might be easier if you just used pixel values and subtracted the width of the scrollbar.

CookieOfFortune
A: 

I had the same issue;

i solved it listening an event (creationComplete after creation or other event (resizing...)), and setting my component width according to the measuredWidth

myContainer.width = myContainer.measuredWidth

This worked for me, hope it can help you :)

Tames