If the size of canvas set in the MXML markup, some part of the components that go beyond the boundaries of canvas not displayed. If the canvas size to change dynamically(canvas.width, canvas.height), canvas boundaries are virtually absent. How to dynamically change the size of the Canvas?
A:
Do you really need a canvas? If you need sizes changed dinamically try to put your content inside a VBox for example ( of any relative container ) and use minWidth, minHeight to set it up, otherwise, Canvas is a component so is whould have width and height properties.
e.g.
<Canvas id="myCanvas" width="400" height="300">
<!-- content here -- >
</Canvas>
George Profenza
2009-09-04 01:07:50
A:
override the canvas's updateDisplayList function.
override protected function updateDisplayList(w:Number,h:Number):void {
super.updateDisplayList(w,h);
this.setActualSize((child1.width+child2.width), Math.max(child1.height,child2.height));
}
Alternatives are to override the canvas measuredHeight/measuredWidth getters. Or override the "measure" function.
If scrolling is what you want, you have horizontalSCrollPolicy
/verticalScrollPolicy
properties of the canvas.
Lots of different solutions depending on your exact problem.
Glenn
2009-09-04 02:47:15