Latest tutorial: Premium Flash Files | Ask Tutorial5! | Subscribe to RSS Register Login Find Hobbies
Advertisement

Get tutorials on EMail




Do you need more help? You can now Ask Tutorial5! and get free support - Ask a question now!

Make your Flash masks draggable

(28 votes)
Written by AnaS   

1. Create a new Flash document 400x300 dimensions. Select a gray for the background color.
2. Insert two new layers. Name them background, mask and actions. Actions layer should be in top and background in bottom.
3. In the first frame of the background layer insert the picture you want (or take the one below): go to File>>Import>>Import to Stage (Ctrl+R). Make sure the picture has 400x300 dimensions.
dragmask.jpg
4. Select the picture and go to Modify>>Convert to Symbol (F8). Choose MovieClip and registration point to center and put bgMC as name. Then go to Properties panel and give it and instance name of bg_mc.
5. Now go to the first frame of the mask layer and draw an 100x100 circle (hold pressed the Shift key to draw a perfect circle) without stroke. Convert it to a MovieClip ( Modify>>Convert to Symbol or F8). At name field put maskMC, choose MovieClip as behavior and choose center for registration point. In the Properties Inspector give it an instance name of mask_mc.
6. In the first frame of the actions layer put the following ActionScript code:

bg_mc.setMask(mask_mc);

mask_mc.onPress = function(){
startDrag(this, false, 50,50, 350, 250)
}

mask_mc.onRelease = mask_mc.onReleaseOutside = function(){
this.stopDrag()
}

7. Test your movie (Ctrl+Enter) and see the result.



8. Now let's create a Shape Twenn between mask_mc. So go in the Library, right-click on maskMC and choose Edit (or double-click mask_mc on the Stage).
9. Select the first frame of the first layer of maskMC and in the Properties panel choose M0tion:Tween.
10.Now go to frame 50 right-click and choose Insert Keyframe (F6).
11. Delete the circle and draw in frame 30 a square 100x100 and align it to center on horizontal and vertical.
12. Go to frame 60 and insert a keyframe. Delete the square and copy the circle from the first frame. Great! Now just test the movie.

You need to Register in order to download the FLA file.




Subscribe now via RSS feed and get all the new tutorials

written by Striker03 , October 06, 2007

can anyone help me how to store the .swf file into the database MySQL?
thnx in advanced, i hope you will reply
written by krishnaraja , October 15, 2007

hi,
please send some of the new scripting in flash to my e-mail id my e-mail id is This e-mail address is being protected from spam bots, you need JavaScript enabled to view it
written by krishnaraja , October 15, 2007

hi ,
while sending mail to others it should be displayed directly for eg. when we sent a image to others it is displayed as view download. it should not be viewed like that it should be displayed directly. plz if any send it to This e-mail address is being protected from spam bots, you need JavaScript enabled to view it
written by kumar , November 21, 2007

ur animation is beautiful! i saw it for the first time of such a kind. I learnt. I am searching for a script for animation of paper unwinding and winding using flash! please reply.
written by everkee , December 07, 2007

The instruction no.9 got a bit problem. I think the tween should be set to "shape".
written by eric fakeemail , December 12, 2007

is it possible to have a looped movie playing, or a regular movie(or animation) playing and have this mask effect?
written by Sylwia , February 18, 2008

Dear Sir/Madam,

My name is Sylwia and I represent Software Media LLC, Flash&Flex Developer's Magazine.

Would you be interested in a cooperation with our magazine?

I look forward to hearing from you soon :)

With kind regards,
Sylwia Stocka
Executive Editor
www.ffdmag.com
written by Kyrie , May 13, 2008

Heyy, umm I need help with the action script code. i keep gettin error when i go to test the movie. Its sayin something is wrong with the:
startDrag(this,false,50,50,350,250):that line can u help??

If u e-mial me Put: Help?!?!? as the subject

Do you need more help? Ask now!
 

busy
Last Updated ( Friday, 28 March 2008 )