Blogroll

This blog is created for education about engineering students.All the engineering students are get free downloadable books here. not only books and also different software also available here

14.1.Scripting Masks

Scripting Masks
Procedure:
step 1: Open flash document
step 2:  Select File -> Import -> Import to Stage, find the image, select it and click Open. The image will appear on the stage of your document.
step 3: Select Modify > Convert to Symbol (or press F8). In the window that appears, select Movie clip as type, and give it a name, like masked picture or anything you like.
step 4: Give an "Instance name" to the newly created movie clip on stage to be able to mask it later via ActionScript. Go to the Properties panel and call it, for example, "myImage". Hit Enter to confirm that.
step 5: Call the current layer "picture" and lock it. Create a new layer and call it "mask".
step 6: Select the Rectangle tool (R)., Draw a rectangle on stage in the newly created mask layer.
step 7: Press F8 to convert this rectangle to a symbol. Again, select Movie clip as type. Call it masking rectangleand click OK.
step 8: Go to the Properties panel and give it an Instance name: call it "myMask".
step 9: Make a new layer and call it "actions".
step 10:  Select Window > Actions to open the Actions panel, then write the source code for create the mask dynamically
step 11: Test your movie. Click on the mask and drag it around.

Source Code:-

myImage.setMask(myMask);
myMask.onPress = function() {
startDrag(this);
}
myMask.onRelease = function() {
stopDrag();
}


No comments:

Post a Comment

Total Pageviews