I do something similar in my arp extensions to force "command" classes defined 
in an xml document to be loaded at runtime.  I use the -pack feature of mtasc 
that forces classes from a package into your swf.

so if you wanted force all the classes in com.bluetube.command into your swf 
you would pass 
-pack com\bluetube\command to mtasc.

I hate having to put a dummy constructor or fluff in the code to make it work, 
I prefer the mtasc approach.

Grant.

----- Original Message -----
From: Cdric_Muller [EMAIL PROTECTED]
To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: 2/2/06 7:18 AM
Subject: Re: [Flashcoders] mx.utils.ClassFinder.findClass problem

> but please, remember that this is a Flash Hack with a lot of whack  
> and crack :)
> you're welcome!
> cedric
> 
> > This works Cedric, thank you very much :)
> > All of you
> >
> > On 2/2/06, Cédric Muller  wrote:
> >> in your .as file (main class, or classesManger,...) you can simply
> >> put references to the classes you will/should use ...
> >>
> >> I did it once the following way:
> >>
> >> /**
> >> *       setPackagesToImport
> >> *       fake method, never gets called. just here for 'import' +  
> >> reference
> >> purposes
> >> *
> >> */
> >>
> >> private function setPackagesToImport ():Void {
> >>         sk.sowhat.linuxPlayer. ScreenEffects;
> >>         sk.sowhat.linuxPlayer.ScreenVideo;
> >>         sk.sowhat.linuxPlayer.Screen;
> >>         sk.sowhat.linuxPlayer.HelperFunctions;
> >>         // and so on ...
> >> }
> >>
> >> with such, you assure yourself that Flash will include the
> >> classes ..... not very official, nor clean, but really worked for me
> >> (as I had to reference the classes paths through xml....)
> >> cedric
> >>
> >>> Yes it works
> >>> var dummyVar:Function=sk.sowhat.linuxPlayer.play4dogs.Test; (with
> >>> no import)
> >>>
> >>> this is not problem
> >>>
> >>> but i create instance dynamicly, i got string in XML
> >>> "sk.sowhat.linuxPlayer.play4dogs.Test"
> >>> and i need create instance, but application doesnt know which  
> >>> classes
> >>> will be instantiated, so i cannot create instance of all possible
> >>> class in initialize phase of application
> >>>
> >>>
> >>>
> >>> On 2/2/06, franto  wrote:
> >>>> but Ian, why it find other classes, i dont instantiate any of  
> >>>> class,
> >>>> that code you can see in email is everything, and it has found 15
> >>>> classes, but 3 doesnt find
> >>>>
> >>>> Classes found: 15
> >>>> Classes not found: 3
> >>>>
> >>>> Why?
> >>>>
> >>>> On 2/2/06, Ian Thomas  wrote:
> >>>>> Hi Franto,
> >>>>>
> >>>>> As far as I understand it, 'import' isn't enough to get a class
> >>>>> compiled
> >>>>> into your .swf.
> >>>>>
> >>>>> The line:
> >>>>> import sk.sowhat.linuxPlayer.play4dogs.Test;
> >>>>> just tells the compiler that any mention of the word Test in your
> >>>>> code will
> >>>>> refer to that class.
> >>>>>
> >>>>> If the class isn't compiled into the SWF, ClassFinder won't find
> >>>>> it. You
> >>>>> actually need to access  or instantiate the class somewhere in
> >>>>> the code to
> >>>>> make Flash include it. From memory I think just referring to the
> >>>>> class
> >>>>> constructor is enough e.g.
> >>>>>
> >>>>> import sk.sowhat.linuxPlayer.play4dogs.Test;
> >>>>>
> >>>>> var dummyVar:Function=sk.sowhat.linuxPlayer.play4dogs.Test; //
> >>>>> somewhere
> >>>>> later in the code
> >>>>>
> >>>>> I also have a vague memory that you might be able to force MTASC
> >>>>> to include
> >>>>> classes, but not being a user of MTASC (yet!) I'm not certain on
> >>>>> that one.
> >>>>>
> >>>>> HTH,
> >>>>>   Ian
> >>>>>
> >>>>> P.S.
> >>>>> You may just get away with
> >>>>> import sk.sowhat.linuxPlayer.play4dogs.Test;
> >>>>>
> >>>>> sk.sowhat.linuxPlayer.play4dogs.Test; // refers to the
> >>>>> constructor, so Flash
> >>>>> includes the code
> >>>>>
> >>>>> I seem to remember reading that somewhere... although
> >>>>> syntactically it's
> >>>>> odd.
> >>>>>
> >>>>> On 2/2/06, franto  wrote:
> >>>>>>
> >>>>>> Can someone explain me this?
> >>>>>> Im using mx.utils.ClassFinder.findClass to find class and make
> >>>>>> instance
> >>>>>> from it
> >>>>>> but some classes it cant find, it's not just problem of
> >>>>>> "mx.utils.ClassFinder.findClass" im using another way to create
> >>>>>> dynamic class (as I wrote yesterday to the list)
> >>>>>> but same classes are not found e.g
> >>>>>>
> >>>>>> sk.sowhat.linuxPlayer.play4dogs.Test
> >>>>>>
> >>>>>> but when I create instance in this way
> >>>>>>
> >>>>>> new sk.sowhat.linuxPlayer.play4dogs.Test()
> >>>>>>
> >>>>>> it is created!!! Can someone tell me why? I try all I know, add
> >>>>>> imports and such but nothing
> >>>>>> help me. Im stuck on this for 8 hours now :( and i have to find
> >>>>>> solution
> >>>>>>
> >>>>>> Please help :)
> >>>>>>
> >>>>>> Maybe you can try it on your own projects, if it will find your
> >>>>>> classes
> >>>>>>
> >>>>>> Thank you
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>> _______________________________________________
> >>>>> Flashcoders mailing list
> >>>>> Flashcoders@chattyfig.figleaf.com
> >>>>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >>>>>
> >>>>
> >>>>
> >>>> --
> >>>> ------------------------------------------------------------------- 
> >>>> --
> >>>> ------------------------------------------------------------------- 
> >>>> --
> >>>> -----------------------
> >>>> Franto
> >>>>
> >>>> http://blog.franto.com
> >>>> http://www.flashcoders.sk
> >>>>
> >>>
> >>>
> >>> --
> >>> -------------------------------------------------------------------- 
> >>> --
> >>> -------------------------------------------------------------------- 
> >>> --
> >>> ---------------------
> >>> Franto
> >>>
> >>> http://blog.franto.com
> >>> http://www.flashcoders.sk
> >>> _______________________________________________
> >>> Flashcoders mailing list
> >>> Flashcoders@chattyfig.figleaf.com
> >>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >>
> >> _______________________________________________
> >> Flashcoders mailing list
> >> Flashcoders@chattyfig.figleaf.com
> >> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >>
> >
> >
> > --
> > ---------------------------------------------------------------------- 
> > ---------------------------------------------------------------------- 
> > ---------------------
> > Franto
> >
> > http://blog.franto.com
> > http://www.flashcoders.sk
> > _______________________________________________
> > Flashcoders mailing list
> > Flashcoders@chattyfig.figleaf.com
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> 
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to