Saturday, July 24, 2010

ActionScript for Flash5: Custom mouse pointer

Flash designer for more rigorous, this technology is generally not used, I wrote this tutorial to only to those interested in programming or ActionScript, want to build their own interactive Flash site to friends. As a designer, learning ActionScript is very important, as much as AfterEffects in the "MontionMath". I hope you can work out the final design of their own have a picky eye, so as to make you learn more in order to be more perfect.


This is the ActionScript of Flash5 series is the second tutorial, I start to introduce the whole idea. This time we will use a simple and novel Flash5 technology - Hide mouse pointer, through a combination of an MC and you can use startDrag behavior Flash scenes to establish their own mouse pointer. Of course, make up, or some steps, I hope you can learn patience. In general, there are three steps:

1, the establishment of MC pointer
2, put it on the main scenes in the timeline
3, adding Actions.

Well, let's get started!
The establishment of indicators

Step 1: Create a pointer

First, the design of your hands, I designed the style of a compass, in fact, this map is my stolen,: P. Well, if you can create a pointer then we continue.
No matter how you design, preferably it has a center, but not great or small, do not look like the screen on a spot or a stain, so very irritating, I have seen many like this of. I finally joined to the indicator flashes, rotate and change size when you move it, it adds even more entertainment, but as an example of this tutorial is concerned, no less fancy.

Step 1.1 (optional): a blinking pointer
We can create a pointer to the MC "maincursor", which actually contains a mc, the directory structure as shown:

"Blinker mc" pictures "blinker" are optional and animation, if you like a static picture as a pointer, you can skip to step 1.3: the pointer to a pointer to put together a very simple, use the drawing tools to draw a triangle pointer, and then choose your favorite color fill, and then select the pointer, select the menu Insert> Convert to Symbol, named the "blinker" Select graphic picture option. The establishment of a pointer (Intensive)

Step 1.2 (optional): A flash animation pointer

The following flash animation we need a pointer, we all know that to create the animation using the timeline. Select the menu Insert> New Symbol, select the MC option, named "Blinker MC".
Now open the symbol library Ctlr + L, the picture symbol "blinker" dragged into the scene in an instance, noted the timeline is the first frame has automatically created a key frame, need to produce a flashing effect we need to in section 10 and 20 to establish the key frame. The best way is to copy and then paste it into the first frame in the back of the frame.
Well, select the first frame, select the menu Edit> Copy Frames and then select the first 10 frames, select Edit> Paste Frames, repeat the steps to create the first 20, so that the location of the pointer can guarantee consistency.

The last to do is to change the symbols in a and 20 of the Alpha value of 0, the first 10 frames unchanged at 100%, in the middle of the establishment of key frame motion animation, the timeline shown.

Step 1.3: The pointer together

Now we return to the main scene, create a new layer, labeling it as "Hidden Cursor", in the first frame, we add a new mc, which includes design and flash animation pointer. Select the menu Insert> New Symbol, and then create the two layers shown.

In the "copmass" layer first frame, using the drawing tools to draw a compass graphic, in the "blinker" layer symbols Curry MC "blinker mc" drag a cloned on the scene, the position as shown. Now you do a custom pointer!

Set the main Timeline


Step 2: Add MC "mousecursor" to the main Timeline

When you build a good pointer to the future and place it on the main scene in the invisible region, that is, outside the work area, this could make the mouse pointer when the user is not in the film, will not appear. Re-open the symbol library, then drag the symbol "maincursor" in the scene in the establishment of cloned. Use the Instance panel to name it as "maincursor".

Finally, a simple button, but when you move the mouse up changes, you should know how to build, I do not say.

Step 3: Add Actions

Well, everything is in place, only a strong wind. Remember Flash4, we can also create a custom mouse, drag the same use of its property, but the problem is that we can still see the default mouse pointer, it will not hide, and this more or less defects, although we can Use plug to turn off the pointer, but only under IE to work, also have limitations.
But in Flash5, they have to help us solve this problem, haha, or so simple.

Step 3.1: hide default mouse pointer

1, create a new layer on top of other layers, called Actions.
2, click the first frame, the establishment of key frame, then right click on it in the menu, select Actions.
3, ActionsScript editor, select the +> Objects> Mouse> Hide.

OK, the default pointer was hidden. Now we have to do is establish our own mouse pointer "bundle" the mouse pointer on the hidden, or in the film where we can not see anything.

Step 3.2: The MC "tied" in the mouse

Now we use Startdrag behavior custom mouse pointer "bundle" in the mouse.
1, or in the AS editor, click on +> Actions> StartDrag.
2, typing _root.maincursor.
3 Select Lock Mouse to Center.
4, Close AS editor.

Hurrah! Our custom pointer buttoned up!


Here you have to pay attention to two issues:

1, you created in the main scene taken from cloned maincursor name, and the descendents of symbols taken from the name of AS you must edit the name of the editor is consistent
2, be sure to select the center of the mouse lock MC
Note that these two steps, you can build anything you like, customize the mouse. OK, life-long learning, our next tutorial Goodbye!

Recommended links:

flv to 3gp CONVERTER

Trojan Horse Is How To Work

Combo drive and repair of and summary

Video format

Mp3 to m4a

Articles About Games Arcade

Kingsoft WPS fans will debut Citation Shanghai Book Fair

The staffing arrangements in the most appropriate location

Versed in pop-up window for ASP.NET

YOUTUBE Movie to WMV Now

Top AUDIO Recorders

Symbian preparing for the dynamic link library DLL

Shanghai Qi Cheng is willing to do full-time male white-collar workers, Mr.

Vob To Mkv

Purple pass and was invited to the United States to participate in HIMSS10 Exhibition

No comments:

Post a Comment