This is a blog that was created to talk about web design. The both of us hope people can learn from this, even learn something ourselves maybe.

Thursday, January 20, 2005

Flash tutorial One!

Alright I will start off with a good one. "onClipEvent"

Nice trick with this handler -

This one is nice, it allows you to hide the mouse, and in turn replace it with something else, more specifically a graphic that you have made.

1. You need to make a graphic, preferablly in flash as vectors is whatyou hsoul dbe using to make things run smooth. You can make it in flash by drawing it using the tools, when you are done don't forget to convert it to a symbol (graphic). This is done by right clicking and dragging down to "convert to symbol"

2. Create a movie clip, this is easy go up to the top >Insert>New Symbol> this will
open up a selection box, name your symbol *always name your symbol* (naming techniques will come in a later post ;).

3. If you made your graphic else where you need to import it. here is how - Click>file>Import>Import to Library (another thing you should always do) select the graphic you have made.

4. Double click on the movie clip, this will open it up in the stage. Drag your graphic into the field. Then got back to the main scene.

Ok here is where the fun begains. Now you have your movie clip on your stage. I would make sure it is on the top most layer since it is goign to be your cursor.

This is where we will introduce our "onClipEvent" this handler can only be used on movie clips, just as (on) events are used for buttons.

In our case we are calling for an event to happen when the movie clip loads.

One thing to be certain to do with every movie clip is to name it in your library and name it on your stage. If you look in properties once you have licked on your movieclip there will be a place where it says This is its true ID in action script. You can call it whatever you want in your library, but while you use it in actionscript you must refer to it by its So call it anything you like.

Now comes the code. It goes directly on the movie clip. Click on the movie clip and you will see a blank area for action script. Here is the Juice -

//this hides the pesky mouse cursor; this is the most effecicent way as it only hides it once instead of every frame like mostother ways.
onClipEvent (load) {
Mouse.hide();
}
//this part effects movement
onClipEvent (mouseMove) {
this._x = _root._xmouse;
this._y = _root.xmouse;
}

notice the formatting, just like Javascript. In the second part you can do all kinds of thing realative to the mouse. like in my game SWAT you will notice that on e movie clip is restricted to only the "x" axis this is done by simply omiting the code for "y" or -

onClipEvent (mouseMove) {
this._x = _root._xmouse;
}

more to come about OnClipEvent's.

Sorry this got long I was trying to be thorugh (sp?).

4 Comments:

Blogger rrd said...

Loved the tutorial, keep posting more!

12:34 PM

 
Anonymous Anonymous said...

Thank you!
[url=http://cdniggns.com/inyz/ccwr.html]My homepage[/url] | [url=http://gafheist.com/xxct/yjoh.html]Cool site[/url]

9:13 AM

 
Anonymous Anonymous said...

Great work!
My homepage | Please visit

9:13 AM

 
Anonymous Anonymous said...

Good design!
http://cdniggns.com/inyz/ccwr.html | http://hfgbixed.com/kchg/gnlr.html

9:14 AM

 

Post a Comment

<< Home