Re: [Flashcoders] Dynamic class instantiation

2008-04-04 Thread Ian Thomas
Yes. Ian On Fri, Apr 4, 2008 at 7:08 PM, Jiri Heitlager <[EMAIL PROTECTED]> wrote: > But either way, do you still need to force to compiler to add the class? I > am almost sure you do, but asking just in case. > > Jiri > > > > Hans Wichman wrote: > > > btw new eval("_global.myPackage.MyClass")(

Re: [Flashcoders] Dynamic class instantiation

2008-04-04 Thread Jiri Heitlager
But either way, do you still need to force to compiler to add the class? I am almost sure you do, but asking just in case. Jiri Hans Wichman wrote: btw new eval("_global.myPackage.MyClass")(); does the trick as well. If you please add Assert.assertNotNull (eval("_global.myPackage.MyClass")) et

Re: [Flashcoders] Dynamic class instantiation

2008-04-04 Thread Hans Wichman
btw new eval("_global.myPackage.MyClass")(); does the trick as well. If you please add Assert.assertNotNull (eval("_global.myPackage.MyClass")) etc On Fri, Apr 4, 2008 at 5:01 PM, Jiri Heitlager <[EMAIL PROTECTED]> wrote: > Thanx Alan, using a custom error exception is a nice little added touch :)

Re: [Flashcoders] Dynamic class instantiation

2008-04-04 Thread Jiri Heitlager
Thanx Alan, using a custom error exception is a nice little added touch :) Jiri Alan MacDougall wrote: Here is the class I use for dynamic instantiation. Note that it throws a custom exception type, you'll have to create that type yourself or alter that line of code. I copied the instantiation

Re: [Flashcoders] Dynamic class instantiation

2008-04-04 Thread Alan MacDougall
Here is the class I use for dynamic instantiation. Note that it throws a custom exception type, you'll have to create that type yourself or alter that line of code. I copied the instantiation technique from Drew Cummins at blog.generalrelativity.org. class com.phoenixgp.common.utils.ClassLoade

Re: [Flashcoders] Dynamic class instantiation

2008-04-04 Thread Jiri Heitlager
OK, I understand, without it the classes dont exist and therefor equals to null. Cheers! Ian Thomas wrote: Are you sure you're embedding the code for the objects into your app? import com.mypack.MyClass; on its own isn't enough: you need a concrete reference to a class for its code to be inc

Re: [Flashcoders] Dynamic class instantiation

2008-04-04 Thread Ian Thomas
Are you sure you're embedding the code for the objects into your app? import com.mypack.MyClass; on its own isn't enough: you need a concrete reference to a class for its code to be included in the SWF. Something like: import com.mypack.MyClass; import com.mypack.MyOtherClass; // somewhere in

Re: [Flashcoders] Dynamic class instantiation

2008-04-04 Thread Jiri Heitlager
Thanx Ian, it is still tracing null. Is this even possible to do. How do all the big boys do dynamic instantation. What I basically want to achieve is have a hashMap store different kinds of Command Objects. Instead of instantiation at the start of the app, I would like to instatiated them whe

Re: [Flashcoders] Dynamic class instantiation

2008-04-04 Thread Ian Thomas
On a quick glance, I think this line is breaking it: var constructor:Function = Function( _global ); because _global is not a function. Try: function createInstance ( classPath:String , args:Array) : Object { var packageList:Array = classPath.split( "." ); var constructor:Object

[Flashcoders] Dynamic class instantiation

2008-04-04 Thread Jiri Heitlager
Hello list, Does anybody know an AS2 version of the AS method getDefinitionByName() I would like to dynamic instantiated classes in AS2 with passing argument to that created instance. I am using a modified script from 'http://blog.generalrelativity.org/' , but the return datatype == null,

Re: [Flashcoders] Dynamic Class Instantiation

2007-06-29 Thread elibol
I think you're going in the right direction with wrapping addChild(). It appears that the parameter p:Object isn't used at all so I will exclude it in my example. public function attachUIObject(n:String, c:Class):UIComponent { var instance:UIComponent = new c(); // will throw an error if c does

[Flashcoders] Dynamic Class Instantiation

2007-06-28 Thread Jeff Fox
In my application framework, we are trying to update a dynamic class instantiation method created using backward compatible AS1 conventions and implemented in ActionScript 2. Our architecture is being upgraded to ActionScript3 and we'd like to keep this custom method if we can. We originally used