-
可以控制多层嵌套的movieClip播放和暂停
- package com.sina.utils
- {
- import flash.display.MovieClip;
-
- /**
- * .主要是解决一个单帧影片剪辑无法暂停和重播的问题
- * @author ant-zhangpeng@staff.sina.com.cn
- */
- public class MovieClipManage
- {
- private var _target:MovieClip;
- private var _type:String;
-
- /**
- * 构造函数
- * @param mc 目标影片剪辑
- */
- public function MovieClipManage(mc:MovieClip = null)
- {
- _target = mc;
- }
-
- private function goto(mc:MovieClip, frame:int = 0):void
- {
- if(!(mc is MovieClip))
- {
- throw new Error("MovieClipManage::: 目标不是movieClip");
- return;
- }
- frame > 0 ? mc[_type](frame) : mc[_type]();
-
- if (mc.numChildren > 0)
- {
- for (var i:int = 0; i < mc.numChildren; i++ )
- {
- if (mc.getChildAt(i) as MovieClip)
- {
- goto(mc.getChildAt(i) as MovieClip, frame);
- }
- }
- }
-
- }
-
- //--------------------API---------------------------------
- /**
- * 暂停影片剪辑
- */
- public function pause(target:MovieClip = null):void
- {
- _type = "stop";
- target = target || _target;
- goto(target);
- }
-
- /**
- * 恢复暂停影片剪辑
- */
- public function play(target:MovieClip = null):void
- {
- _type = "play";
- target = target || _target;
- goto(target);
- }
-
- /**
- * 停止影片剪辑到第一帧
- */
- public function stop(target:MovieClip = null):void
- {
- _type = "gotoAndStop";
- target = target || _target;
- goto(target, 1);
- }
-
- /**
- * 重播影片剪辑
- */
- public function replay(target:MovieClip = null):void
- {
- _type = "gotoAndPlay";
- target = target || _target;
- goto(target, 1);
- }
- }
-
- }
-
相关阅读:
初识WEB:输入URL之后的故事
ecshop ecmall shopex
.net 4.5如何使用Async和Await进行异步编程
C#中yield用法
安装Ecshop首页出现报错:Only variables should be passed by referen
Ecshop安装过程中的的问题:cls_image::gd_version()和不支持JPEG
javascript 操作dom
使用X-UA-Compatible来设置IE浏览器兼容模式
createDocumentFragment
ckfinder在IE10,IE9中的弹出框不能选择,或者不能上传解决方法
-
原文地址:https://www.cnblogs.com/czjone/p/1861792.html
Copyright © 2020-2023
润新知