【问题标题】:How can you get the height of an swf to expand with the content?如何获得随内容扩展的 swf 的高度?
【发布时间】:2009-11-10 01:36:55
【问题描述】:

我正在闪存中创建一个站点,该站点正在从数据库中读取条目。我希望 swf 在 html 页面上向下扩展,以便用户可以使用浏览器滚动条查看所有内容。我不想将所有内容分页成 800 px 高的 swf 或其他东西 - 我希望页面像 html 一样扩展。可能吗?

【问题讨论】:

    标签: html flash actionscript-3 height


    【解决方案1】:

    我们在私人项目中正是这样做的。我们有一个使用 ExternalInterface.call (http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/external/ExternalInterface.html) 的函数:

    if (ExternalInterface.available) ExternalInterface.call('resizeScene', newHeight)
    

    调用一个简单地调整 div 元素大小的 javascript 函数:

    function resizeScene(newHeight)
    {
        document.getElementById('website').style.height = parseFloat(newHeight) + 'px';
    }
    

    您可能还想调查

    http://livedocs.adobe.com/flex/3/langref/flash/display/Stage.html#align

    http://livedocs.adobe.com/flex/3/langref/flash/display/Stage.html#scaleMode

    【讨论】:

    • 效果很好,谢谢!我知道 ExternalInterface 但不知道 flash 会自动扩展。
    猜你喜欢
    • 1970-01-01
    • 2015-06-03
    • 2014-05-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-17
    • 1970-01-01
    相关资源
    最近更新 更多