flex页面跳转
其实对于这个题目是不恰当的,因为flex中是没有页面这个概念的,页面在flex里面其实就是一个个的Canvas,vbox,
hbox等等之类的东西,看到的不同页面的切换,就是这些元素一层层的堆积,或者替换,但是为了好理解,还是称之为
"页面跳转"。其实我们可以对比传统的C/S开发模式,没页面跳转,只有窗体和元件的显示和隐藏。
那么在flex中怎么实现页面的跳转了,我总结了下,主要有一下几种方式:
1、使用ViewStack组件,具体代码如下所示:把要跳转的页新建成 MXML Component,然后通过 ViewStack 组件把
这些页包含进来
<mx:ViewStack id="storeViews" width="100%" height="550" creationPolicy="all">
<shouye id="homeView" label="首 页" showEffect="WipeDown" hideEffect="WipeUp" />
<leixing id="pView" label="模板类型" showEffect="WipeDown" hideEffect="WipeUp" />
<make id="supportView" label="立即制作" showEffect="WipeDown" hideEffect="WipeUp" />
</mx:ViewStack>
然后再用别的组件切换这些页,比如用 Button
<mx:Button click="storeViews.selectedChild=homeView;" />
2、使用navigateToURL,主要方式如下:var url:String = "http://localhost:8080/Flex_J2eeDemo/bin/Welcome.html";
var request:URLRequest = new URLRequest(url);
 
相关文档:
<?xml version="1.0" encoding="utf-8"?>
<!-- Simple example to demonstrate the Application container. -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
backgroundGradientColors="[0xCCCCCC, 0x66CCFF]"
backgroundColor="0xCCCC ......
<?xml version="1.0" encoding="utf-8"?>
<!-- Simple example to demonstrate the Zoom effect. -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml
">
<mx:Style source="style/style.css"/>
<mx:Scri ......
根据别人写了类,自己又增加了一部分,贴出来分享
/*获得两个日期之差 */
public static function getDateDiff(startDate:Date, endDate:Date):int
{
var diff:Number = (Number(endDate) - Number(startDate))/(3600000*24);
return diff;
}
/* 获得现在日期 */
public static function getDate() ......
flex builder 设置非系统默认字体:
存在问题:text不能设置bold,否则不起作用。
方法一:(css)
<mx:Style>
@font-face
{
font-family: myFont;
& ......
Mxml组件的打开和关闭特效
openDuration="1000" openEasingFunction="Bounce.easeOut"
closeDuration="1000" closeEasingFunction="Bounce.easeIn"
//菜单透明效果
background-color:#000000;
background-alpha:0.1;
border-style:solid;
drop-shadow-color:#000000;
drop-shadow-enabled:yes;
//展开所 ......