Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 05-08-2012, 12:25 PM   #1
Chijje
Registered User
 
Join Date: Nov 2011
Posts: 7
Question Drag and drop with multiple duplicates as target

Hi!

I'm having some trouble with my drag and drop thingy.

What I'm trying to solve is a problem where my MC should be able to be dropped on multiple targets.

The targets is being duplicated from another drag and drop movieclip.

Each of the duplicate copies are named something like mcclip1, mcclip2, mcclip3, is it possible to "SELECT" all with one variable?
Chijje is offline   Reply With Quote
Old 05-08-2012, 12:42 PM   #2
MSLourens
Member
 
Join Date: Apr 2006
Location: Almere, The Netherlands
Posts: 82
Default

could you please explain a bit more what you want to achieve? How do you duplicate your movieclips? How do you want to drop a single source on several targets at the same time?
MSLourens is offline   Reply With Quote
Old 05-08-2012, 12:52 PM   #3
Chijje
Registered User
 
Join Date: Nov 2011
Posts: 7
Default

Duplicate:
dupli = mc.duplicateMovieClip("mcname"+mcNum, ++mcNum);

All duplicates will be named "mcname1", "mcname2" and so on...

Is it possible to make something like a hittest for all of em at once?

I know that this won't work but it might show what im trying to do.

hitTest(_root.mcname"ALL NUMBERS"))
Chijje is offline   Reply With Quote
Old 05-08-2012, 01:08 PM   #4
MSLourens
Member
 
Join Date: Apr 2006
Location: Almere, The Netherlands
Posts: 82
Default

a hittest is always per object, so you have to manually drop your movie clip on each duplicate. You could define a hittest for a temp object (say a rectangle) which contains all the duplicate movieclips and do a hittest on this object. I'm not sure if an object should be on the stage to be able to do a hittest with it...
MSLourens is offline   Reply With Quote
Old 05-08-2012, 04:32 PM   #5
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

Use a for loop:

ActionScript Code:
for(i=1;i<=5;++i){     if(this["mcname"+i].hitTest(someObject)){         // do something     } }

scope[parts]

that is the syntax for dynamically referring to an object, where scope is something like _root, this, _parent, etc. and parts are the strings/numbers/variables you want to join together, for Flash to look for the object their name make up, in this case, "mcname" + i (String + variable), which in this for loop would create a String like, "mcname0", "mcname1", etc. and then try and find an object with the same instance name
__________________
I have returned, and am now 18
Prid is offline   Reply With Quote
Old 05-10-2012, 07:29 AM   #6
Chijje
Registered User
 
Join Date: Nov 2011
Posts: 7
Default

Prid, that's exactly what I was lookin' for.
Chijje 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 11:27 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.