【永恒的瞬间】
☜Give me hapy ☞

//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 阅读(179) 评论(0)  编辑  收藏 所属分类: flex2.0

只有注册用户登录后才能发表评论。


网站导航: