Flash:如何在播放当前 SWF 时预加载即将发布的 SWF

发布于 2024-08-30 05:45:30 字数 1822 浏览 3 评论 0原文

我有一个 Flash 幻灯片,可以播放 XML 文件中列出的 SWF。我希望在显示当前 SWF 时加载即将到来的 SWF。我尝试了 LoadMovieLoadMovieNum 的各种组合,包括创建一个空的影片剪辑,但有些东西我没有得到。

现在,在完成第一轮所有文件后,它可以从一张幻灯片顺利过渡到另一张幻灯片,但我希望它能够预加载,以便它在第一次时不会出现“正在加载...”屏幕。

可以在这里查看:slideshow

我应该将 LoadMovie 放在哪里 行加载下一个文件 (image[p+1]),它应该是什么样子?

function loadXML(loaded) { 
if (loaded) { 
    xmlNode = this.firstChild; 
    image = []; 
    description = []; 
    total = xmlNode.childNodes.length; 
    for (i=0; i<total; i++) { 
    image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue; 
    description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue; 
} 
firstImage(); 
} else {
    content = "file not loaded!"; 
} 
}

xmlData = new XML(); 
xmlData.ignoreWhite = true; 
xmlData.onLoad = loadXML; 
xmlData.load("xmlfile.xml");

///////////////////////////////////// 

back_btn.onRelease = function ()
{
backImage();
};

next_btn.onRelease = function ()
{
nextImage();
};

p = 0;

function nextImage() {
if (p<(total-1)) {
    p++;
    trace(this);
    _root.mc_loadfile.loadMovie (image[p]);
    _root.movie_name.text = image[p];
    next_btn._visible = true;
    back_btn._visible = true;
    if (getBytesLoaded() == getBytesTotal())
        slideshow();
}

else if (p == (total-1)) {
    p = 0;
    firstImage();
}
}

function backImage() {
clearInterval(myInterval);
if (p>0) {
    --p;
    _root.mc_loadfile.loadMovie (image[p]);
    _root.movie_name.text = image[p];
    next_btn._visible = true;
    if (p != 0) {
        back_btn._visible = true;
    }
    else {
        back_btn._visible = false;
    }
    slideshow();
}
}

我将不胜感激任何帮助。

I have a Flash slideshow that plays SWFs listed in an XML file. I would like to have the upcoming SWF load while the current one displays. I've tried all sorts of combinations of LoadMovie and LoadMovieNum, including creating an empty movie clip, but there's something I'm just not getting.

Right now, after making the first round through all the files, it transitions smoothly from slide to slide, but I'd like for it to preload so that it transitions without the "Loading..." screen the first time around.

It can be viewed here: slideshow

Where should I put the LoadMovie line to load the next file (image[p+1]), and how should it look?

function loadXML(loaded) { 
if (loaded) { 
    xmlNode = this.firstChild; 
    image = []; 
    description = []; 
    total = xmlNode.childNodes.length; 
    for (i=0; i<total; i++) { 
    image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue; 
    description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue; 
} 
firstImage(); 
} else {
    content = "file not loaded!"; 
} 
}

xmlData = new XML(); 
xmlData.ignoreWhite = true; 
xmlData.onLoad = loadXML; 
xmlData.load("xmlfile.xml");

///////////////////////////////////// 

back_btn.onRelease = function ()
{
backImage();
};

next_btn.onRelease = function ()
{
nextImage();
};

p = 0;

function nextImage() {
if (p<(total-1)) {
    p++;
    trace(this);
    _root.mc_loadfile.loadMovie (image[p]);
    _root.movie_name.text = image[p];
    next_btn._visible = true;
    back_btn._visible = true;
    if (getBytesLoaded() == getBytesTotal())
        slideshow();
}

else if (p == (total-1)) {
    p = 0;
    firstImage();
}
}

function backImage() {
clearInterval(myInterval);
if (p>0) {
    --p;
    _root.mc_loadfile.loadMovie (image[p]);
    _root.movie_name.text = image[p];
    next_btn._visible = true;
    if (p != 0) {
        back_btn._visible = true;
    }
    else {
        back_btn._visible = false;
    }
    slideshow();
}
}

I'd appreciate any help.

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

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

发布评论

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

评论(1

薆情海 2024-09-06 05:45:30

您可以使用 MovieClipLoader 类来完成此操作。可以找到简短的教程在actionscript.org,或者您可以检查 文档

You can do it with the MovieClipLoader class. A brief tutorial can be found at actionscript.org, or you can check the docs on it.

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