Better than that I dont think so.. My friend You just saved my precious time.
Thankssssss.![]()
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!
Better than that I dont think so.. My friend You just saved my precious time.
Thankssssss.![]()
Last edited by Onsitus; 13-11-08 at 11:23.
Ciao Flep,
scusate ma mi sto accingendo in questo periodo a scoprire flash..quindi magari la mia domanda risulterà banale a tanti...è che io non riesco proprio a capire dove sbaglio..
Dunque ammettiamo che il mio scopo sia quello di muovere in una scena un cerchio e quando incontra il quadrato lo riconosca e vada al frame successivo: per fare ciò avrò due movieclip, il cerchio e il quadrato.Sul frame 1 metto
tondo.onPress = function() {
startDrag(this, true);
};
tondo.onRelease = function() {
stopDrag();
if (tondo._droptarget.== "/quadrato") {
nextFrame();
}
Il problema è che se il tutto è dentro ad un altro movieclip, il cerchio non mi riconosce più il quadrato, sebbene continui però a spostarsi con il mouse...
Esiste forse una dicitura da scrive sul droptarget per fargli riconoscere l'oggetto via path?
Grazie per l'attenzione
Bookmarks