预加载器因“打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;
}
没有找到相关结果
已邀请:
2 个回复
翰冒绢县
亲奋漏
我还尝试在HTML和Flash中都使用缓存清除技术,并将其帧速率从31fps降低到21fps,但这全都没有。 我可能会问一些愚蠢的问题,但是可能来自GoDaddy服务器吗?我是否需要调整某些设置以使其正常工作,或者我可以“很严重”上传它?我使用FTP方法通过Dreamweaver上传了该站点。我目前不知道该怎么想... 如果有人能启发我如何解决我的这个问题,我将不胜感激,因为所有工作在本地都能正常进行-一旦上载,问题就已经存在了。 谢谢。