ITeye博客

MXML里跳页面

zwh910621 · 2009-11-27 22:11 · flex · Web前端 · Markdown

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">	
	<mx:Script>
		<![CDATA[
			function skip_html_localhost(){
				//var url:String="/test/index.html";//跳HTML
				var url:String="viewStack.html";//跳MXML
,swf文件(这里是编译后的HTML)				var request:URLRequest=new URLRequest(url);
				navigateToURL(request);
			}
		]]>
	</mx:Script>

	<mx:Panel x="233" y="247" title="跳转页面(本地)">
		<mx:Button label="skip" click="skip_html_localhost();"/>
	</mx:Panel>
</mx:Application>

 MXML里跳页面

private function login():void{navigateToURL(newURLRequest("/test/flex/Login.html"),"_self");
} 

 上面跳转URL指向的必须是 MXML Application

如果是Module还可以用viewStack来实现

<mx:ViewStack id="views" creationPolicy="all" width="100%" height="80%">
	<mx:ViewStack id="theNULL">
		
	</mx:ViewStack>
	<animal:Animal id="animalView" showEffect="WipeDown" hideEffect="WipeUp" width="100%" height="100%"/>
	<artefact:Artefact id="artefactView" showEffect="WipeDown" hideEffect="WipeUp"/>
	<house:House id="houseView" showEffect="WipeDown" hideEffect="WipeUp"/>
	<insect:Insect id="insectView" showEffect="WipeDown" hideEffect="WipeUp"/>
	<mountain:Mountain id="mountainView" showEffect="WipeDown" hideEffect="WipeUp"/>
	<tree:Tree id="treeView" showEffect="WipeDown" hideEffect="WipeUp"/>
	
	<animal:AnimalType id="animalTypeView" showEffect="WipeDown" hideEffect="WipeUp"/>
	<artefact:ArtefactType id="artefactTypeView" showEffect="WipeDown" hideEffect="WipeUp"/>
</mx:ViewStack>


private function changeView():void{
	views.selectedChild=animalView;				
}

评论(3)

  1. #3 楼 · zyl小星星 · 2009-12-01 12:10

    个人觉得AS还是一门比较不错的语言,至少玩过Java的人很容易上手,希望博主多分享些AS/Flex的东西!

  2. #2 楼 · 潜心修炼 · 2009-11-30 20:59

    对flex了解不多 不过好像flex 通过场景的转换实现类似页面跳转的效果

  3. #1 楼 · zryengytj · 2009-11-30 17:50

    :idea:

评论功能维护中,当前仅展示历史评论。