简练的代码实现连续滚动背景
作者:admin 日期:2012-09-02很精干的代码实现背景连续滚动,没啥技术含量,主要借助了blitMask的功能。
XML/HTML代码
- package {
- import flash.display.MovieClip;
- import com.greensock.TweenMax;
- import com.greensock.BlitMask;
- import com.greensock.easing.Linear;
- public class main extends MovieClip {
- public function main(){
- var stagestageW = stage.stageWidth;
- var stagestageH = stage.stageHeight;
- var _bg:MovieClip = this.getChildByName("bg") as MovieClip;
- _bg.x = 0;
- _bg.y = stageH;
- _bg.rotation = 45;
- _bg.alpha = .3;
- var blitMask:BlitMask = new BlitMask(_bg, 0, 0, stageW, stageH, true, true, 0xccffcccc, true);
- addChildAt(blitMask, 0);
- blitMask.bitmapMode = true;
- TweenMax.to(_bg, 12, { x:stageW,y:0 , ease:Linear.easeNone,repeat:-1,yoyo:true } );
- }
- }
- }
评论: 0 | 引用: 0 | 查看次数: 7026
发表评论