下载 flash swf 时加载图像。超文本标记语言

发布于 2024-11-28 18:14:58 字数 111 浏览 0 评论 0原文

我有一个很大的闪存文件,可以加载,但下载需要很长时间。它是一个标题,我只是想知道是否可以立即显示图像,然后在下载 Flash 时无缝地重叠它?只是想知道是否有 HTML 可以做到这一点?

谢谢

i have a big flash file that loads in but takes a noticeable amount of time to download. Its a header and i was just wondering if i could have an image instantly appear and then when the flash is downloaded seamlessly overlap it? Just wondering if there was an HTML to do this?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

公布 2024-12-05 18:14:58

据我所知,您有两个选择。

- 选项 A 是您已经提到的解决方案。我将在与 swf position:absolute 相同的 div 内放置一个 img 标签,并让 flash 执行 ExternalInterface.call(" hideImage") 加载 swf 时调用 JavaScript,并在 javascript 中使用 hideImage 函数删除/隐藏 img 标签。

-选项B(这是我会选择的)是在flash内部使用预加载器。在 flash 的第一个位置设置两个单独的关键帧。我使用标签我的第一个“加载”和第二个“主”。在加载过程中,我的操作类似于以下内容:

// stop the playhead from moving ahead
stop(); // you can also use gotoAndStop("loading"); if you want

function loaderProgressHandler(event:Event):void {
    // switch the framehead to main which will show your content
    if(event.bytesLoaded >= event.bytesTotal) {
        event.target.removeEventListener(Event.PROGRESS, this.loaderProgressHandler);
        this.gotoAndStop("main");
    }
}

this.loaderInfo.addEventListener(Event.PROGRESS, this.loaderProgressHandler);

Flash将在加载后显示“正在加载”段,您的swf将不会切换到“main”,直到 swf 的其余部分加载完成。如果您的 swf 正如您所说的那么大,我会推荐某种带有百分比指示器的预加载器

You have two options for this as far as I can tell.

- Option A is the solution you've mentioned already. I would have an img tag inside the same div as the swf position:absolute and have flash do an ExternalInterface.call("hideImage") call to JavaScript when the swf is loaded and have the hideImage function in javascript remove/hide the img tag.

- Option B (which is what I would go with) is to use a preloader inside of flash. Set up two separate keyframes at the first of flash. I usu label my first one "loading" and the second one "main". In loading I have actions similar to the following:

// stop the playhead from moving ahead
stop(); // you can also use gotoAndStop("loading"); if you want

function loaderProgressHandler(event:Event):void {
    // switch the framehead to main which will show your content
    if(event.bytesLoaded >= event.bytesTotal) {
        event.target.removeEventListener(Event.PROGRESS, this.loaderProgressHandler);
        this.gotoAndStop("main");
    }
}

this.loaderInfo.addEventListener(Event.PROGRESS, this.loaderProgressHandler);

Flash will show the "loading" frame segment once it loads, your swf won't switch to "main" until the rest of the swf is done loading. I'd recommend some sort of preloader with a percentage indicator if you swf is as big as you're saying.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文