Flash ActionScript 3.0 game programs & tutorials
http://www.java2s.com/Code/Flash-Flex-ActionScript/CatalogFlash-Flex-ActionScript.htm
HCI 430 -- Flash Examples
Examples marked with (*) are taken from Lott and Reinhart, Flash 8 ActionScript Bible, Wiley, 2005.- Example 1 Examples1.htm Examples1.swf Examples1.zip
- Time sample: Stopwatch timer
- Media sample: Dynamic sound generation
- Media sample: TLF text formatting using CSS
- Media sample: Sound channels
- Media sample: Image loading
- Media sample: Dynamic text
- Interactivity sample: Background scrolling
- Interactivity sample: Joystick-controlled movement
- Game sample: Maze
- Drawing sample: 3D rotation
Basic Flash examples with simple ActionScript.
Here is the Example1b ActionScript code.
bumble-bee Examples: bumble-bee.zip
- bumble-bee1 Simple Drawingbumble-bee2 Motion Tweening with start and stop buttons.
bumble-bee3 Using a Motion Guide
wheel A Movie Clip with its Own Timeline
squares Creating Movie Clips Dynamically
bumble-bee4 Placing Movie Clips Randomly
bumble-bee5 Simple Drag and Drop
sunset A sunset animation with tweening. Stars drawn with drawing API.
snow Simulating Snow with Random Motion
- sun-and-shadow Shows a variety of effects. Some ActionScript code is stored in separate .as files.
- number-pad Input digits with buttons and display them in a textbox.greeter4 Uses radio buttons and a textbox to input information. The output is displayed in a text area component.
email Read data from the text file email.txt and display it in textboxes.
display-text Read data from the text file data.txt and display it in a text area component.
phonebook9 Look up a phone number in a combo box and display the corresponding name a textbox. The names and phonenumbers are inphonenumbers.txt.
- text-aa.fla Source Code Create an associative array and access its elements.test-class.fla Source Code Create a PhoneInfo class and test it.
Here is the PhoneInfo.as class file.
phonebook10 Store name and number pairs as PhoneInfo objects.
- bumble-bee10 Create bumble bees with animated wings a nested movie clip.bumble-bee11 Instantiate 500 bumble bees, with synchronized and staggered start times.
bumble-bee12 Create 200 bumble bees where any bee can be dragged with the mouse to another location.
alert-window Show how to show an alert box (message box) and read which button was clicked.
- astronomy-quiz1 An astronomy quiz implemented in six frames.astronomy-quiz2 An astronomy quiz implemented in two frames.
tip-calculator1 Compute gratuity given the subtotal.
key-pad2 Keypad implemented with dynamic buttons and one event handler for all the buttons.
format-text Format a dynamic textbox using the TextFormat object.
tip-calculator2 Same as tip-calculator1, except that the labels in the controls are formatted with the setFormat method of the control.
animals ComboBox and TextArea components are formatted with the setFormat method.
- digital-timer A simple stop watch that uses the getTimer function.load-images Use a FileReference object to load image filenames into a combo box. Then a selected image is displayed in a Loader control.
dynamic-scroll-pane Display images in a scroll pane.
- bitmap1 Display library bitmaps as MovieClip objects.bitmap2 Draw on a movie clip.
Examples from senocular.com:
- masking1 Show a crude spotlight effect with a mask layer.masking2 Another crude spotlight effect.
device-with-text Simulate scrolling text on a handheld device.
- pianoKeys_behaviors An example from the Flash 8 Bible by Reinhardt and Dowd.
- id-dropdown Load ID numbers into ComboBox for GradeViewer Example.monthly-payment Compute monthly payment for a loan.
- textfield Switch a textfield from dynamic to input and vice-versa.css1 Display formatted HTML file (*).
css2 Display HTML file formatted with external CSS file (*).
TextFormattingExample Display HTML file formatted with external CSS file (*).
- custom-cursor Use a movie clip as a custom cursor.fred1 Transform an image loaded into a movie clip.
fred2 Transform and display a bitmap in various ways.
- scale9Grid Change the shape of a rectangle with rounded corners with the mouse (*).tweensEasing Perform programmatic tweening with various types of easing (*).
tweensListeners Perform programmatic tweening using listeners to control the animation. (*).
tweensPausing Perform programmatic tweening using the mouse to pause the animation. (*).
Some of these examples show trace output, which is not visible from the swf file.
- slider1 Version 1 of a custom Slider component (*).slider2 Version 2 of a custom Slider component (*).
slider3 Version 3 of a custom Slider component (*).
slider4 Version 4 of a custom Slider component (*).
Illustrates various authortime and runtime filters.
- filter-effects Show the effects of the DropShadow, Glow and Bevel Filters implemented using the Flash IDE.runtime-filter-effects Show the effects of the DropShadow, Glow and Bevel Filters implemented using ActionScript.
fred3 Show how to apply a sharpening convolution using a ConvolutionFilter object. The convolution is specified by
-1 | -1 | -1 |
-1 | 9 | -1 |
-1 | -1 | -1 |
Shows some examples that use keyboard input.
- key-up Show the pressed key in a dynamic textbox.play-scale Play a C major scale when these keys are pressed:
c d e f g a b
race Use the arrow keys to maneuver a token around a track without going out of bounds.
Receive input and use a LoadVars object to send the data to the URL of a PHP server. Here is the PHP source code running on ectweb: target.php
In some cases, use a RegExp object to validate the input. Here is the code for the RegExp class: RegExp.as
- send Send data to a PHP server using a LoadVars object.reg-exp-test Validate input text with a regular expression.
guestbook3 Send input data to a PHP server. Validate with regular expressions.
The senocular.com website: www.senocular.com/pub/flash/8/
- textanimatedletterbyletterlightsabers
constrainwalkingoverhead
flickandbounceball.swf
linedrawingcolorfill.swf
fadeimagesequence.swf
artificialliferootsandlines.swf
Sounds can be embedded in the SWF at author-time or loaded externally at runtime. Although embedded sounds can be manipulated through the timeline properties in the Property inspector, usually embedded and external sounds are controlled dynamically using the Sound object in ActionScript. Sounds can add life to your movies by providing background soundtracks or user-interface feedback.
This sample demonstrates sound loading and playback using a simple set of custom controls. Click the buttons to control the sound or click the numeric stepper to change sounds.
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. Permissions beyond the scope of this license, pertaining to the examples of code included within this work are available at Adobe.
More Like This
No comments:
Post a Comment