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
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
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
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
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();
}
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
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
7 matches
Mail list logo