Quantcast
Viewing all articles
Browse latest Browse all 85594

Re: Embedded drag and drop not working

Good old sleep.

 

Cracked it this 6.30am GMT thanks to all your advice on _root and strings.

 

In the end the thing that wasn't working was trying to reference the nested string in between the square brackets. I believe it would have required separating out each nested MovieClip element into their own square brackets for it to work, e.g. [movie1][movie2][movie3]... which I couldn't easily think of a way to do, especially if the number of nested clips varied dependent on whether it was embedded/standalone/of if I changed the layer order/nesting in the main navigation.

 

So, instead, I used the traces I'd set up to work out a rule to pull out the info needed:

 

_root = _root.activityMask

this: _root.activityMask.activity_mc.container_mc.dragItem0

this._droptarget (dropObjectS) = /activityLayer/instance79/instance80/activityMask/activity_mc/container_mc/dropItem1/dropSkin/greyBorder/whiteBG

 

Basically the crucial (changing) part of the this._droptarget is the 'dropItem1' bit. The rest of the path varies dependent on whether it's being run standalone or embedded. Knowing that this drag and drop activity never uses more than 10 dropzones (and the numbering starts from '0') I realised that you could pull this info out with the following:

 

dropObjectS.substr(dropObjectS.lastIndexOf("dropItem"),9)

 

Which I then put into this:

 

var dropObject:MovieClip =_root.activity_mc.container_mc[dropObjectS.substr(dropObjectS.lastIndexOf("dropItem"),9) ];

 

And suddenly the beast lives again and I avoid having to recreate it in AS3(!)

 

Once again, thanks so much for all your help on this, kglad. You've been invaluable.


Viewing all articles
Browse latest Browse all 85594

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>