Flex读取浏览器参数
这个类提供的功能有:
从浏览器中获取完整的URL
主机名
当前所使用的协议
端口
主域名后面的路径
参数值
原文地址:http://www.flexpasta.com/index.php/2008/03/15/getting-url-parameters-host-name-port-in-flex-actionscript/
package com.flexpasta.utils
{
import flash.external.ExternalInterface;
import mx.core.Application;
import mx.collections.ArrayCollection;
import mx.controls.Alert;
public class HTTPUtil
{
//--------------------------------------------------------------------------
//
// Constructor
//
//--------------------------------------------------------------------------
/**
* @private
*/
public function HTTPUtil()
{
super();
}
/**
* Returns the current url that the swf player lives in
*
*/
public static function getUrl():String
{
return ExternalInterface.call("window.location.href.toString");
}
/**
* Returns the current host name.
* example: http://www.flexpasta.com/?x=1&y=2 would return www.flexpasta.com
*/
public static function getHostName():String
{
return ExternalInterface.call("window.location.hostname.toString");
}
/**
* Returns the current protocol, such as http:, https:, etc
*
*/
public static function getProtocol():String
{
return ExternalInterface.call("window.location.protocol.toString");
}
/**
* Gets the current port for the url
*/
public static function getPort():String
{
return ExternalInterface.call("window.location.port.toString");
}
/**
* Gets the context following the base of the url
* Example http://www.flexpasta.com/test?x=1&y=2 would return /test
*/
public static function getContext():String
{
return ExternalInterface.call("window.location.pathname.toString");
相关文档:
注:第一列是带Checkbox的Tree。
还有问题请教各位:
labelField是元素对象的属性是显示不了(carInfo.car_name),好像只可显示同级的属性怎么解决?希望各位能帮助我,Thanks!
<mx:AdvancedDataGrid id="adg" width="100%" height="100%" dataProvider="{instance.cars}"
&n ......
Flex端代码:
<?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="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
>
<fx:Script>
<!--[C ......
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
width="550" height="400">
<mx:Script>
<![CDATA[
&n ......
服务器端代码,amfphp的services目录下建立readData.php文件,代码如下
<?php
class ReadDB
{
function getData()
&nb ......