PDA

View Full Version : [Resolved] Dynamic sprites with perspective lose mouse event functionality



SiNT4X
October 20th, 2009, 08:47 PM
Solved - please check second post for solution!

Hey there :0 Having a bit of trouble.

I'm working on an intricate project right now, and I've run into some extremely unhelpful problems - things I really don't need happening after spending a week figuring out why some code didn't work, only to rewrite it and have it suddenly start working. I guess it's the classic case of running into more, more serious problems right after making an extremely good breakthrough!...

Anyways, my problem is that my dynamically drawn sprites with the PerspectiveProjection property set on each, all of which are contained in a movieclip (which is at stage-level), no longer have MouseEvent functionality - at this point, I think anything past regular Events no longer work, but my stack of important issues eats up all time I have to test.

Before I started having issues, I was using just a scale effect to simulate the 3D-ness of the movie. After figuring out why past attempts at using Z axis on these sprites failed, I decided to add the perspective part to the transforming of each of these sprites. Ever since then, Mouse functionality just simply does not work. No errors are thrown, no runtime errors are displayed, yet the trace function does NOT work within the functions (meaning it isn't the content of the function not working) - simply does not want to do anything!

Other animations and such work perfectly fine - i.e. tweening the X, and Y values, etc.

On top of that, I have put in test code to add a mouse over event to an instance of this sprite class, not using any of the methods to select it (just a plain old reference to the instance that I KNOW exists), within the scope of the stage, with a simple trace command, with NO functionality whatsoever!

I think this may be a bug, but I honestly do not know.

I would supply the code, but good luck at decoding it all (I have a very bad habit of not commenting my code - I develop so quickly that I know where each of the little snippets I need are... It's simple in the sense I have it broken up quite well, just a bunch of stuff to sort through...).

/long post.

Any help?

`SiN

SiNT4X
October 20th, 2009, 09:50 PM
Wow, haha. Answered my own question.

After carefully re-reading the livedocs, I came across this statement:


The specified projection transformation then applies to all the display object's three-dimensional children.

Since I had already applied it to the containing movie clip, and then set the z-value of the children (making them 3D), that perspective was applied to them.

This is, however, still a bug: sprite children that have been applied a projection perspective transformation, of a container movie clip that has also been applied a projection perspective transformation, lose event handling functionality!

I simply took out the line of code that assigned the transformation to the children sprites, leaving the transformation for the container, and voila! Event handling came back! :D

Hopefully this helps people having issues in the future!!

`SiN