Archive

Archive for the ‘Examples’ Category

How to Write a Custom Class

May 26th, 2009
Get Adobe Flash player

Using Custom Classes is an introduction to Object-Oriented Programming, which is beyond the horizon of this class.

If its something you’re interested in, here’s something to get you started. The most important thing to take away from this is that we are going to write the functionality for what we want, say a ball, to do, and no matter how many balls we create, they will all inherit from a single source of logic, a Ball Class.

When we say Class, we me an external ActionScript file that follows the rules needed to make it a class. Any text file saved with a .as extension can be used as an ActionScript file.

We’re going to create a library item with 4 frame labels. We’ll also create a Custom Class that each instance of the Ball MovieClip will inherit from. This custom class will add listeners for MouseEvents, so that all of our ball instances do the same thing, and run off of the same code.

Download Example

Follow this example

Step 1 - Create the Library Item

Open a new .fla, make sure you have ActionScript 3 selected, and create a ball MovieClip. Inside the ball MovieClip, create a labels layer and an actions layer. Place a stop() Action on frame 1 of the Ball MovieClip. In the labels layer, make frames 1 - 4 blank keyframes. Label one frame “default”, one frame “over”, one frame “out”, and one frame “down”. Change something visually on each frame so you can tell if the MouseEvents are working. Save the .fla as “ExportForActionScript.fla

Step 2 - Relate the Library Item to the External class

Choose File > New > ActionScript File. Save the ActionScript file in the same directory as the ExportForActionScript.fla. Paste this code in the ActionScript file and save it.

If all goes well you won’t get any errors and you should notice that they MouseEvents are working. If not, compare the working example you can download here with what you have.

The Timeline Meets Music

May 15th, 2009

orange

Check out this Flash site, its a great use of the Timeline, Flash drawing tools, masking, all put to music.

Author: admin Categories: Examples, Resources Tags:

Importing Media into Flash from PS CS 3

May 11th, 2009

banner

Using The Adobe Creative Suite CS 3 or newer, you can import media into Flash directly from a Photoshop or Illustrator file. This is a fantastic features, with a few limitations. Layers are maintained, so if you or whoever designed project kept a clean Photoshop file with named layers and logical organization, that will carry right over into the Flash file. You can choose to create a MovieClip for a Photoshop Layer or Group right in the Photoshop Import Window. To get to the Photoshop Import Window from Flash CS 3, go File > Import to Library > choose .psd file. You can also choose what layers to import, and unique compression options for each. So all in all, its great. One drawback I’ve noticed is it doesn’t handle transparency very well in certain situations.

If you have a graphic on a layer that has transparency, especially if it moving, you may see white ugly crusty edges around your graphic. This is because when importing from Photoshop Flash isn’t using as good of transparency as a .png (Portable Network File) does. So if that happens to you, simply make the layer in Flash that the crustiness is on a guide so it won’t show up in the final swf, and use it as reference to place a png image. You’ll need to go back to Photoshop, show only the layer you want to save, crop it, and choose File > Save For Web > PNG 24 Transparency to create a .png image from Photoshop.

Get an example psd file here.

  • Create a new .fla file
  • choose File > Import to Library (or Import to Stage if you want it to be automatically placed on the stage)
  • Select the .psd file
  • Notice the options in the Import Window
  • Try making all the head layers their own MovieClip and give them instance names
  • Notice that layers from the .psd file were maintained
Author: admin Categories: Examples, Recap Tags: ,

Timeline Animation Exercise

April 30th, 2009
A frame from a rotoscoped animation

A frame from a rotoscoped animation

Rotoscoping is an animation technique in which animators trace over live-action film movement, frame by frame, for use in animated films.

Using Flash, we will import in video and, frame by frame, use the frames of the video as reference to quickly illustrate the scene using the Flash Drawing Tools. In doing so, we will be creating a Timeline Animation.

We’ll get to a certain point, then play our animations on the computer, walk around the class and see what everybody did.

Author: admin Categories: Examples Tags: