预加载器因“打ic”而悬挂/冻结。

| 我已经为拥有GoDaddy帐户并已将所有文件成功上传到托管服务器的客户开发了一个基于Flash的网站。该站点由一个名为“ preloader.swf”的初始预加载器组成,该加载器加载名为“ main.swf”的外部SWF文件,该文件包含不同的部分,其中包括图像库部分。 但是,我注意到有时(并非总是如此),基于主闪存的站点的初始闪存预加载器的加载速度比平时使用“打h”更快。这导致当必须在站点的库部分中查看图像时(其中每个图像都是从具有自己的预加载器的服务器从外部加载的),所选图像以锯齿状加载并带有“打\”。实例从22%暂停,然后立即跳到31%,然后再次暂停并立即跳到47%,依此类推)。 然后,在某个时间点,预加载器突然冻结/挂起了整个站点,除了刷新站点外别无选择。 只有这样,一旦映像的预加载器冻结并且刷新了站点或清除了缓存,整个站点才能按预期的那样完美地工作-即,初始预加载器加载得更慢,更平滑,以及图像何时加载的预加载器加载也更加流畅(百分比没有像以前那样突然跳动;预加载器以正常增量加载)。 任何人都可以告诉我一个可能的解决方案是什么问题,因为我一直在反复检查代码,但我如何始终使站点平稳加载而又不会遇到任何打,、冻结和挂起,找不到任何问题吗? 我正在做一些研究,读到原因可能是由于以下行\“ ProgressEvent.PROGRESS \”引起的,因为它有时可能不会在IE或Firefox中触发。是这样吗?如果是这样,我必须采取什么替代方法? 希望能尽快收到答复。 感谢和问候。 附言下面,我包括了用于初始预加载器以加载主站点(而不是用于加载映像的预加载器)的AS编码:
import flash.events.Event;
import flash.events.MouseEvent;
import flash.events.ProgressEvent;

//no scale;
stage.scaleMode = StageScaleMode.NO_SCALE;

//align to top left
stage.align = StageAlign.TOP_LEFT;

stage.addEventListener(Event.RESIZE, onPreloaderResize);
addEventListener(Event.ENTER_FRAME, onPreloaderEnter);

angel_pic.alpha = 0;

top_left_line.visible = false;
top_right_line.visible = false;
side_left_line.visible = false;
side_right_line.visible = false;
bottom_left_line.visible = false;
bottom_right_line.visible = false;

var req:URLRequest = new URLRequest(\"main.swf\");
var loader:Loader = new Loader();
loader.load(req);

loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, showProgress);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);

function showProgress(event:ProgressEvent):void
{
    var percent:Number = Math.round((event.bytesLoaded / event.bytesTotal) * 100);

    if ((percent > 0) && (percent <= 34))
    {
        top_left_line.visible = true;
        top_right_line.visible = true;

        top_left_line.width = percent * ((angel_pic.width / 2) / 34);
        top_right_line.width = percent * ((angel_pic.width / 2) / 34);
    }
    else
    {
        if ((percent > 34) && (percent <= 66))
        {
            side_left_line.visible = true;
            side_right_line.visible = true;

            side_left_line.height = (percent - 34) * (angel_pic.height / 32);
            side_right_line.height = (percent - 34) * (angel_pic.height / 32);
        }
        else
        {
            if (percent > 66)
            {
                bottom_left_line.visible = true;
                bottom_right_line.visible = true;

                bottom_left_line.width = (percent - 66) * ((angel_pic.width / 2) / 34);
                bottom_right_line.width = (percent - 66) * ((angel_pic.width / 2) / 34);
            }
        }
    }
}

function loadComplete(event:Event):void
{
    var num:int = numChildren;

    while (num--)
    {
        removeChildAt(num);
    }   

    addChild(loader);
}

