我可能永遠沒有機會用FLEX,但我還是要堅持學習它,這是我的一個興趣
組件可以設置minWidth等值,這樣子在拖到大小時,不能小于這個值
Flex 不支持使用層疊樣式表 (CSS) 來控制組件的所有可視方面。屬性, 比如 x, y, width 和 height 是 UIComponent 類的屬性
用StyleManager設置樣式
var css:CSSStyleDeclaration = new CSSStyleDeclaration('mystyle');
css.setStyle('fontSize','30');
css.setStyle('color','blue');
StyleManager.setStyleDeclaration('.panel',css,true);
NavBar及其子類,不接受XMLList做為數(shù)據(jù)源,我也不知道為什么
<mx:Button label="Button">
<mx:icon>@Embed(source='file:///C|/Users/terry/Desktop/20066162321370.jpg')</mx:icon>
</mx:Button>
以下效果一樣
<mx:Image id="loader1" source="@Embed(source='logo.jpg')"/>
<mx:Image id="loader1" source="@Embed('logo.jpg')"/>
HScrollBar
其值在Design中填不上,主要有下列值
<mx:HScrollBar
minScrollPosition="0" maxScrollPosition="100"
lineScrollSize="5" pageScrollSize="10" />
LinkBar數(shù)據(jù)源是對象數(shù)組時,獲得對象的屬性
var o:LinkBar = LinkBar(evt.target) ;
race(o.dataProvider[evt.index].data)
RadioButtonGroup EventDispatcher Object
NavBar及其子類,事件
mx.events.ItemClickEvent
可以用event.index event.label獲得數(shù)據(jù)
有as代碼定義XMLList是外邊用一個空的<>為什么呢
private var a:XMLList =
<>
<a>aa</a>
<a>bb</a>
</>
Menu菜單等相關的東西,數(shù)據(jù)可以在事件中用
event.item獲得
數(shù)據(jù)驗證
提示的樣式
.errorTip
{
fontSize: 12;
}
基本的:指定source property,trigger,triggerEvent
正測驗證是的,事件
public function validResult(evt:ValidationResultEvent):void{
if(evt.type == ValidationResultEvent.VALID ){
var re:RegExpValidationResult;
for(var i:int=0;i<evt.results.length;i++){
re = evt.results[i];
result.text += "\n" + re.matchedString;
}
else{
result.text = 'not find';
}
}
或
Vresult = Text.validate();
if(Vresult.type = ValidationResultEvent.VALID
如何裁入這體并使用
[Embed("../assets/STXINWEI.TTF",fontName="myfont")]
[Bindable]
private var f:Class;
<mx:Label text="我要轉" width="245" fontFamily="myfont"/>
自定義下載bar
繼承自DownloadProgressBar,重寫幾個屬性及方法
構造函數(shù)中:
downloadingLabel="downing";
要重寫的方法:
showDisplayForInit
showDisplayForDownloading
應用程序本身用Application.application為訪問
ModuleManager加載模塊
ModuleManager.getModule()其返回IModuleInfo
要把模塊加到主程序中,必須類型轉換一下
IModuleInfo.factory.create() as 模塊
光標管理
CursorManager.setBusyCursor();
ToolTipManager 提示管理器
可以使用其它容器,象Panel等來實現(xiàn)
其要實現(xiàn)<mx:Panel implements="mx.core.IToolTip" IToolTip這個接口才可以
使用時
public function onshow(evt:ToolTipEvent):void{
var p:ppp = new ppp();
evt.toolTip = p;
}
BrowserManager和瀏覽器交互
BrowserManager.getInstance();其返回一個
IBrowserManager對象,其完成具體功能,
如何給圖片表背景線?
<mx:backgroundElements>
<mx:GridLines direction="horizontal">
mx:horizontalStroke>
<mx:Stroke weight="2" color="#ff0000" alpha="0.5" />
</mx:horizontalStroke>
<mx:horizontalFill>
<mx:SolidColor color="#cccccc" alpha="0.8" />
</mx:horizontalFill>
</mx:GridLines>
</mx:backgroundElements>
ajaxBridge
要在服務器中訪問,不能直接打開,那樣子會報錯
mx.utils.ObjectUtil
有字符串或數(shù)字比較的方法
低數(shù)據(jù)量通信
Webservice
<mx:opertaion>
resultformat
result
fault
<mx:request>
指定參數(shù)
</mx:request>
</mx:opertion>
備注:在yii中寫的webservice返回的雖然是xml,flex認成是一段String需要格式轉換
var s:String = evt.result as String;
var shopxml:XML = new XML(s);
shops = shopxml.shop;
上邊這咱做法是先轉成xml,再轉成xmllist
AMFPHP
一:用Responder
二:remoteObject
1:編譯中加上 -services "services-config.xml"
2:從serices中復制上邊的文件,并改其中的gateway為正確的路徑
3:配置source destination
<mx:RemoteObject source="Hello" destination="amfphp" id="service">
<mx:method name="sayHello" result="getsay(event)" />
</mx:RemoteObject>
4:調用service.getOperation('sayHello').send(參數(shù))
對象映射是[RemoteClass(alias="Project.Students")]中的alias是指定Flex對應的類的路徑,而不是php中的
就是說其寫php中的public $_explicitType = "Project.Students";指到同一個地方
得到的數(shù)據(jù)雖然為數(shù)組,想有還是要轉換一下new ArrayCollection(ArrayUtil.toArray(evt.result));