A preloader that could be dropped into multiple projects and configured using 
dependency injection would be a useful feature imo, one that wasn't necessarily 
dependent on a full blown MVC framework.

To: [email protected]
From: [email protected]
Date: Tue, 9 Aug 2011 11:11:12 -0700
Subject: Re: [flexcoders] Inject dependency into Flex application preloader


















 



  


    
      
      
      

You can write your code like that, but what code would set those values?  None 
of the MVC frameworks I know of are running when the preloader is running.  
That’s the point of the preloader.  It is framework independent and very 
lightweight so you can view something while the rest of the frameworks get 
downloaded and initialized.



There are two phases to the preloader: download and initialize.  You could 
probably set something in the initializing phase if you really want to.





On 8/9/11 11:00 AM, "Philip Smith" <[email protected]> wrote:



 

 

 

   



But in essence, going back to your example, there is no capacity to inject 
'MyInjectClass' with a public setter?



Public class MyDownloadProgressBar extends SparkDownloadProgressBar

{

    private var _injectedClass:MyInjectClass;

    private var _preloaderModel:PreloaderModel;



   public function set injectedClass(value:MyInjectClass):void

   {

         this._injectedClass = value;

   }



   public function set preloaderModel(value:PreloaderModel):void

  {

      this._preloaderModel = value;

  }

}



Ideally we would like to have a generic custom preloader component with an MVC 
structure that uses dependency injection.



To: [email protected]

From: [email protected]

Date: Tue, 9 Aug 2011 10:39:41 -0700

Subject: Re: [flexcoders] Inject dependency into Flex application preloader



 

 

 

   The preloader is instantiated long before the application.  The app’s 
preloader property isn’t used at runtime, the compiler generates special code 
for it.



A preloader can certainly examine its environment and do different things.  
There are a few custom preloaders on my blogs.





On 8/9/11 10:21 AM, "Philip Smith" <[email protected] 
<http://[email protected]> > wrote:





 

 

 

   



We'd like to inject some values into the application preloader instance:



<s:Application preloader="com.storefront.editorhost.app.CustomPreloader">



Is it possible to do something like this hypothetical example: 



(application.preloader as CustomPreloader).preloaderModel = new 
PreloaderModel();



Or pass in properties, similar to how it's done with item renderers and 
'ClassFactory' properties?







To: [email protected] <http://[email protected]> 

From: [email protected] <http://[email protected]> 

Date: Tue, 9 Aug 2011 10:05:04 -0700

Subject: Re: [flexcoders] Inject dependency into Flex application preloader



 

 

 

   Public class MyDownloadProgressBar extends SparkDownloadProgressBar

{

    private var injectedClass:MyInjectClass;

}





On 8/9/11 9:35 AM, "Philip Smith" <[email protected] 
<http://[email protected]>  <http://[email protected] 
<http://hotmail.com> > > wrote:





 

 

 

   



> You can inject certain kinds of dependencies as long as they don’t drag in 
> UIComponent.



Can you provide an example of this, Alex?



To: [email protected] <http://[email protected]>  
<http://[email protected] <http://yahoogroups.com> > 

From: [email protected] <http://[email protected]>  <http://[email protected] 
<http://adobe.com> > 

Date: Mon, 8 Aug 2011 22:13:34 -0700

Subject: Re: [flexcoders] Inject dependency into Flex application preloader



 

 

 

   You can inject certain kinds of dependencies as long as they don’t drag in 
UIComponent.





On 8/8/11 4:29 PM, "method_air" <[email protected] 
<http://[email protected]>  <http://[email protected] 
<http://hotmail.com> >  <http://[email protected] <http://hotmail.com>  
<http://hotmail.com> > > wrote:





 

 

 

   



Is it possible?



<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"

   preloader="com.storefront.editorhost.app.ProgressPreloader"

   >



Cheers,



Philip



 

   







-- 

Alex Harui

Flex SDK Team

Adobe System, Inc.

http://blogs.adobe.com/aharui







    
     

    
    






                                          

Reply via email to