Hello Daniel,
I think you are looking for either parentApplication or parentDocument. These will get you access to the parent's scope. mx.core.Application.application will always get you to the top level application.
 
The help docs can explain usage better than I can.
 
Also callLater() might be useful to look into, if you run into problems like creationComplete vs. applicationComplete again.
 
HTH,
Derek
 
-----Original Message-----
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED]On Behalf Of Daniel Wabyick
Sent: Friday, September 01, 2006 12:20 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Finding the root clip + getting the URL

Thanks John,

That definitely works, although I was curious how to do this using
non-Flex API calls. I figured out that part of my problem is that at
creationComplete(), the Application is not added to the display-list,
and thus you can't find out the root or stage. So, I changed the
example to applicationComplete, and at that point the stage, root, and
loaderInfo objects are defined and you can access them.

My next question - how do you find the base URL in a data class with no
reference to a DisplayObject? It seems like you need to get access to
the global display list, but I am unsure how to do that.

Working code to access the url and stage.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute" applicationComplete="{ showURL(); }">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
private function showURL() : void
{
Alert.show( "url: " + this.loaderInfo.url + " stage: " +
this.stage );
}
]]>
</mx:Script>
</mx:Application>

John Grden wrote:
> application.url is what you're looking for
>
> Look at mx.core.Application properties
>
> hth,
>
> JPG
>
>
> On 8/31/06, *Daniel Wabyick* <[EMAIL PROTECTED]com
> <mailto:[EMAIL PROTECTED]com>> wrote:
>
> I am trying to find the URL in which an application is running.
> Reading
> the documentation, I get the impression that I can use the "root"
> property off on any DisplayObject, and then get the loaderInfo
> from there.
>
> Unfortunately, the root property seems to be null. I must be doing
> something wrong. Can someone help?
>
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml
> <http://www.adobe.com/2006/mxml>"
> layout="absolute" creationComplete="{ showRoot(); }">
>
> <mx:Script>
> <![CDATA[
> import mx.controls.Alert;
> private function showRoot() : void
> {
> Alert.show( "root: " + this.root );
> }
> ]]>
> </mx:Script>
>
>
> </mx:Application>
>
>
>
>
> --
> [ JPG ]
>



__________ NOD32 1.1735 (20060901) Information __________

This message was checked by NOD32 antivirus system.
http://www.eset.com
__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to