0
votes

I'm having a problem with AS3. I'm trying to cast an object, but it returns null. However, I'm absolutely positive that the object's class is the one I'm casting to:

    trace(example);
returns [class exampleClass]

. However, casting it like so:

    trace(example as exampleClass);
returns null;

Is there any reason as to why this can be the case?

1

1 Answers

3
votes

It appears that example isn't actually an object, it is a reference to the class exampleClass

You probably did something like var example = exampleClass instead of var example = new exampleClass()