OK!

So creating an instance of the event in application complete did the trick. 
Also I changed the root "event" folder to "events" as it was causing problems 
when the as was converted to javascript.


On 2021/03/12 21:30:48, David Slotemaker de Bruine 
<dslotema...@vicensvives.com> wrote: 
> It's not working in either. I will try as you suggest. Thanks!
> 
> On Fri., 12 Mar. 2021, 22:28 Greg Dove, <greg.d...@gmail.com> wrote:
> 
> >
> > Hi David,
> >
> > Is it working in debug build, but perhaps not in release?
> >
> > You might need to include a concrete reference to the class. If
> > event.common.CommonEvent is not actually present in the build, then the
> > reflective access to the class will fail. you may need to force a reference
> > to the class in the build. I often do this in something like this at
> > startup:
> >
> > package {
> > import  event.common.CommonEvent;
> > public class ForceCompilation {
> >
> > public static function get forcedClasses():Array{
> >    return [CommonEvent, /* add others as needed */];
> > }
> > }
> >
> > }
> >
> >
> > Then in the applicationComplete or preInit or some startup part of the
> > sequence:
> > var forcedClasses:Array =  ForceCompilation.forcedClasses;
> >
> > See if something like that helps... good luck.
> > Greg
> >
> >
> > On Sat, Mar 13, 2021 at 9:59 AM David Slotemaker de Bruine <
> > dslotema...@vicensvives.com> wrote:
> >
> >>   Hi all,
> >>
> >> I have the following defined in my App.mxml
> >>
> >> <crux:CruxConfig
> >>
> >> eventPackages="event.common.*,event.usuario.*,event.cliente.*,event.varpedido.*"
> >>
> >> viewPackages="view.*,view.cliente.*,view.usuario.*,view.varpedido.*"/>
> >>             </crux:config>
> >>
> >> But I am getting this error when running the app:
> >>
> >> Uncaught Error: Could not get a reference to class for
> >> CommonEvent.EVENT_CARGAR_CONFIGURACIONES. Did you specify its package in
> >> cruxConfig::eventPackages?
> >>
> >> Events for event.usuario.*,event.cliente.* are working fine. What could I
> >> be missing?
> >>
> >>
> >> The Event class is:
> >>
> >> package event.common
> >> {
> >>         import org.apache.royale.events.Event;
> >>
> >>                 public class CommonEvent extends Event
> >>                 {
> >>                         public static const
> >> EVENT_CARGAR_CONFIGURACIONES:String = "eventCargarConfiguraciones";
> >>                         public static const
> >> EVENT_CARGAR_PROMOTORES_DED_ELEGADO:String =
> >> "eventCargarPromotoresDeDelegado";
> >>
> >>                         public var id:Number;
> >>                         public var idDelegado:Number;
> >>
> >>                         public function CommonEvent( type:String )
> >>                         {
> >>                                 super( type, true );
> >>                         }
> >>                 }
> >> }
> >>
> >> Cheers,
> >>
> >> David
> >>
> >
> 

Reply via email to