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 的安全沙箱问题,找了很多资料发现不是都是和我,我的程序需要socket连接,而大多数讲的都是跨域文件读取的。我先把两种方法都总结出来:
跨域文件读取
方法一:在目标服务器上布署crossdomain.xml文件(我用的此方法很管用,放上就没问题了) 需要远程服务根目录定义有crossdomain.xml文件,如下:
<?x ......
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
width="550" height="400">
<mx:Script>
<![CDATA[
&n ......
这是Flex 4 SDK 新特性教程系列的第3章。本章介绍了Flex 4引入的MXML 2009命名空间以及Flex组件与命名空间映射的机制。
Flex 3的命名空间
Flex 3定义了唯一的MXML命名空间,即MXML 2006。在Flex Builder 3中声明MXML 2006命名空间的默认格式如下:
xmlns:mx="http://www.adobe.com/2006/mxml"
值得注意的是,很多初学者 ......
首先:确定数据库的编码为utf8,正常储存中文(用MySQL-Front查看中文是否正常)
然后:Services查询MySQL时使用"SET NAMES 'utf8'",且通过"amfphp/browser"运行看看是否中文,如果乱码则修改gateway.php文件,去掉 $gateway->setCharsetHandler("utf8_decode", "ISO-8859-1", "ISO-8859-1");
最后:运行Flex程序显 ......