Blog信息 |
blog名称:注册会计师(注会)练习软件 日志总数:398 评论数量:116 留言数量:27 访问次数:3269931 建立时间:2005年6月6日 |

| |
一段flash 代码研究 软件技术
吕向阳 发表于 2005/10/30 22:36:58 |
以下代码摘自 flash模板生成的flash文件,有些值得借鉴
function updateFrame (inc) { // send slides to new frame newFrame = _root._currentFrame + inc; _root.gotoAndStop(newFrame);
updateStatus();
//**************************自己的注释
//prevbtn为一个动画剪辑中嵌套的一个影片剪辑,且这个影片剪辑还在其下嵌套有一个按钮,这个按钮有两种不同的状态在不同的影格里. prevBtn.gotoAndStop(2);就是指跳到它的第二格.
//_currentframe为当前影帧 比较符号== 赋值=
//_root为根,_parent为上一级
//比较典型的精巧的结构化编程,这些代码出现在主动画的第一帧
//**********************************
if (_root._currentFrame == 1) { prevBtn.gotoAndStop(2); } else { prevBtn.gotoAndStop(1); } if (_root._currentFrame == _root._totalFrames) { nextBtn.gotoAndStop(2); } else { nextBtn.gotoAndStop(1); }}
function updateStatus () { _root.statusField = _root._currentFrame + " of " + _root._totalFrames;}
function autoplayInit () { startTime = getTimer(); hideControls(); updateStatus();}
function autoplay () { if (autoplayStatus != 0) { // get the current time and elapsed time curTime = getTimer(); elapsedTime = curTime-startTime;
// update timer indicator indicatorFrame = int(4/(delay/(elapsedTime/1000))); indicator.gotoAndStop(indicatorFrame+1);
// if delay time if met, goto next photo if (elapsedTime >= (delay*1000)) { if (_root._currentframe == _root._totalframes) { _root.gotoAndStop(1); } else { _root.nextFrame(); } autoplayInit(); } }}
function hideControls () { nextBtn.gotoAndStop(2); prevBtn.gotoAndStop(2);}
updateFrame();autoplayStatus = 0; |
|
|