| 包 | flash.net |
| 类 | public dynamic class URLVariables |
| 继承 | URLVariables Object |
| 语言版本: | ActionScript 3.0 |
| 运行时版本: | AIR 1.0 Flash Player 9 |
data 属性和 flash.net 包函数一起使用。
另请参见
| 方法 | 定义方 | ||
|---|---|---|---|
URLVariables(source:String = null) 创建一个新的 URLVariables 对象。 | URLVariables | ||
将变量字符串转换为指定 URLVariables 对象的属性。 | URLVariables | ||
![]() |
指示对象是否已经定义了指定的属性。 | Object | |
![]() |
指示 Object 类的实例是否在指定为参数的对象的原型链中。 | Object | |
![]() |
指示指定的属性是否存在、是否可枚举。 | Object | |
![]() |
设置循环操作动态属性的可用性。 | Object | |
以 MIME 内容编码格式 application/x-www-form-urlencoded 返回包含所有可枚举变量的字符串。 | URLVariables | ||
![]() |
返回指定对象的原始值。 | Object | |
| URLVariables | () | 构造函数 |
public function URLVariables(source:String = null)| 语言版本: | ActionScript 3.0 |
| 运行时版本: | AIR 1.0 Flash Player 9 |
创建一个新的 URLVariables 对象。将 URLVariables 对象传递给 URLRequest 对象的 data 属性。
如果使用字符串来调用 URLVariables 构造函数,将自动调用 decode() 方法,以将该字符串转换成 URLVariables 对象的属性。
source:String (default = null) — 包含名称/值对的 URL 编码的字符串。 |
| decode | () | 方法 |
public function decode(source:String):void| 语言版本: | ActionScript 3.0 |
| 运行时版本: | AIR 1.0 Flash Player 9 |
将变量字符串转换为指定 URLVariables 对象的属性。
该方法供 URLVariables 事件内部使用。绝大多数用户无需直接调用此方法。
参数
source:String — 包含名称/值对的 URL 编码的查询字符串。 |
Error — 源参数必须是包含名称/值对的 URL 编码的查询字符串。 |
另请参见
| toString | () | 方法 |
public function toString():String| 语言版本: | ActionScript 3.0 |
| 运行时版本: | AIR 1.0 Flash Player 9 |
以 MIME 内容编码格式 application/x-www-form-urlencoded 返回包含所有可枚举变量的字符串。
返回String — 包含名称/值对的 URL 编码的字符串。 |
该示例的要点遵循:
request 的 URLRequest 实例,同时将远程应用程序的 URL 作为参数。
data 属性。
navigateToURL,在一个新的浏览器窗口中打开远程应用程序的 URL。
注意:若要运行该示例,必须将该示例中的远程应用程序 URL 替换为工作 URL。此外,需要用服务器代码处理 Flash Player 在 URLVariables 对象中捕获的信息。
package {
import flash.display.Sprite;
import flash.net.navigateToURL;
import flash.net.URLRequest;
import flash.net.URLVariables;
public class URLVariablesExample extends Sprite {
public function URLVariablesExample() {
var url:String = "http://www.[yourDomain].com/application.jsp";
var request:URLRequest = new URLRequest(url);
var variables:URLVariables = new URLVariables();
variables.exampleSessionId = new Date().getTime();
variables.exampleUserLabel = "guest";
request.data = variables;
navigateToURL(request);
}
}
}