Re: [Flashcoders] Question about Arrays

2008-02-05 Thread Mark Lapasa
Wow, thx Erik. Great answer! I buy into that. -mL EECOLOR wrote: I believe it's type * so you should cast it. This has nothing to do with that, hehe. There is a tiny difference beween ClassToCastTo(value) and (value as ClassToCastTo). In the first case a compiler error will be thrown. In

Re: [Flashcoders] Question about Arrays

2008-02-02 Thread EECOLOR
I believe it's type * so you should cast it. This has nothing to do with that, hehe. There is a tiny difference beween ClassToCastTo(value) and (value as ClassToCastTo). In the first case a compiler error will be thrown. In the second case the cast will be tried. If it fails the resulting value

Re: [Flashcoders] Question about Arrays

2008-01-11 Thread ekameleon
Hello :) try the typecasting : (a.pop() as MyClass).myFunction(); you can decompose the code with a reference and add a test with the null object var myInstance:MyClass = a.pop() as MyClass ; if ( myInstance != null ) { myInstance.myFunction() ; } EKA+ :) 2008/1/11, Mark Lapasa

Re: [Flashcoders] Question about Arrays

2008-01-11 Thread Steven Sacks
I believe it's type * so you should cast it. MyClass(a[0]).myFunction(); Mark Lapasa wrote: In the following bit of code... // START code package { import flash.display.Sprite; public class SampleClass extends Sprite { public function SampleClass() { var

[Flashcoders] Question about Arrays

2008-01-11 Thread Mark Lapasa
In the following bit of code... // START code package { import flash.display.Sprite; public class SampleClass extends Sprite { public function SampleClass() { var a:Array = [new MyClass()]; a[0].myFunction(); a.pop().myFunction(); }

Re: [Flashcoders] Question about Arrays

2008-01-11 Thread Mark Lapasa
Thx eka + steven for your replies. Forgot to mention my question which is not why is this -not- working Rather why is -it- working? Try creating an AS3 project in Flex called SampleClass. Cut and paste the whole code. I too would expect that it would need to be casted. Thx, -mL

Re: [Flashcoders] Question about Arrays

2008-01-11 Thread Mark Winterhalder
On Jan 11, 2008 11:34 PM, Mark Lapasa [EMAIL PROTECTED] wrote: I too would expect that it would need to be casted. Yes, one would think so. I can't answer your question, either, but can't help but note that in haXe you would declare your array as ArrayMyClass. The compiler wouldn't let you put