View Full Version : I am a Flex app. Where am I?
Trioxera
04-14-2008, 08:29 PM
When a Flex application is wrapped in an html file, and uploaded to a web server. Is there any way to know the path, the directory, the url, or something from inside the Flex application?
I need this information to activate preferences depending on the folder the application is hosted.
Regards:
Jeremy.
wvxvw
04-14-2008, 09:00 PM
var xml:XML = <xml>
<script>
<![CDATA[
function getPageLocation(){
return document.location.href;
}
]]>
</script>
</xml>;
var pURL:String = ExternalInterface.call(xml.script);
ExternalInterface.call('alert',pURL);
But if you can not use ExternalInterface, than there's no way...
Trioxera
04-14-2008, 09:52 PM
Thank you! It works just out of the box!
I know nothing about ExternalInterface, so I don't understand the concern about ExternalInterface. Security?, compatibility?
Regards:
Jeremy
wvxvw
04-14-2008, 10:28 PM
If in the page that embeds SWF the allowScriptAcces is set to 'never' it won't work... By default it's 'sameDomain', but, if someone, not you will try to use your app, than he may set allowScriptAcces to whatever he wants...
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.