You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@royale.apache.org by GitBox <gi...@apache.org> on 2022/01/30 02:40:56 UTC

[GitHub] [royale-asjs] mjesteve commented on issue #1176: RegisterClassAlias called before it loaded into index.html

mjesteve commented on issue #1176:
URL: https://github.com/apache/royale-asjs/issues/1176#issuecomment-1025054874


   Hi Pashmina, I think the problem is inside the .as file.
   You can't make the call to a function, in this case "registerClassAlias", if it is not inside another method.
   Change the content of the .as file for this one:
   
   ```
   import org.apache.royale.reflection.registerClassAlias;
   import com.epsdr.model.QueryInfo;
   
   /** registering class to use. **************************************/
   
   private var queryInfo:QueryInfo;
   
   private function init():void
   {
       registerClassAlias("EPS.Model.QueryInfo", QueryInfo);
       example()    
   }
   
   private function example():void
   {
       var item:QueryInfo = new QueryInfo();
       item.AppealID=1;
       trace(item.AppealID);
   }
   ```
   And in the mxml add the call to the init() method:
   
   ```
   <mx:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:mx="library://ns.apache.org/royale/mx"
                   xmlns:js="library://ns.apache.org/royale/basic"
   				width="600" height="400"
               	initialize="init()">
   ```
   You will see how it works.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@royale.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org