如何获得swf的高度以随内容扩展?
问题描述:
我正在从数据库读取条目中的闪存中创建一个站点。我希望swf在html页面上向下扩展,以便用户可以使用浏览器滚动条查看所有内容。我不想将所有内容都分成800像素高的swf或其他内容 - 我希望页面可以像扩展html一样展开。可能?如何获得swf的高度以随内容扩展?
答
我们在一个私人项目中就是这么做的。我们有一个使用ExternalInterface.call(http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/external/ExternalInterface.html)功能:
if (ExternalInterface.available) ExternalInterface.call('resizeScene', newHeight)
调用javascript函数它只是调整大小的div元素:
function resizeScene(newHeight)
{
document.getElementById('website').style.height = parseFloat(newHeight) + 'px';
}
您可能还需要调查
http://livedocs.adobe.com/flex/3/langref/flash/display/Stage.html#align
and
http://livedocs.adobe.com/flex/3/langref/flash/display/Stage.html#scaleMode
很好,谢谢!我知道ExternalInterface,但不知道闪光灯会自动展开。 – phil 2009-11-10 20:22:43