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 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |
你可能对下面的文章感兴趣
上一篇: 关于控制影片的播放和倒退下一篇: 下雪组件
关于MovieClipLoader类与监听的应用的所有评论