易截截图软件、单文件、免安装、纯绿色、仅160KB

Flex与服务器交互之一(URLRequest +URLLoader应用)

   由于Flex只是一种客户端技术其本身并不能直接同数据库交互,在实际的应用开发过程中Flex提供了如URLRequest、HTTPService、RemoteObject、WebService等类以实现同服务器的通讯和数据交互,下面做一些介绍和实例解析:
   1、使用URLRequest向服务器发送请求,使用URLLoader接收服务器返回的数据:
    URLRequest类可捕获单个 HTTP 请求中的所有信息,可以将 URLRequest 对象传递给 Loader、URLStream 和 URLLoader 类以及其他加载操作的 load() 方法以启动 URL 下载;默认情况下,传递给 url 参数的 URL 必须与执行调用的 SWF 文件在完全相同的域,包括子域。如果要从其它域中加载数据,请在承载数据的服务器上放置一个跨域策略文件。有关URLRequest详细可参看http://help.adobe.com/zh_CN/AIR/1.1/jslr/flash/net/URLRequest.html
   URLVariables类主要用来在应用程序和服务器之间传输参数变量;详细查看:http://livedocs.adobe.com/flex/3_cn/langref/flash/net/URLVariables.html
   URLLoader 类以文本、XML、二进制数据或 URL 编码变量的形式从 URL 返回请求的数据详细请参看:http://livedocs.adobe.com/flex/3_cn/langref/flash/net/URLLoader.html
    完成以下示例要引用到的Flex包:
import mx.rpc.events.FaultEvent;
import mx.collections.XMLListCollection;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.net.URLVariables;
import flash.net.URLRequestMethod;
import flash.events.Event;
import mx.utils.URLUtil;
import mx.collections.ArrayCollection;
import mx.rpc.events.ResultEvent;
import com.adobe.serialization.json.JSON;

   2、应用示例一:通过URLRequest和URLVariables向服务器发送参数请求并返回服务器文本数据(以下服务器端都采用asp.net编写)
   服务器端代码:
protected void Page_Load(object sender, EventArgs e)
{
//获取URLResuest请求回的参数 返回数据用;分隔以方便Flex对数据进行序列化
string rs = String.Format("name={0};age={1};address={2}",Request.QueryString["name"],


相关文档:

flex时序图示例

<?xml version="1.0" encoding="utf-8"?>
<!-- Simple example to demonstrate the DateTimeAxis class. -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>

import mx.collections.ArrayCollection;
......

flex 中GML转换

package org.openscales.core.format
{
 import flash.utils.getQualifiedClassName;
 import flash.xml.XMLNode;
 import org.openscales.core.Util;
 import org.openscales.core.feature.Feature;
 import org.openscales.core.geometry.Collection;
 import org.openscales.core. ......

在Flex中的更改滚动条的外观

HScrollBar {
downArrowUpSkin:
Embed(source=”/assets/downArrow.png”);
downArrowOverSkin:
Embed(source=”/assets/downArrow.png”);
downArrowDownSkin:
Embed(source=”/assets/downArrow.png”);
upArrowUpSkin:
Embed(source=”/assets/upArrow.png”);
upArro ......

FABridge教程(Flex+Ajax) 2

使用js来操作flex
首先在fademo.mxml中声明一个button,并添加一个btnClick方法:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="l ......

常用的Flex代码总结

常用的Flex代码总结
1.刷新浏览器

  navigateToURL(new URLRequest("javascript:location.reload();"),"_self")

  2.关闭浏览器

  navigateToURL(new URLRequest("javascript:window.close()"),"_self");

  3.打开一个新浏览器窗口

  navigateToURL(new URLRequest('ht ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号