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");
Ïà¹ØÎĵµ£º
×î½üÓöµ½ÁËflex µÄ°²È«É³ÏäÎÊÌ⣬ÕÒÁ˺ܶà×ÊÁÏ·¢ÏÖ²»ÊǶ¼ÊǺÍÎÒ£¬ÎҵijÌÐòÐèÒªsocketÁ¬½Ó£¬¶ø´ó¶àÊý½²µÄ¶¼ÊÇ¿çÓòÎļþ¶ÁÈ¡µÄ¡£ÎÒÏȰÑÁ½ÖÖ·½·¨¶¼×ܽá³öÀ´£º
¿çÓòÎļþ¶ÁÈ¡
·½·¨Ò»£ºÔÚÄ¿±ê·þÎñÆ÷Éϲ¼Êðcrossdomain.xmlÎļþ(ÎÒÓõĴ˷½·¨ºÜ¹ÜÓ㬷ÅÉϾÍûÎÊÌâÁË) ÐèÒªÔ¶³Ì·þÎñ¸ùĿ¼¶¨ÒåÓÐcrossdomain.xmlÎļþ£¬ÈçÏ£º
<?x ......
¸ÅÒª
µ±ÎÒÃǼÓÔØÍⲿswfʱ£¬±ØÐëÒªÁ˽âÓ¦ÓóÌÐòÓò(Application Domain)¡£´ÓAdobe¹Ù·½ÎļþÖУ¬ÎÒÃÇ¿ÉÒÔµÃÖªÓ¦ÓóÌÐòÓòÄܹ»°Ñ´¦ÓÚͬһ¸ö°²È«Óò(Security Domain)ÖеÄÀà·ÖÀ뿪£¬ÕâÑù¾Í¿ÉÒÔÈÃÒ»¸öÀàµÄ¶à¸ö¶¨Òå¹²´æ£¬»òÊÇÈöà¸ö×ÓÓ¦ÓÃÀ´¹²Ïí¸¸Ó¦ÓõÄÀඨÒå¡£¼òµ¥µãÀí½â¾ÍÊÇÓ¦ÓóÌÐòÓòΪÀඨÒåÌṩÁË·ÖÇø¹¦ÄÜ¡£
Ó¦ÓóÌÐòÓò
Ò»¸ ......
±¾ÕÂÊÇFlex 4 SDK ÐÂÌØÐԽ̳ÌϵÁеĵÚ4Õ¡£±¾Õ½éÉÜÁËMXML 2009ÐÂÔöµÄ±êÇ©£¬°üÀ¨£º
Declarations
Vector
Library
Definition
Private
Reparent
<Declarations />
Declarations±êÇ©ÊÇFlex 4ÖÐ×î³£ÓõÄÐÂÔö±êÇ©¡£
ÔÚFlex 3ÖУ¬¶ÔÓÚÒ»¸öMXML×é¼þµÄÖ±½Ó×ÓÔªËØ£¬¿ÉÒÔÓÐÒÔϼ¸ÖÖÇé¿ö£º
1. ÊôÐÔ±êÇ©£¬ÀýÈ磺
< ......
·þÎñÆ÷¶Ë´úÂë,amfphpµÄservicesĿ¼Ï½¨Á¢readData.phpÎļþ,´úÂëÈçÏÂ
<?php
class ReadDB
{
function getData()
&nb ......