First time here? First time here? Newsletter Signup Newsletter
651326 Members and growing! | Flash Jobs
Search tutorials
Author: Joshua Weitzman | Website: http://www.jcsaviorproductions.com

Dragable Masks in Flash 5

Adding the Script

While still in the edit mode for 'dragMovieClip', right-click on the button and select actions. (You can also select the button and choose the actions panel from the menu.) Add the following code:

on (press) {


  startDrag ("");


}


on (release) {


  stopDrag ();


}
You can define the drag area to the size of the background image as well, which I would recommend.

Now exit the movie clip edit mode and return to the main stage. Select 'dragMovieClip', set and give it the matching name in the Instance panel, 'dragMovieClip'. Right-click on the clip and select actions. Add the following code:

onClipEvent (enterFrame) {


  setProperty (this.bgImage, _x, -this._x);


  setProperty (this.bgImage, _y, -this._y);


}
This tells 'bgImage' to reset its position based on the position of 'dragMovieClip' on the stage. If 'dragMovieClip' is at 100, then 'bgImage' moves to -100 to offset the movement and give the appearance of the the bacground image staying still.

At this point you are done. Publish the movie and see your work. If there are problems, first check to see that you gave 'bgImage' and 'dragMovieClip' and instance name. If the movement is off, make sure the image in 'bgImage' is aligned to 0,0 and that it's original position is where you want it on the main stage. Finally, check to see that the action on your movie clip is set to 'onMouseEvent(enterFrame)' instead of the default 'onMouseEvent(Load)'. If you are still having problem go back through and double check all of your step. If you're really stuck you can email me at tutorials@jcsaviorproductions.com.
» Level Intermediate

Added: 2002-02-16
Rating: 7 Votes: 70
(10 being the highest)
» Author
Freelance web designer and youth ministries webmaster at The Church On The Way in Van Nuys, California, USA.
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!

Comments

  • There are no comments yet. Be the first to comment!

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.
Featured Flash FLA
» Author: work2survive
» Title: Girl Walking 1kb
» Description: Walking girl, animation just takes 1kb, using high heels shoes, and fashion model attitude.
Featured Sound Loops
Image for equalize

Audio Player

» Author: BoxCat
» Title: CPU Talk
» Description: From the cyberpunk RPG, "Nameless: the Hackers" Completely Free to use! Keywords: edm hip hop rap electronic mysterious mission hacking chase exciting spy ios ambient chilling love happy sad angry suspense
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
Image for equalize

Audio Player

» Author: nathan
» Description:

A recorded sound of the Dimensional Fork Gate.