Flash MX 2004 New feature example learning three

Source: Internet
Author: User

example Four, Device Font masking

I. Characteristics involved

This example mainly involves the production of shading effects and the use of scroll pane components, are some interesting features, with the previous in the Flash MX production ideas are quite different. At first glance, the text content is in the gallery, but it is confusing to show the content of the text in the scene. This involves the properties of the scroll pane component.

Second, the production process

1, press "Ctrl + F8" to create a new Clip, named "Textclip", the type is movie Clip, choose "Export for Action Script" (This is the text content is not in the scene, but can be displayed in the scene of the secret), Enter "Textclip" in the identifier. Enter more text with the text tool in this clip scenario so that you can see the effect clearly in the final result.

2, press "Ctrl + F8" to create a new Clip, named "Frame", the type is movie Clip, draw a square border with the rectangle tool.

3, press "Ctrl + F8" to create a new Clip, named "Mask", the type is movie Clip, with the rectangle tool to draw a square border similar to the size of the second step, and fill the fill tool with black.

4, press "Ctrl + F8" to create a new Clip, named "Maskclip", the type is movie Clip, select "Export for Action Script", enter "identifier" in the Maskclip.

5. In Maskclip, create a new layer in time line named "Mask", drag the frame in the gallery to this layer, and name it "box" on the property panel. Build a layer above the "mask" layer, named "Frame", drag the mask from the gallery to this layer and name "frame" on the property panel. Build a layer above the frame layer, named "Actions," and add the following statement to its action panel:

Textclip.setmask (box); Note 1

This.onenterframe = function () {//NOTE 2

box._x = _root._xmouse-this._parent._x; Note 3

box._y = _root._ymouse-this._parent._y;

frame._x = _root._xmouse-this._parent._x;

frame._y = _root._ymouse-this._parent._y;

}

Note 1: The box clip in the scene is set to a textclip mask. As you can see from here, you can now create a mask directly in the action script.

NOTE 2: Set the function to trigger this function when entering this movie clip frame.

Note 3: The position of the replicable box follows the mouse movement, and the position of the frame follows the movement.

6. Back to the main scene, drag two radio button components to the scene, one of the setting parameters: named "Rcomponents", the value of data is "component", "Group Name" is Radiogroup, "label" For masking with components. Set another setting as follows: named "Rgraphics", the value of data is "graphic", "Group Name" is Radiogroup, and "label" is masking with Graphics.

7, drag a scroll pane component into the scene, set its parameters as follows: named "Spmasking", Contentpath is "Textclip", Hlinescrollsize is 5,hpagescrollsize to 20, Hscrollpolicy is auto. Scrolldarg is false,vlinescrollsize for 5,vpagescrollsize 20,vscrollpolicy for Auto.

8. Create a new layer in time line named "Action" and add the following statement to its action panel:

/* Copyright 2003 Macromedia, Inc. All rights reserved.

The following is Sample Code and are subject to all restrictions

On such code as contained in the end User License agreement

Accompanying this product.

*/

function Switchexample (evt) {//NOTE 1

var choice = Evt.target.selectedRadio.data; NOTE 2

if (choice = = "Component") {//Note 3

Spmasking.contentpath = "Textclip"; Note 4

Spmasking.hscrollpolicy = "on"; Note 5

Spmasking.vscrollpolicy = "on";

else if (choice = "graphic") {//Note 6

Spmasking.contentpath = "Maskclip"; Note 7

Spmasking.hscrollpolicy = "Off";

Spmasking.vscrollpolicy = "Off";

}

}

Radiogroup.addeventlistener ("click", Switchexample); Note 8

Rcomponents.selected = true; Note 9

To explain the code above:

Note 1: Define a function with a parameter of evt.

Note 2: Define a variable whose value is the value of the selected radio in the scene.

Note 3: If the value of the selected radio is component, execute the following statement.

Note 4: The Contentpath of the scroll pane in the scene is set to "Textclip", Textclip is in the gallery, which is the feature of the scroll pane.

Note 5: Set the scroll bar for scroll pane to display.

Note 6: If the value of the selected radio is graphic, execute the following statement.

Note 7: Set the Contentpath of the scroll pane in the scene to "Maskclip", Maskclip is a masking effect in the gallery.

Note 8: Add a listener function for the two radio in the scene, triggering when clicked.

Note 9: The default selected radio is rcomponents.

Iii. Practical uses

This example is widely used, can be directly placed in the scroll pane clip,graphic,swf file, etc., with action script control is also more convenient. So you can make a text box, picture frame, you can also do flash movie play box, but also with the scroll bar oh.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.