//1.
?
使用絕對地址
2.
<
mx
:
Style
?
source
=
'http://www.somesite.com/mystyles.css'
>
3.
//2.
?
使用◎ContextRoot
4.
<
mx
:
HTTPService
?
url
=
'@ContextRoot()/directory/myfile.xml'
/>
5.
//3.
?
使用根目錄引用方式
6.
<
mx
:
Script
?
source
=
'/myscript.as'
/>
7.
//4.
?
使用相當路徑引用
8.
<
mx
:
Script
?
source
=
'../myscript.as'
/>
在
Flex
應用程序中,也有事件的響應屬性。最簡單如鼠標單擊事件。
1<
mx
:
Application
?
xmlns
:
mx
=
'http://www.macromedia.com/2003/mxml'
>
2.
<
mx
:
Panel
?
title
=
'My
?
Application'
?
marginTop
=
'10'
?
marginBottom
=
'10'
3.
marginLeft
=
'10'
?
marginRight
=
'10'
?
>
4.
<
mx
:
TextArea
?
id
=
'textarea1'
/>
5.
<
mx
:
Button
?
label
=
'Submit'
?
click
=
'textarea1.text='
Hello
?
World
';'
/>
6.
</
mx
:
Panel
>
7.
</
mx
:
Application
>
更加規范化的寫法是使用腳本定義函數調用
1.
<
mx
:
Application
?
xmlns
:
mx
=
'http://www.macromedia.com/2003/mxml'
>
?
//script
2.
<
mx
:
Script
>
?
3.
<![
CDATA
[
?
4.
function
?
hello
(){
?
?
5.
textarea1
.
text
=
'Hello
?
World'
;
?
6.
?
}
?
7.
]]>
?
8.
</
mx
:
Script
>
?<mx:Panel?title='My?Application'?marginTop='10'?marginBottom='10'
10.?
marginLeft
=
'10'
?
marginRight
=
'10'
?
>
11.?
<
mx
:
TextArea
?
id
=
'textarea1'
/>
12.?
<
mx
:
Button
?
label
=
'Submit'
?
click
=
'hello();'
/>
13.?
</
mx
:
Panel
>
14.?
</
mx
:
Application
>
如果希望多個組件之間可以綁定數據的話,在
Flex
中可以簡單的實現,請注意,在屬性中使用
{ }
標記就表示其中包含的是表達式,而不是字符串。下面的例子,如果
textinput
文本框的內容改變,
textarea
中的內容也會隨之變化。
<
mx
:
Application
?
xmlns
:
mx
=
'http://www.macromedia.com/2003/mxml'
>
2.
<
mx
:
Panel
?
title
=
'My
?
Application'
?
marginTop
=
'10'
?
marginBottom
=
'10'
3.
marginLeft
=
'10'
?
marginRight
=
'10'
?
>
4.
<
mx
:
TextInput
?
id
=
'textinput1'
?
text
=
'Hello'
/>
5.
<
mx
:
TextArea
?
id
=
'textarea1'
?
text
=
''
/>
6.
<
mx
:
Button
?
label
=
'Submit'
?
click
=
'textinput1.text='
Goodbye
';'
/>
7.
</
mx
:
Panel
>
8.
</
mx
:
Application
>
?
1.
Flex
可以和本地或者是遠程服務器端的邏輯進行交互,其方式可以通過如下方式之一:
: WebService
提供基于
SOAP
的
web
服務訪問
2
: HTTPService
提供了基于
HTTP
訪問和數據返回
3
: RemoteObject
基于
AMF
協議訪問
Java
對象
?
posted on 2007-01-12 11:27
???MengChuChen 閱讀(195)
評論(0) 編輯 收藏 所屬分類:
flex2.0