function onPreloaderResize(event:Event):void
{
    var preloaderPadding:Number = (stage.stageWidth / 1000) * 35;

    angel_pic.x = (stage.stageWidth / 2) - (angel_pic.width / 2);
    angel_pic.y = (stage.stageHeight / 2) - (angel_pic.height / 2);

    angel_pic.width = stage.stageWidth - (preloaderPadding * 2);
    angel_pic.height = angel_pic.width / 4.9;

    top_left_line.x = stage.stageWidth / 2;
    top_left_line.y = angel_pic.y;

    top_right_line.x = stage.stageWidth / 2;
    top_right_line.y = angel_pic.y;

    side_left_line.x = preloaderPadding + side_left_line.width;
    side_left_line.y = angel_pic.y;

    side_right_line.x = preloaderPadding + angel_pic.width;
    side_right_line.y = angel_pic.y;

    bottom_left_line.x = preloaderPadding + bottom_left_line.height;
    bottom_left_line.y = angel_pic.y + angel_pic.height;

    bottom_right_line.x = preloaderPadding + angel_pic.width;
    bottom_right_line.y = angel_pic.y + angel_pic.height;
}

function onPreloaderEnter(event:Event):void
{
    var preloaderPadding:Number = (stage.stageWidth / 1000) * 35;

    angel_pic.x = (stage.stageWidth / 2) - (angel_pic.width / 2);
    angel_pic.y = (stage.stageHeight / 2) - (angel_pic.height / 2);

    angel_pic.width = stage.stageWidth - (preloaderPadding * 2);
    angel_pic.height = angel_pic.width / 4.9;

    top_left_line.x = stage.stageWidth / 2;
    top_left_line.y = angel_pic.y;

    top_right_line.x = stage.stageWidth / 2;
    top_right_line.y = angel_pic.y;

    side_left_line.x = preloaderPadding + side_left_line.width;
    side_left_line.y = angel_pic.y;

    side_right_line.x = preloaderPadding + angel_pic.width;
    side_right_line.y = angel_pic.y;

    bottom_left_line.x = preloaderPadding + bottom_left_line.height;
    bottom_left_line.y = angel_pic.y + angel_pic.height;

    bottom_right_line.x = preloaderPadding + angel_pic.width;
    bottom_right_line.y = angel_pic.y + angel_pic.height;
}
    
已邀请:
我以前也遇到过预加载器问题。 尽管在您的代码中仍然可能有问题,但是您可能想排除另一个已知问题作为问题的根源。 如果仅在生产服务器上而不是在本地PC上遇到问题,则很有可能是您的服务器设置有问题。 检查我关于服务器gzip压缩二进制文件压缩的​​博客文章。 尽管这是有关flex的文章,但原理是相同的,也应适用于flash。 干杯     
在将站点上传到GoDaddy服务器之前,我曾经使用Flash自己的“模拟下载”选项对其进行测试,并且从未遇到任何问题。 只有上载网站后,我才开始遇到此问题。 我无法理解和解决的奇怪的事情是,只有当预加载器冻结/挂起并且刷新站点或清除缓存后,整个站点才能正常工作,而不会出现故障或锁定-UPS! 我什至上传了一个更简单的预加载器版本(如下面的代码所示),该预加载器加载其中包含单个图片的3Mb SWF文件,但仍然再次出现相同的问题。但是我认为代码中没有问题,对吗?
var req:URLRequest = new URLRequest(\"main-mini.swf\");
var loader:Loader = new Loader();
loader.load(req);

loader.contentLoaderInfo.addEventListener(Event.OPEN, showPreloader);
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, showProgress);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, showContent);

var preloader:Preloader = new Preloader();

function showPreloader(event:Event):void {
    addChild(preloader);
    preloader.x = (stage.stageWidth / 2) - (preloader.width / 2);
    preloader.y = (stage.stageHeight / 2) - (preloader.height / 2);
}

function showProgress(event:ProgressEvent):void {
    var percent:Number = event.bytesLoaded / event.bytesTotal;
    preloader.percentage.text = Math.round(percent * 100) + \"%\";
    preloader.bar.width = 300 * percent;
}

function showContent(event:Event):void {
    removeChild(preloader);
    addChild(loader);
}
我还尝试在HTML和Flash中都使用缓存清除技术,并将其帧速率从31fps降低到21fps,但这全都没有。 我可能会问一些愚蠢的问题,但是可能来自GoDaddy服务器吗?我是否需要调整某些设置以使其正常工作,或者我可以“很严重”上传它?我使用FTP方法通过Dreamweaver上传了该站点。我目前不知道该怎么想... 如果有人能启发我如何解决我的这个问题,我将不胜感激,因为所有工作在本地都能正常进行-一旦上载,问题就已经存在了。 谢谢。     

要回复问题请先登录注册