Return to Kroll Design home page

Flash Tutorials (with .FLA files included)

 
« Return

Flash Tutorials Menu:
ActionScript 3:
See also on this page:
ActionScript 2
Examples using no ActionScript

Note:
The animated walking man that is used in a number of these Flash tutorials is an original cartoon character, "Stuart Strut", of my own creation, that I drew a number of years ago. If you would like to purchase a license to use this character, please contact me.
click here to go to tutorial BlendMode.LAYER - When you lower the opacity of a multi-layer movie clip, you normally don't want hidden portions of the layers below to show. Unfortunately, Flash does not default to this behavior. Set myMovieClip.blendMode to flash.display.BlendMode.LAYER in order to fix this. This example also shows cartoon animation in action -- a cartoon character that I drew, separated into various body parts, then animated "by hand", positioning each body part in each frame, with almost no use of Flash tweens.
click here to go to tutorial Bouncing Ball simulation using no tweens - various techniques were used to create a semi-realistic effect of a ball bouncing under the influence of gravity.
click here to go to tutorial buttonMode to create a hand cursor when over a dynamic text box - Movie clips, even clickable movie clips, default to having an arrow cursor, not a hand cursor. To make the movie clip act more like a button and give it a hand cursor, use mcClip.buttonMode = true, where myClip is your movie clip name. However, setting buttonMode to true isn't sufficient to have the hand cursor appear over dynamic text boxes that reside within the movie clip. To achieve the hand cursor over the text box and all parts of the movie clip, you also need to set mouseChildren to false. This example also shows how to dynamically change the color of a movie clip using colorTransform.
click here to go to tutorial Collision Detection - Flash has two built-in functions for collision testing:
(1) hitTestObject determines if the bounding boxes of the two specified objects are overlapping. A bounding box is a rectangle surrounding the object, normally invisible, that Flash uses to "contain" the object.
(2) hitTestPoint determines if the specified X,Y coordinate is overlapping the specified shape or bounding box. In this example, the third parameter of hitTestPoint is set to true, so that the shape itself is used, not the bounding box (if not specified, the third parameter defaults to false, that is, to use the bounding box instead of the shape). Whereas with hitTestObject, there is unfortunately no option to test the actual shapes instead of the bounding boxes. If you're lucky, by time you read this, Adobe will have come out with a cool new release of Flash that offers true shape collision detection!
click here to go to tutorial Current target - when you click on something in a flash movie, the code can query the event's "current target" to know which object was clicked. This way, several listeners can all invoke the same function when clicked, instead of each listener needing its own separate function. Once the function knows which object was clicked, the code can execute whatever processing is desired.
click here to go to tutorial Custom cursor - In Flash movies you can replace the Windows/Mac mouse cursor with one of your own.
click here to go to tutorial Deck of playing cards - In Flash movies you can replace the Windows/Mac mouse cursor with one of your own.
click here to go to tutorial Dragging using the startDrag and stopDrag methods - This example uses the built-in Flash methods of startDrag and stopDrag to allow you to move the walking man around the confines of the Flash movie by dragging with your mouse.
click here to go to tutorial Dragging an object on the stage, this time without using the startDrag and stopDrag methods - It captures the offset within the clicked object: localX and localY, storing them in a Point object.
click here to go to tutorial Drawn vs dynamically-created TextFields - this shows that a function knows of a text field, even though the text field is not a global variable nor passed to the function.
click here to go to tutorial Event listener: KeyboardEvent.KEY_DOWN - listen for what user types on keyboard, and display this data on the screen.
click here to go to tutorial Event listener: MouseEvent.CLICK - listen for mouse click on specified buttons.
click here to go to tutorial Event listener: MouseEvent.CLICK,MOUSE_MOVE,MOUSE_WHEEL - also, shows how to put library items on stage
click here to go to tutorial Formatting text using ActionScript - TextField, TextFormat, defaultTextFormat
click here to go to tutorial Going to a web site (website), using the 'GetURL' command, JavaScript (Java Script) etc - under construction. Various examples, some of which don't work.
click here to go to tutorial Hypertext - HTML can be added to a text field in a flash movie.
click here to go to tutorial 'include' to pull in / import external ActionScript - also shows some user input validation
click here to go to tutorial KeyboardEvent: responding to multiple simultaneous key presses
click here to go to tutorial KEY_DOWN and KEY_UP - it's handy to know when a key is let go of, not just when a key is pressed.
click here to go to tutorial LoaderInfo class to pass data from HTML to Flash movie - adding "flashvars" parameters to the HTML allows you to pass data to the Flash movie.
click here to go to tutorial Loading in external content - You can load external images, .swfs, and text into your Flash movie at run time.
click here to go to tutorial Game: remember the location of playing cards, to find matching pairs.
click here to go to tutorial MOUSE_OVER and MOUSE_OUT for movie clips and sprites
click here to go to tutorial mouseX and mouseY properties to track mouse location
click here to go to tutorial Preloader shows the progress of a loading Flash movie with large file size.
click here to go to tutorial Registration point - When drawing a shape using drawRect or drawCircle, the first two parms are the x and y coordinates for the registration point. If you treat this shape as a parent and then use addChild to add shapes to this first shape, you might get unexpected results if you specified a registration point other than 0,0 when drawing that first shape. Just something to keep in mind.
click here to go to tutorial Rotation of an object - how to do it both with and without ActionScript
click here to go to tutorial Saving Local Data using SharedObject - Web sites often try to save bits of information to your computer using "cookies". This is an example of the Flash equivalent of cookies: Shared Objects.
click here to go to tutorial Scrolling Text - uses a timer event and a mask.
click here to go to tutorial setChildIndex to change depth (stacking order) of sprites
click here to go to tutorial SimpleButton class - creating a button using ActionScript
click here to go to tutorial Sound playback of external files - NOTE: THIS FLASH MOVIE HAS SOUND. The MP3 files in this example are in a "music" folder on the server.
click here to go to tutorial Sound playback of external file, using a class/package file (file type .AS) - NOTE: THIS FLASH MOVIE AUTOMATICALLY PLAYS THE SOUND OF ONE PIANO KEY
click here to go to tutorial Sound playback using ActionScript - NOTE: THIS FLASH MOVIE HAS SOUND. This example also has code to display equalizer bars that vary in height depending on the current loudness of the song, and also depending on a randomizing function to give it variety.
click here to go to tutorial Sound sync animation - this barely touches on the subject of having nice, tightly synchronized sound and animation, but hey, it's a start. - NOTE: THIS FLASH MOVIE HAS SOUND.
click here to go to tutorial Text Events - clicking a TextField link to trigger an event.
click here to go to tutorial Timer animation relatively independent of frame rate - you can control the speed of an animated character using a Timer event, such that you are freed up to modify the frame rate for the rest of the movie without significantly affecting the rate of movement for the timer-controlled animated character.
click here to go to tutorial Timer Event - call a function every 20 milliseconds.
click here to go to tutorial Using a movieclip as a button
click here to go to tutorial XML example - first of what will be a number of examples showing how to import XML data into a Flash movie.
Back to top
ActionScript 2:
See also on this page:
ActionScript 3
Examples using no ActionScript
 
click here to go to tutorial _parent, _level0, _root - _parent._parent._parent vs _level0 vs _root for accessing main timeline.
click here to go to tutorial attachMovie for creating new movie clips on stage - this example also shows removeMovieClip to delete the clips.
click here to go to tutorial Bulleted list - this technique has pros and cons, the main advantage being that any look/feel change for the bullet only has to be done in one place, even if you've already created a lot of bulleted items with the old bullet.
click here to go to tutorial component: ScrollPane - Flash comes bundled with widgets that allow you to more quickly build online forms and applications. This a simple example of the "ScrollPane" component, with text that exceeds the space available and which therefore has a vertical scrollbar.
click here to go to tutorial Detecting collisions using '_droptarget' - good for Flash jigsaw puzzles, etc, where you want the objects to largely overlap before taking action.
click here to go to tutorial _droptarget vs hitTest for detecting collisions - the two techniques behave differently, as this example shows.
click here to go to tutorial Detecting keyboard events - use the arrow keys to move a shape around.
click here to go to tutorial Draw lines using ActionScript - create drawings using code instead of by hand drawing it.
click here to go to tutorial Factorial computation - use recursion to determine the factorial of the user-entered number.
click here to go to tutorial loadMovie - for importing external SWF files at run time.
click here to go to tutorial loadMovie - this example has an empty movie clip for placeholder.
click here to go to tutorial loadMovie to import an SWF with sound - NOTE: THIS FLASH MOVIE HAS SOUND.
click here to go to tutorial LoadVars class to read an external file of variable name value pairs
click here to go to tutorial Sound: alternating streaming sound with bullet points that fade in - this example plays sound while a corresponding bullet point fades in, and it waits until the sound has completed playing before the next bullet point fades in. NOTE: THIS FLASH MOVIE HAS SOUND.
Back to top
Examples using no ActionScript:
See also on this page:
ActionScript 2
ActionScript 3
 
click here to go to tutorial Animated mask - A mask reveals portions of the underlaying layer. The shape of the mask can change, if desired.
click here to go to tutorial Line that seems to 'draw itself' - as the outline of a skyline draws itself, the photo fades in.
click here to go to tutorial Mask multiple layers - when you specify a layer as a mask, Flash defaults to masking only the one layer immediately below the mask. Here's a simple technique for masking additional layers with that same mask.
click here to go to tutorial Motion Guides - a curved or straight line that you draw, then attach an object to, for it to move along this path.
click here to go to tutorial Shape Hints - using shape hints can improve the quality of your 'shape tween' animation.
click here to go to tutorial Soft-edged mask - typically, masks in Flash have a hard edge. This tutorial provides step by step instructions for creating a soft-edged mask.
click here to go to tutorial SWFObject - with SWFObject your web page can automatically detect if Flash is supported on the user's computer and browser, and if Flash isn't supported, alternative content can be automatically swapped in.
click here to go to tutorial Text used as a mask - uses large bold lettering as a mask, to reveal the corresponding areas of a photo beneath.
click here to go to tutorial Timelines of graphic symbols vs movie clips - unlike movie clips, the timeline of a graphic is affected by the main timeline.
Back to top


 
« Return


©2012 Kroll Design    info@KrollDesign.net    781.910.3694
Last modified: 12/31/1969 7:00 PM