Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 05-24-2012, 07:22 PM   #1
mzandstra
Registered User
 
Join Date: May 2012
Posts: 5
Default Getting properties of droptarget

Basically, how do I do it? I want to set the height, width, and position of the dropped object to match the target object.

All of these traces output "undefined":
ActionScript Code:
trace(this.droptarget._name); trace(this.droptarget._parent._x); trace(this.droptarget._parent._y); trace(this.droptarget._parent._height); trace(this.droptarget._parent._width);
Whereas this outputs "/exercise/task_bin" (the full path of the target MC).
ActionScript Code:
trace(this.droptarget);
The droptarget is a MC that consists of only a shape. I read that droptarget might fetch the shape instead of the MC, so I tried these but they all return undefined as well:
ActionScript Code:
trace(this.droptarget._name); trace(this.droptarget._parent._x); trace(this.droptarget._parent._y); trace(this.droptarget._parent._height); trace(this.droptarget._parent._width);
How can I access the properties of the target object?
mzandstra is offline   Reply With Quote
Old 05-29-2012, 05:08 PM   #2
mzandstra
Registered User
 
Join Date: May 2012
Posts: 5
Default Anyone?

Is there some way to do this by creating a new variable to represent the droptarget perhaps? I'm stumped and this is a time-sensitive project.
mzandstra is offline   Reply With Quote
Old 05-29-2012, 11:06 PM   #3
Prid
Prid - Outing
 
Prid's Avatar
 
Join Date: Oct 2009
Location: Halden, Norway
Posts: 1,191
Send a message via MSN to Prid Send a message via Skype™ to Prid
Default

I'd recommend using hitTest, but from the LiveDocs:

Quote:
To compare the _droptarget property of an instance to a reference, use the eval() function to convert the returned value from slash syntax to a dot-syntax reference.
so:

ActionScript Code:
trace(eval(this.droptarget)._name); trace(eval(this.droptarget)._parent._x); trace(eval(this.droptarget)._parent._y); trace(eval(this.droptarget)._parent._height); trace(eval(this.droptarget)._parent._width);
__________________
I have returned, and am now 18
Prid is offline   Reply With Quote
Old 05-30-2012, 05:07 PM   #4
mzandstra
Registered User
 
Join Date: May 2012
Posts: 5
Default Thanks

Exactly what I needed. I'll have to research hitTest for next time–no idea how that works.
mzandstra is offline   Reply With Quote
Old 05-31-2012, 03:26 PM   #5
fudgematico
Registered User
 
Join Date: May 2012
Posts: 9
Default

Kl worked for me too
fudgematico is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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 Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:21 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.