A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Dragging 2 different instances together

  1. #1
    Junior Member
    Join Date
    Jan 2001
    Posts
    10
    I have a leaf instance and I've created a drop shadow instance of that leaf. I've placed them on two different layers (if that's important to know).

    I have created an actionscript that allows the user to drag the leaf away with the mouse. It works fine. What I want to be able to do is to drag both the leaf and its drop shadow together.

    How do I do that? I am fairly new to Flash and Flash 5 so please be specific (didn't know whether to post this in the newbie area or here).

    Thanks!!

  2. #2
    Now listen heah! Mac8myPC's Avatar
    Join Date
    Aug 2000
    Location
    Steve Job's Doorstep
    Posts
    695
    the easiest way to do this is to use actionscript. i'm assuming that the dropshadow is a movie clip just like the leaf with it's own instance. but you want it to drag with the leaf offset by a couple pixels, thus the drop shadow effect right? well, just click on the drop shadow MC (once, not double click) and bring up your actionsscript window it should say object actions (not frame), then put this little gem in...

    Code:
    onClipEvent(enterFrame) {
      this._x = _root.leaf._x + 2;
      this._y = _root.leaf._y + 2;
    }
    with this code your shadow will move with your leaf as you drag it, (if leaf is not the instance name of your leafMC then change it accordingly) and - if you want to offset it more just put in a higher value than 2.

    hope that helps

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center