My getInsttance look like this:

public static function getInstance() : TimelineModelLocator
{
  if ( modelLocator == null ){
    modelLocator = new TimelineModelLocator();
  }         
  return modelLocator;
}

I found a solution, i in my first application i create a loadcontext:
#[Bindable]
#public var lc:LoaderContext= new
#LoaderContext(false,flash.system.ApplicationDomain.currentDomain);
and when i load i pass this loadercontext to the SWFLoader, it's working:
#<mx:SWFLoader loaderContext="{lc}"  id="viewer"  width="100%" 
#height="100%" complete="onCompleteMyLoader();"/>

I think now all variable are save in the same context, same root...


--- In flexcoders@yahoogroups.com, "Brian Holmes" <[EMAIL PROTECTED]>
wrote:
>
> If you have two applications that need to share the same variable, look
> into creating a RSL where the singleton can exist safely and everyone
> knows where to go get it. 
> 
>  
> 
> If you're using an application shell and loading modules you can create
> a static class or variable to house the singleton. 
> 
>  
> 
>  
> 
> ________________________________
> 
> From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
> Behalf Of Manish Jethani
> Sent: Wednesday, April 25, 2007 3:32 PM
> To: flexcoders@yahoogroups.com
> Subject: Re: [flexcoders] One Singleton many application
> 
>  
> 
> Why, this works perfectly well in flex 2.0. I don't remember if
> something changed in flex 2.01 but I don't think so.
> 
> What does your getInstance() look like?
> 
> On 4/25/07, nxzone <[EMAIL PROTECTED] <mailto:nxzone%40yahoo.ca> > wrote:
> > How can i have only one Singleton if i have two applications. I want
> > share the same singleton from the parent application
> >
> > Application1
> > {
> > var singleton:ShareThis = ShareThis.getInstance()
> >
> > function init(){
> > singleton.name="test"
> > SWFLoader.source="application2.swf"
> > }
> >
> > }
> > -----
> > Application2
> > {
> > var singleton:ShareThis = ShareThis.getInstance()
> >
> > function init(){
> > trace(singleton.name) // give null
> > }
> >
> > }
> >
> >
> >
> >
> >
> >
> > --
> > Flexcoders Mailing List
> > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> <http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt> 
> > Search Archives:
> http://www.mail-archive.com/flexcoders%40yahoogroups.com
> <http://www.mail-archive.com/flexcoders%40yahoogroups.com> 
> > Yahoo! Groups Links
> >
> >
> >
> >
> 
>  
> 
> 
> 
> ***
> The information in this e-mail is confidential and intended solely
for the individual or entity to whom it is addressed.  If you have
received this e-mail in error please notify the sender by return
e-mail delete this e-mail and refrain from any disclosure or action
based on the information.
> ***
>


Reply via email to