⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 shadowcontainer.as

📁 as3.0 翻书效果
💻 AS
字号:
/**
* Description here..
* @author Default
* @version 0.1
*/

package crlclr {
	import crlclr.Event.FlipEvent;
	import crlclr.Event.FlippingEventArg;
	import crlclr.Event.FlipResize;
	import flash.display.Sprite;
	import flash.events.Event;

	public class ShadowContainer extends Sprite {
		private var Left:Shadow;
		private var Right:Shadow;
		private var w:int;
		private var h:int;
		public static var Instance:ShadowContainer=new ShadowContainer();
		public function ShadowContainer(){
			if(Instance!=null){
				throw new Error("单件模式");
			}
			
			w=siteCommon.Data.PageWidth;
			h=siteCommon.Data.PageHeight;
			
			this.Left=new Shadow(w,h);
			this.Left.alpha=0;
			this.Left.Visiable=false;
			this.Right=new Shadow(w,h);
			
			addChild(this.Left);
			addChild(this.Right);
		}
		public static function getInstance():ShadowContainer{
			return Instance;
		}
		
		public function Resize(event:FlipResize){			
			this.x=event.o.x;
			this.y=event.o.y;
			
			this.Left.x=-this.w
			this.Left.y=this.Right.y=-int(this.h/2)
			
			this.dispatchEvent(new Event(Event.RESIZE));
		}
		
		
		/**
		* 
		* @param	event
		*/
		public function onFlipping(event:FlipEvent){
			
			var p:FlippingEventArg=event.o as FlippingEventArg;
			
			if(p.first>0&& !this.Left.Visiable){
				this.Left.Visiable=true;
			}
			if(p.last<=p.max&& !this.Right.Visiable){
				this.Right.Visiable=true;
			}
			if(p.first==0 && this.Left.Visiable){
				this.Left.Visiable=false;
			}
			if(p.last>p.max && this.Right.Visiable){
				this.Right.Visiable=false;
			}
			
		}
	}
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -