Re: [Flashcoders] Help for a Java Guy: Instantiating a MovieClip with a linked class and calling class methods

2006-07-08 Thread Bernard Poulin
Alternative way of instanciating a class without a library and without the __Package hack either. Create a class with this function: function attachClassMovie(parentmc:MovieClip, className:Function, instanceName:String, depth:Number, argv:Array):MovieClip { // Create emptyMovieClip var

Re: [Flashcoders] Help for a Java Guy: Instantiating a MovieClip with a linked class and calling class methods

2006-07-07 Thread Ian Thomas
Hi Julian, They do return references. You just have to cast them to the correct type. e.g. var clip:MyClip=MyClip(attachMovie(SymbolName,instanceName,depth)); HTH, Ian On 7/7/06, Julian Bleecker [EMAIL PROTECTED] wrote: Yeah, I think it gets worse. I'm used to a pattern where you create

Re: [Flashcoders] Help for a Java Guy: Instantiating a MovieClip with a linked class and calling class methods

2006-07-07 Thread Julian Bleecker
Ah, slowly getting it..I've dug in so deeply with Java idioms that it's almost like being Charleton Heston in Planet of the Apes.. .julian. Julian Bleecker, Ph.D. http://research.techkwondo.com [EMAIL PROTECTED] On Jul 6, 2006, at 23:28 PDT, Ian Thomas wrote: Hi Julian, They do return

Re: [Flashcoders] Help for a Java Guy: Instantiating a MovieClip with a linked class and calling class methods

2006-07-07 Thread Ian Thomas
Hi Julian, Now I've had my first cup of coffee I'll try to explain it more clearly. :-) In most cases AS2 works very similarly to Java in terms of inheritance, instantiation and casting and the like - the only main gotcha is that the class casting operator is MyClass(x) rather than (MyClass)x

Re: [Flashcoders] Help for a Java Guy: Instantiating a MovieClip with a linked class and calling class methods

2006-07-07 Thread Julian Bleecker
That's great Ian — thanks for the help! Each of those little idioms makes sense when described — I never would've figured these out just whacking at various permutations, particularly the very baroque incantation leveraging the invisible symbol names. I guess I should be looking forward to

Re: [Flashcoders] Help for a Java Guy: Instantiating a MovieClip with a linked class and calling class methods

2006-07-07 Thread Alan MacDougall
Julian Bleecker wrote: That's great Ian — thanks for the help! Each of those little idioms makes sense when described — I never would've figured these out just whacking at various permutations, particularly the very baroque incantation leveraging the invisible symbol names. You may find

Re: [Flashcoders] Help for a Java Guy: Instantiating a MovieClip with a linked class and calling class methods

