Flash CS3 - Flash CS4

Free tutorials and scripts for all.
Actionscript 3.0

Tips and Tricks - MovieClip.dropTarget

This is a discussion on Tips and Tricks - MovieClip.dropTarget within the Tutorials forums, part of the Flash English category; During the developing of the puzzle I discovered a very strange thing concerning the property drop.Target of the MovieClip ...


Go Back   Forum Flash CS3 Flash CS4 > Flash CS3 Flash CS4 > Flash English > Tutorials

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 23-09-07, 19:56
Administrator
 
Join Date: Jul 2007
Location: Cesena
Posts: 4,535
Rep Power: 6
Flep is on a distinguished road
Tips and Tricks - MovieClip.dropTarget

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!
__________________

 


I recommend: Essential Actionscript 3.0

- I do not reply technicians pvt messages. Open a thread !
- Non rispondo ai messaggi privati con domande tecniche. Apri una discussione sul forum !
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #2 (permalink)  
Old 13-11-08, 11:28
yxk yxk is offline
Junior Member
 
Join Date: Nov 2008
Posts: 1
Rep Power: 0
yxk is on a distinguished road
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 12:23..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads

Thread Thread Starter Forum Replies Last Post
Trucco del giorno - MovieClip.dropTarget Flep Articoli e tutorials 3 04-09-08 10:37
ActionScript 3 Tips hard_overclocker Flash English 8 18-05-08 12:34
Tips abd Tricks Actionscript 3.0 - Loader.content Flep Tutorials 0 27-09-07 09:44
Tips and tricks - ghost instance Flep Tutorials 0 25-09-07 17:14
Tips and tricks - MovieClip.mouseChildren Flep Tutorials 0 23-09-07 11:50


All times are GMT. The time now is 18:54.

Powered by vBulletin version 3.7.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC4
Forum SiteMap