快速业务通道

MovieClipLoader类与监听的应用

作者 佚名技术 来源 服务器技术 浏览 发布时间 2012-07-11


示例以下示例举例说明如何使用多个 MovieClipLoader 方法和侦听器。// 首先设置侦听器 var my_mcl = new MovieClipLoader(); myListener = new Object(); myListener.onLoadStart = function (target_mc) { myTrace ("*********First my_mcl instance*********"); myTrace ("Your load has begun on movie clip .= " + target_mc); var loadProgress = my_mcl.getProgress(target_mc); myTrace(loadProgress.bytesLoaded + " = bytes loaded at start" ); myTrace(loadProgress.bytesTotal + " = bytes total at start"); } myListener.onLoadProgress = function (target_mc, loadedBytes, totalBytes) { myTrace ("*********First my_mcl instance Progress*********"); myTrace ("onLoadProgress() called back on movie clip " + target_mc); myTrace(loadedBytes + " = bytes loaded at progress callback " ); myTrace(totalBytes + " = bytes total at progress callback \n"); } myListener.onLoadComplete = function (target_mc) { myTrace ("*********First my_mcl instance*********"); myTrace ("Your load is done on movie clip = " + target_mc); var loadProgress = my_mcl.getProgress(target_mc); myTrace(loadProgress.bytesLoaded + " = bytes loaded at end"); myTrace(loadProgress.bytesTotal + " = bytes total at end="); } myListener.onLoadInit = function (target_mc) { myTrace ("*********First my_mcl instance*********"); myTrace ("Movie clip = " + target_mc + " is now initialized"); // 您现在可以进行所需的任何设置,例如: target_mc._width = 100; target_mc._width = 100; } myListener.onLoadError = function (target_mc, errorCode) { myTrace ("*********First my_mcl instance*********"); myTrace ("ERROR CODE = " + errorCode); myTrace ("Your load failed on movie clip = " + target_mc + "\n"); } my_mcl.addListener(myListener); //现在将这些文件加载到其目标中。 // 加载到影片剪辑中 - 字符串用作目标 my_mcl.loadClip("http://www.somedomain.somewhere.com/someFile.swf","_root.myMC"); my_mcl.loadClip("http://www.somedomain.somewhere.com/someOtherFile.swf", "_level0.myMC2"); //失败的加载 my_mcl.loadClip("http://www.somedomain.somewhere.com/someFile.jpg", _root.myMC5);

// 加载到影片剪辑中 - 影片剪辑实例用作目标。 my_mcl.loadClip("http://www.somedomain.somewhere.com/someOtherFile.jpg", _level0.myMC3);

// 加载到 _level1 my_mcl.loadClip("file:///C:/media/images/somePicture.jpg", 1); //第二次设置侦听器 var another_mcl = new MovieClipLoader(); myListener2 = new Object(); myListener2.onLoadStart = function (target_mc) { myTrace ("*********Second my_mcl instance*********"); myTrace ("Your load has begun on movie clip22 .= " + target_mc); var loadProgress = my_mcl.getProgress(target_mc); myTrace(loadProgress.bytesLoaded + " = bytes loaded at start" ); myTrace(loadProgress.bytesTotal + " = bytes total at start"); } myListener2.onLoadComplete = function (target_mc) { myTrace ("*********Second my_mcl instance*********"); myTrace ("Your load is done on movie clip = " + target_mc); var loadProgress = my_mcl.getProgress(target_mc); myTrace(loadProgress.bytesLoaded + " = bytes loaded at end"); myTrace(loadProgress.bytesTotal + " = bytes total at end" ); } myListener2.onLoadError = function (target_mc, errorCode) { myTrace ("*********Second my_mcl instance*********"); myTrace ("ERROR CODE = " + errorCode); myTrace ("Your load failed on movie clip = " + target_mc + "\n"); } another_mcl.addListener(myListener2); //现在将这些文件加载到其目标中(使用 MovieClipLoader 的第二个实例) another_mcl.loadClip("http://www.somedomain.somewhere.com/yetAnotherFile.jpg", _root.myMC4); // 在完成下载以及已调用 my_mcl.onLoadInit 后 // 发出以下语句。 // my_mcl.removeListener(myListener) // my_mcl.removeListener(myListener2)


关键词:

凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

分享到: 更多

Copyright ©1999-2011 厦门凌众科技有限公司 厦门优通互联科技开发有限公司 All rights reserved

地址(ADD):厦门软件园二期望海路63号701E(东南融通旁) 邮编(ZIP):361008

电话:0592-5908028 传真:0592-5908039 咨询信箱:web@lingzhong.cn 咨询OICQ:173723134

《中华人民共和国增值电信业务经营许可证》闽B2-20100024  ICP备案:闽ICP备05037997号