I'm pretty sure in related threads I mentioned that a preloader is needed.

-Alex

On 6/26/19, 8:16 AM, "Carlos Rovira" <[email protected]> wrote:

    Thanks Spiros,
    
    My real problem is the following. I'm trying to improve Modules. I found
    that inject_html don't work with modules, Inject_html is processed by
    compiler. To solve in an easy way I'm trying to load CSS and JS with
    javascript appending to head.
    
    When I load the module and I use a class that needs to attach some JS, I
    want to run a function like "loadJavascript"
    
    I created as well "loadCSS" (still not commited).
    
    The real use case I'm trying is to use MaterialIconType, that was using
    inject_html. I removed the inject_html directive,
    then added
    
    
loadCSS('https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Ffonts.googleapis.com%2Ficon%3Ffamily%3DMaterial%2BIcons&amp;data=02%7C01%7Caharui%40adobe.com%7C25b97d52ac98496b4e9a08d6fa49476e%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636971590001069684&amp;sdata=5KVxS4gVhXKdEWWOyG3xmHXTPKNV70OPkE7bCZsYn0g%3D&amp;reserved=0');
    
    in the constructor
    
    then in my real module I want just to use as always
    
    <js:FontIcon text="{MaterialIconType.SEARCH}" material="true"/>
    
    accesing this way does not run the constructor, so the loadCSS code does
    not run :(
    
    
    We have hundreds of public static vars like
    
    public static const SEARCH:String = 'search';
    
    So I think the current way you propose, although valid, will not be the
    best here, since will means lots of lines of code.
    
    But thanks for your suggestion
    
    Hope others could give as well some ideas on how to solve this
    
    thanks
    
    
    
    El mié., 26 jun. 2019 a las 17:05, spiros (<[email protected]>) escribió:
    
    > It is possible with static getter and seter.
    >
    > Maybe will help you the code below
    >
    > Spiros.
    >
    > public class Variable
    >         {
    >
    >                 private static var _textData:String;
    >
    >                 public static function get textData():String
    >                 {
    >                         if( _textData ==null)
    >                         {
    >                                 initailizeVariable();
    >                         }
    >                         return _textData;
    >                 }
    >
    >                 public static function set textData(value:String):void
    >                 {
    >                         _textData = value;
    >                 }
    >
    >                 public static function initailizeVariable():void
    >                 {
    >                         _textData = "The quick brown fox jump over the
    > lazy dog.";
    >                 }
    >
    >
    >                 public function Variable()
    >                 {
    >                 }
    >         }
    >
    >
    >
    >
    >
    > -----Original Message-----
    > From: Carlos Rovira [mailto:[email protected]]
    > Sent: Wednesday, June 26, 2019 5:49 PM
    > To: [email protected]
    > Subject: Trying to run a function on a class that is not instantiated
    >
    > Hi,
    >
    > I need to run a function when I access a public static var in a class.
    > Trying to run the function in the constructor seems not to work since
    > there's no instance of that class. Do we have some way to do this?
    >
    > --
    > Carlos Rovira
    > 
https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fabout.me%2Fcarlosrovira&amp;data=02%7C01%7Caharui%40adobe.com%7C25b97d52ac98496b4e9a08d6fa49476e%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636971590001079678&amp;sdata=kd8i%2FuPoxvRf9f%2FLW2DSgk6yvnBdtgKtRkP%2BeRIj%2FWs%3D&amp;reserved=0
    >
    >
    
    -- 
    Carlos Rovira
    
https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fabout.me%2Fcarlosrovira&amp;data=02%7C01%7Caharui%40adobe.com%7C25b97d52ac98496b4e9a08d6fa49476e%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636971590001079678&amp;sdata=kd8i%2FuPoxvRf9f%2FLW2DSgk6yvnBdtgKtRkP%2BeRIj%2FWs%3D&amp;reserved=0
    

Reply via email to