March 19, 2010

Actionscript 3: Masking in Native 3D Issue in FP10

Today I tried to mask a Sprite that was in a container that had native 3d rotation applied - i.e. a parent Sprite had some rotationX and rotationY. The masking wasn't working, but it turns out that it was only not working because another Sprite within the same parent container had a 3D "z" value set. In order to get the masking to behave properly, I had to nest the Sprite and its mask in another Sprite, so that no sibling clips had z-positioning within the same immediate parent clip. Hopefully this little note saves someone the time it took for me to realize what the issue was.

March 12, 2010

iPhone: Get the class name of an object

Sometimes you want to know what type of object something is, when pulling it out of an array. In Obj-c there's a simple way to do that:

NSLog(@"object type = %@", [[myObject class] className]);
or
NSLog(@"object type = %@", [[myObject class] description]);
or!
if( [[myArray objectAtIndex:i] isKindOfClass:NSClassFromString(@"MyCustomClass")] ) { NSLog(@"it's a MyCustomClass"); }

Easy.