Director
Resize Events
The director object can listen to window resize events and thus adapt itself to the new conditions, either by conforming its size, or by scaling accordingly.
The resize values are defined in CAAT.Foundation.Director and are the following:
- RESIZE_WIDTH, only conforms director's width.
- RESIZE_HEIGHT, only conforms director's height.
- RESIZE_BOTH, resizes both width and height.
- RESIZE_PROPORTIONAL, the director scales accordingly. Sample (opens a new window)
To enable the resizing event listening, a call to director's enableResizeEvents(resize_constant, onResizeCallback).
This method, will cause a director, and its contained scenes resize. But has no idea on how to make your scene actors conform to the new size. The onResizeCallback function is comes handy for this purpose, since you have the opportunity to modify your actor's dimension, position or desired attributes upon being called.
The callback function signature is as follow: function( director, newWidth, newHeight ).