During the developing of the
puzzle I discovered a very strange thing concerning the property drop.Target of the MovieClip Class.
If you take a look in the Flash guide, you will find the property dropTarget in the Sprite Class. As the MovieClip Class inherits from the Sprite Class, we should be able to use it as well.
It is a property which allows to know during the
startDrag , the informations of the object underneath.
Quoting from the Flash guide, it: ?specifies the display object over which the sprite is being dragged, or on which the sprite was dropped?.
Well! Personally I encountered a few problems as it does not behave as explained in the guide.
Let?s see what happened in my case? I realise that I had a problem when assigning a runtime property to two MovieClip and dragging them one above the other to check the values of the properties of both MovieClips.
As you can see in the example underneath, if you drag the grey rectangle on the MovieClip containing the image, following the logic of the Flash guide, we should obtain as a trace of the rectangle?s droptarget property?
trace(quadratino.dropTarget);
?when we release it, the output [object MovieClip].
Instead it is not so. We obtain as output [object Shape]
I found myself unable to compare the two properties assigned to the MovieClips as quadratino.dropTarget.porpertyName would return ?undefined?.
After many tries, I starting having the doubt that Flash was referring to the content of the MovieClip onto which I was releasing the dragged MovieClip.
In fact, using this syntax:
quadratino.dropTarget.parent
I accomplished what I wanted as you can see from the following example:
Now it does return [object MovieClip] and I can retrieve the assigned properties in runtime.
If one of you has better ideas or has resolved this problem another way, you are more then welcome to share it with us.
Ciao and see you next!