首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 媒体动画 > flex >

flex button跳转(2)

2012-10-28 
flexbutton跳转(二)//fly.asimport flash.events.MouseEventimport mx.automation.codec.KeyCodeProperty

flex button跳转(二)
//fly.as
import flash.events.MouseEvent;
import mx.automation.codec.KeyCodePropertyCodec;
import mx.controls.Alert;



private function initLoginModule():void
{
//添加验证,依据验证结果使按钮生效
//formValidator.addValidators(validators);
//formValidator.failedCallBack=function():void
//{
//btn_login.enabled=false;
//};
//formValidator.passedCallBack=function():void
//{
//btn_login.enabled=true;
//};
button11.addEventListener(MouseEvent.CLICK, doLogin);
button12.addEventListener(MouseEvent.CLICK, doReset);
button13.addEventListener(MouseEvent.CLICK, button13);
button14.addEventListener(MouseEvent.CLICK, button14);
button15.addEventListener(MouseEvent.CLICK, button15);
button16.addEventListener(MouseEvent.CLICK, button16);
button17.addEventListener(MouseEvent.CLICK, button17);
button18.addEventListener(MouseEvent.CLICK, button18);

}

private function doLogin(evt:MouseEvent):void
{
//CairngormEventDispatcher.getInstance().dispatchEvent(new LoginEvent(txt_username.text, txt_password.text));
var url:String="http://www.baidu.com";
var request:URLRequest=new URLRequest(url);
navigateToURL(request, "_self");
}
private function doReset(evt:MouseEvent):void
{
var url:String="http://www.sina.com";
var request:URLRequest=new URLRequest(url);
navigateToURL(request, "_self");
}


//fly.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
width="100%"
  height="100%"
  creationComplete="initLoginModule()">
<mx:Script source="fly.as"/>

 
<mx:Canvas width="100%" height="100%">
<mx:VBox height="100%" width="100%">
<mx:HBox width="100%" height="125">
<mx:Image width="100%" height="100%" source="@Embed('assets/grid.jpg')"/>



</mx:HBox>
<mx:HBox width="100%" height="488">
<mx:VBox height="100%" width="985">
<mx:HBox width="100%" height="55">
</mx:HBox>
<mx:HBox width="100%" height="64">
<mx:Spacer height="100%" width="127"/>
<mx:Button label="button1" width="192" height="64"  id="button11"/>
<mx:Spacer height="100%" width="127"/>
<mx:Button label="button2" width="192" height="64" id="button12"/>
</mx:HBox>
<mx:HBox width="100%" height="64">
<mx:Spacer height="100%" width="127"/>
<mx:Button label="button3" width="192" height="64" id="button13"/>
<mx:Spacer height="100%" width="127"/>
<mx:Button label="button44" width="192" height="64" id="button14"/>
</mx:HBox>
<mx:HBox width="100%" height="64">
<mx:Spacer height="100%" width="127"/>
<mx:Button label="button5" width="192" height="64" id="button15"/>
<mx:Spacer height="100%" width="127"/>
<mx:Button label="button6" width="192" height="64" id="button16"/>
</mx:HBox>
<mx:HBox width="100%" height="64">
<mx:Spacer height="100%" width="127"/>
<mx:Button label="button7" width="192" height="64" id="button17"/>
<mx:Spacer height="100%" width="127"/>
<mx:Button label="button8" width="192" height="64" id="button18"/>
</mx:HBox>
</mx:VBox>
<mx:VBox height="100%" width="100%">
<mx:Accordion width="254" height="463">
<mx:Canvas label="Accordion Pane 1" width="100%" height="100%">
</mx:Canvas>
<mx:Canvas label="Accordion Pane 1" width="100%" height="100%">
</mx:Canvas>
<mx:Canvas label="Accordion Pane 1" width="100%" height="100%">
</mx:Canvas>
</mx:Accordion>
</mx:VBox>
</mx:HBox>
<mx:ControlBar width="100%" height="100%">
<mx:Button label="Button" width="100%" height="100%"/>
</mx:ControlBar>
</mx:VBox>
</mx:Canvas>

</mx:Application>

热点排行