In any flex application you run on web it's height is default set to display html page's height.
If swf object height is greter than html page size then it give's horizontal scrolling in swf object.
Here gives some tips to how can we set swf object size and html page size dynamically.
1. Create class in that set changing parameter.
private var objHeight:Number = 0;
private var timer:uint = 0;
public function setScrollSize(objUi:VBox):void
{
if (objUi)
{
objHeight = Application.application.height;
objUi.minHeight = objHeight;
BindingUtils.bindSetter(update_height_handler,objUi, "height");
}
}
private function update_height_handler(objVal:Number):void
{
clearTimeout(timer);
timer = setTimeout(Timeout_handler, 5, objVal);
}
private function Timeout_handler(objVal:Number):void
{
if (objHeight>objVal)
objVal = MinHeight;
resizeObject_handler(0,objVal);
}
public function resizeObject_handler(objWi:Number = 0,objHi:Number = 0):void
{
if (ExternalInterface.available)
{
ExternalInterface.call("java_resizeObject", objWi, objHi);
}
}
2. Set Javascript in your html page
function java_resizeObject(width,height)
{
var _object = document.getElementById("swfFileName");
if(width != undefined && width != 0)_object.style.width = width;
if(height != undefined && height != 0)_object.style.height = height;
}
3. Call this function at the init() event of application pass the container object in that.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment