First time here? First time here? Newsletter Signup Newsletter
Login | Register | 651326 Members and growing! | Flash Jobs
Search tutorials
Author: Patrick Mineault | Website: http://dakar.netqcca.com

Now in order to better see the effect of the script you should add a second frame to your movie and put a large image file so that you have the time to watch it load. Press Ctrl+Enter twice in order to simulate loading using the Show Streaming feature.

We've approximated our circle mask with a collection of 100 triangles with a sharp angle of 3.6 degrees. In order to keep track with what we've drawn and what we have not we set up two vars: loaded and oldLoaded. Then on each frame the enterFrame event is called: all triangles with numbers between the value oldLoaded and loaded are the drawn.

The drawing takes place inside the addSlice function. It uses the relations derived above to get the coordinates of each of the corners of the triangle. It then draws it using the same functions as before. By now you should be familiar with the standard procedure: set up an empty movie clip, set it as the mask of a target, then draw some shapes in it. Before I finish I should mention the use of _root.mask._yscale = -100. On a computer screen the positive y-axis does down, while in the Cartesian system it goes up. Therefore a reflection about the horizontal axis is necessary in order to keep our angle relations valid.

Conclusion

You now have plenty of tools for creating all kinds of masking effects. In this tutorial I've willfully avoided the more complex aspects of the drawing API such as drawing curves. This was done in order to show you that using the drawing API in drawing masks was really quite simple and natural.

If you've enjoyed this tutorial, please take the time to visit dakar.netqcca.com. I am participating in a project in international development in May and am in dire need of funding. I'm organizing an actionscript-o-thon and also accepting donations. See the URL above for details. Thanks.

» Level Advanced

Added: 2004-03-26
Rating: 8 Votes: 15
(10 being the highest)
» Author
Always looking for a new challenge, I'm going to Senegal this summer to lend my computer skills in a volunteering project. I'm sending you this tutorial as part of my fundraising campaign, see http://dakar.netqcca.com . Enjoy!
» 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.