Programming games
Cannonball due. Drawing & printingexample.Acquiring video or sound
Homework: Catch up: completeprojects (rps, Bo, cb). Start video oraudio. Plan your project.
Cannonball extension
You may consider adding sound tocannonball for your sound/video project.
Can use
coding or
sound in frame
Flash terms
Create .fla and .as files using Flashdevelopment environment. This isdevelopment time.
Runtime (aka execution time)
Test program using the developmentenvironment. This does create a .swf file.
Publish creates .html file and .swf file
Development time
Bring instances of movie clip symbols inLibrary to the Stage.
Give instance names
ActionScript refers to instances by name
Can File/Print
May not do what you want…
I copy and paste code into Word orDreamweaver
Drawing & printing
Adding content, namely a movie clipsymbol to Stage at runtime
Various calculations
Use Properties of symbol (right mouse click)to set up: Export for ActionScript
Print during runtime
Can set up to print several pages. Myexample just prints one page.
Demonstrate
Drawing example
Note: this is a ‘stub’ for a biggerapplication.
Features
Create wall symbol. Change settings toExport for ActionScript.
Set up handling for mouse click on board.
One handler for 1st click and another for 2ndclick
Use ev.localX and ev.localY to getcoordinates.
Use Math.atan2(…) and Point.distance(…)
Use PrintJob
Making your own video for Flashplayback
Shoot video
Upload to computer
[Edit]
Produce .flv
Create Flash movie and test
Publish Flash movie
Upload .html, .swf, and all the .flv files to theserver
Initial steps
Shoot (?) video
Upload to computer
Producing .flv
Just like images, there are differentencodings for videos.
wmv, mov, avi, dv, ….
Adobe Flash CS4 Media Encoder willaccept many different types and producean .flv file (an .flv version of the samevideo clip)
Can set quality settings
Tradeoff: size (space on server, loading time)versus quality
Start queue
Creating the .flv file takes a while….
You can do more than one encoding at a time.
The name of each file is the same name, with filetype.flv
Use the pre-set settings OR get into more detail
Higher quality means larger files
Acquire video
Find website with video (or audio)
Enter URL of site
Check off agree to terms, filter (movies oraudio)
click on get files
be patient
choose from list.
Sound
Two (at least) methods for incorporatingsound into Flash
All coding: create Sound objects, setsource of sound, play. Can manipulatevolume, pan, etc. using Soundchannel.Also, register and handle events, includingwhen sound has been loaded.
Frame: associate [start of] sound withframe.
Acquire sound
Many types of sound. For coding method,need mp3
Find on-line sound editors.
Need to know location (URL) of soundfile(s).
Coding method
import flash.media.Sound;
import flash.net.URLRequest;
var urlname:String = "missle.mp3";
var requestsf:URLRequest = newURLRequest(urlname);
var msound:Sound = new Sound(requestsf);
// at appropriate place in the code
msound.play();
This file is locatedin the same folderon my computer. Itdoesn't have to be.
Frame method
File/Import/Import to Library
Select sound file(s).
Click on appropriate frame in timeline
In property panel, select Sound [file].
You can select a set effect and/or edit thesound.
Cautions
In either method, need to be aware thatsound lasts certain amount of time.
Be careful about starting sound again andagain (unless that is what you want)
Examine source
Sound added to frame
Bo the barking dog
consider for collapsing/exploding target
Code
Play sound as event handler for button click
Play random choice of tune from [short] list.
Note: pause, pan, volume features. These requireother objects.
Homework
Decide on video or audio
Create or acquire video clip(s)
Create or acquire audio clips. Can use CommonLibrary / sounds.
Keep in mind: this is a short assignment.
You can incorporate sound or video into your finalproject.
Think about what you want to do for your project
Check with me AND make proposal to blog.