2006-07-07 Thread Julian Bleecker
One other thing occurred to me on this topic, that might actually save the trouble of using a hash table, which AS direly needs. Is there a way to summon forth a class that's been instantiated in any of the ways described below, by name? In other words, if I've done this: for(var i:Number

Re: [Flashcoders] Help for a Java Guy: Instantiating a MovieClip with a linked class and calling class methods

2006-07-07 Thread Ian Thomas
On 7/7/06, Julian Bleecker [EMAIL PROTECTED] wrote: One other thing occurred to me on this topic, that might actually save the trouble of using a hash table, which AS direly needs. Is there a way to summon forth a class that's been instantiated in any of the ways described below, by name? In

Re: [Flashcoders] Help for a Java Guy: Instantiating a MovieClip with a linked class and calling class methods

2006-07-07 Thread Ian Thomas
(To be clear - Object isn't quite the equivalent of HashMap, as you can't natively specify hash codes etc. etc. But for many purposes, it serves the same uses.) Ian On 7/7/06, Ian Thomas [EMAIL PROTECTED] wrote: Firstly, Actionscript does have the equivalent of a HashMap. Everything derived

Re: [Flashcoders] Help for a Java Guy: Instantiating a MovieClip with a linked class and calling class methods

2006-07-07 Thread Julian Bleecker
Alan, Thanks - that gives me a different approach to try out that sounds very promising. Julian On Jul 7, 2006, at 8:59 PDT, Alan MacDougall wrote: Julian Bleecker wrote: That's great Ian — thanks for the help! Each of those little idioms makes sense when described — I never would've

Re: [Flashcoders] Help for a Java Guy: Instantiating a MovieClip with a linked class and calling class methods

2006-07-07 Thread Julian Bleecker
Ian, Those casting gymnastics definitely help — thanks a lot. Julian On Jul 7, 2006, at 9:27 PDT, Ian Thomas wrote: On 7/7/06, Julian Bleecker [EMAIL PROTECTED] wrote: One other thing occurred to me on this topic, that might actually save the trouble of using a hash table, which AS direly

[Flashcoders] Help for a Java Guy: Instantiating a MovieClip with a linked class and calling class methods

2006-07-06 Thread Julian Bleecker
Okay, here's the drill. I have a MovieClip — call it FooA — that's been linked to an AS2 class — call it FooA_Class — (that extends MovieClip and does lots of other useful things.) In that MovieClip, I have another MovieClip — SubFooA — that's been exported and given a proper instance

Re: [Flashcoders] Help for a Java Guy: Instantiating a MovieClip with a linked class and calling class methods

2006-07-06 Thread Mike Britton
Hey Julian, I feel your pain. Take a look at this example: http://www.randomusa.com/flash/downloads/tojulian.zip Mike Britton ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive:

Re: [Flashcoders] Help for a Java Guy: Instantiating a MovieClip with a linked class and calling class methods

2006-07-06 Thread Julian Bleecker
Cripes. Thanks Mike! So, this magic of turning a named instance into the name of the instance variable gets carried to its logical, but somewhat weird, conclusion. Julian On Jul 6, 2006, at 19:30 PDT, Mike Britton wrote: Hey Julian, I feel your pain. Take a look at this example:

Re: [Flashcoders] Help for a Java Guy: Instantiating a MovieClip with a linked class and calling class methods

2006-07-06 Thread Mike Britton
Perhaps, but you never know: someone on this list may have a better solution for your problem. Mike ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive:

Re: [Flashcoders] Help for a Java Guy: Instantiating a MovieClip with a linked class and calling class methods

2006-07-06 Thread Ian Thomas
Hi Julian, You were nearly there with: Object.registerClass(mFooA, FooA); var aObject:FooA_Class = _root.attachMovie(FooA, FooA, 1); Just change it to: Object.registerClass(mFooA, FooA); var aObject:FooA_Class = FooA_Class(_root.attachMovie(FooA, FooA, 1)); (as Class(x) is the equivalent of

Re: [Flashcoders] Help for a Java Guy: Instantiating a MovieClip with a linked class and calling class methods

2006-07-06 Thread Ian Thomas
Whoops, sorry, missed your extra 'm' on 'mFooA' (not sure why that crept in there?): Object.registerClass(FooA, FooA); var aObject:FooA_Class = _root.attachMovie(FooA, FooA, 1); Ian On 7/7/06, Ian Thomas [EMAIL PROTECTED] wrote: Hi Julian, You were nearly there with:

Re: [Flashcoders] Help for a Java Guy: Instantiating a MovieClip with a linked class and calling class methods

2006-07-06 Thread Ian Thomas
*sigh* Having a bad morning and copying the wrong line. Third time lucky: Object.registerClass(FooA, FooA_Class); var aObject:FooA_Class = FooA_Class(_root.attachMovie(FooA, FooA, 1)); Ian On 7/7/06, Ian Thomas [EMAIL PROTECTED] wrote: Whoops, sorry, missed your extra 'm' on 'mFooA' (not

Re: [Flashcoders] Help for a Java Guy: Instantiating a MovieClip with a linked class and calling class methods

2006-07-06 Thread Julian Bleecker
Yeah, I think it gets worse. I'm used to a pattern where you create a whole bunch of something — so, back to the problem I originally asked, if I want have my mainClip create a dozen subClip instances and tuck each one of those instances in an Array for later use, especially calling that