Flex/AS3 内から何を呼び出して、flex-app/web ページがローカル ファイル システム内で実行されているか、または web サーバー (localhost またはリモート サーバー) から提供されたかを教えてくれます。うまくいけば、それは明らかです。Javascript に許容できるものがある場合は、もちろん AS3 関数の方が望ましいでしょう。
2 に答える
1
を使用ExternalInterface
して、アプリの現在の URL を取得し、スキームの文字列を評価できます。
file:///
http://
https://
<?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"
creationComplete="creationCompleteHandler(event)">
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
protected function creationCompleteHandler(event:FlexEvent):void
{
trace(String(ExternalInterface.call(" function(){ return document.location.href.toString();}")));
}
]]>
</fx:Script>
</s:Application>
于 2012-04-05T04:56:39.657 に答える
0
Application クラスには次のプロパティがあります: url
url:文字列 [読み取り専用]
言語バージョン: ActionScript 3.0
製品バージョン: Flex 4
ランタイム バージョン: Flash Player 10、AIR 1.5
このアプリケーションの SWF ファイルのロード元の URL。
実装
public function get url():String
于 2012-04-05T05:12:53.670 に答える