简体   繁体   English

用于加载样式声明的Adobe Flex进度栏

[英]Adobe Flex Progress Bar for LoadStyleDeclarations

I'm loading a rather large swf as style with the following command: 我正在使用以下命令加载相当大的swf作为样式:

StyleManager.loadStyleDeclarations("assets/modules/"style.swf",true,false,ApplicationDomain.currentDomain);

The style is loaded fine but now I would like to add a progress bar to it, but I do not know how to do so. 样式加载得很好,但是现在我想向它添加进度条,但是我不知道该怎么做。 I am rather new to Flex and found only examples referring to HTML service calls. 我对Flex相当陌生,只发现了涉及HTML服务调用的示例。

Thank You for Your Help. 谢谢您的帮助。 It would be great to receive a small code example. 收到一个小的代码示例将非常棒。

var dispatcher:IEventDispatcher = StyleManager.loadStyleDeclarations(
        "assets/modules/style.swf",true,false,ApplicationDomain.currentDomain);

dispatcher.addEventListener(StyleEvent.PROGRESS, onProgress);
dispatcher.addEventListener(StyleEvent.COMPLETE, onComplete);
dispatcher.addEventListener(StyleEvent.ERROR, onError);

private function onProgress(e:StyleEvent):void
{
    //update progress bar here
    trace(Math.floor(100 * e.bytesLoaded/e.bytesTotal) + "% loaded");
}
private function onComplete(e:StyleEvent):void
{
    trace("Style loaded");
}
private function onError(e:StyleEvent):void
{
    trace("Error loading style");
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM