다중 모듈 ModuleLoader 사고방식 변화

4953 단어 게임Flex음악
버전 1:

<fx:Script>
		<![CDATA[
			
		private function init():void
		{
			setPanel("home");
		}
			
		public function setPanel(type:String):void
		{
			switch(type){
				
				case "home":
					this.myViewStack.selectedChild=home;
					this.title=" ";
					break;
				case "bio":
					this.myViewStack.selectedChild=bio;
					this.title=" ";
					break;
				case "log":
					this.myViewStack.selectedChild=log;	
					this.title=" ";
					break;
				case "music":
					this.myViewStack.selectedChild=music;
					this.title=" ";
					break;
				case "album":
					this.myViewStack.selectedChild=photo;
					this.title=" ";
					break;
				case "leavewords":
					this.myViewStack.selectedChild=leaveWords;
					this.title=" ";
					break;
				case "game":
					this.myViewStack.selectedChild=game;
					this.title=" ";
					break;
				default:
					break;
			}
			
		}
		]]>
	</fx:Script>
	<mx:ViewStack id="myViewStack" width="100%" height="100%" >
		<mx:Box id="home"  width="100%" height="100%" verticalScrollPolicy="on" horizontalScrollPolicy="off">
			<module:XModuleLoader  url="com/dreamer/module/ModuleHome.swf"/>
		</mx:Box>
		
		<mx:Box id="bio"  width="100%" height="100%"  horizontalScrollPolicy="off">	
			<module:XModuleLoader url="com/dreamer/module/ModuleBio.swf" />
		</mx:Box>
		
		<mx:Box id="log"  width="100%" height="100%" horizontalScrollPolicy="off">	
			<module:XModuleLoader  url="com/dreamer/module/ModuleLog.swf"/>
		</mx:Box>
		
		<mx:Box id="music"  width="100%" height="100%" horizontalScrollPolicy="off">	
			<module:XModuleLoader  url="com/dreamer/module/ModuleMusic.swf" />
		</mx:Box>
		
		<mx:Box id="photo"  width="100%" height="100%" horizontalScrollPolicy="off">
			<module:XModuleLoader  url="com/dreamer/module/ModulePhoto.swf" />
		</mx:Box>
		
		<mx:Box id="leaveWords"  width="100%" height="100%" horizontalScrollPolicy="off">
			<module:XModuleLoader url="com/dreamer/module/ModuleLeaveWords.swf"/>
		</mx:Box>
		
		<mx:Box id="game"  width="100%" height="100%" horizontalScrollPolicy="off">
			<module:XModuleLoader  url="com/dreamer/module/ModuleGame.swf"/>
		</mx:Box>
	</mx:ViewStack>

버전 2:

<fx:Script>
		<![CDATA[

			private function init():void
			{
				setPanel("home");
			}
				
			public function setPanel(type:String):void
			{
				this.currentState = type;
			}
		]]>
	</fx:Script>
	
	<fx:Declarations>
		<s:State name="home" />
		<s:State name="bio" />
		<s:State name="log" />
		<s:State name="music" />
		<s:State name="album" />
		<s:State name="leavewords" />
		<s:State name="game" />
	</fx:Declarations>
	
	<module:XModuleLoader url="com/dreamer/module/ModuleHome.swf" includeIn="home" verticalScrollPolicy="on" horizontalScrollPolicy="off"/>
	<module:XModuleLoader url="com/dreamer/module/ModuleBio.swf" includeIn="bio"  horizontalScrollPolicy="off"/>
	<module:XModuleLoader url="com/dreamer/module/ModuleLog.swf" includeIn="log" horizontalScrollPolicy="off"/>
	<module:XModuleLoader url="com/dreamer/module/ModuleMusic.swf" includeIn="music" horizontalScrollPolicy="off"/>
	<module:XModuleLoader url="com/dreamer/module/ModulePhoto.swf" includeIn="album" horizontalScrollPolicy="off"/>
	<module:XModuleLoader url="com/dreamer/module/ModuleLeaveWords.swf" includeIn="leavewords" horizontalScrollPolicy="off"/>
	<module:XModuleLoader url="com/dreamer/module/ModuleGame.swf" includeIn="game" horizontalScrollPolicy="off"/>

좋은 웹페이지 즐겨찾기