Flash Gallery | Flash Templates | Flash Menu | Flash Design | Flash Audio & Video

flash page flip

Actionscript 3.0 video tutorials

+ Reply to Thread
Results 1 to 3 of 3

Thread: Tips and Tricks - MovieClip.dropTarget

  1. #1
    Administrator Living At The FlepStudio! Flep is on a distinguished road
    Join Date
    Jul 2007
    Posts
    5,609
    Rep Power
    9

    Tips and Tricks - MovieClip.dropTarget

    flash templates
    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!

  2. #2
    yxk
    yxk is offline
    Junior Member Settled In yxk is on a distinguished road
    Join Date
    Nov 2008
    Posts
    1
    Rep Power
    0

    Re: Tips and Tricks - MovieClip.dropTarget

    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.

  3. #3
    Junior Member Settled In chiella is on a distinguished road
    Join Date
    Mar 2009
    Posts
    2
    Rep Power
    0

    Re: Tips and Tricks - MovieClip.dropTarget

    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

+ Reply to Thread

Similar Threads

  1. Replies: 1
    Last Post: 12-03-09, 07:25
  2. Trucco del giorno - MovieClip.dropTarget
    By Flep in forum Articoli e tutorials
    Replies: 4
    Last Post: 04-03-09, 12:54
  3. dropTarget Problem
    By Pherankh in forum advanced Actionscript 3.0
    Replies: 0
    Last Post: 02-12-08, 04:56
  4. Tips and tricks - ghost instance
    By Flep in forum Tutorials
    Replies: 0
    Last Post: 25-09-07, 16:14
  5. Tips and tricks - MovieClip.mouseChildren
    By Flep in forum Tutorials
    Replies: 0
    Last Post: 23-09-07, 10:50

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts