Wednesday, March 18, 2009

MP3 Play Multiple Songs Using An Array

/* FRAME SCRIPT */


var songs=new Array();
songs = ["beach", "shogun","africa"];
// --------------------------------------

// get a song
var n:Number = 0;// item in the list
whatsong = songs[n];
extension = "mp3";
songFilename = whatsong + "." + extension;
// -------------------------------------------

// load the song from inside a folder
ThisSong = new Sound();
songFolder ="songs/world/";
ThisSong.loadSound(songFolder + songFilename,true);

var whereAmI:Number = 0;
ThisSong.start(whereAmI,1);
songName = "Now playing: " + whatsong;


/* NEXT SONG BUTTON */
on (release) {

if (n == songs.length-1) {

n = 0;
} else {
n++;
}


whatsong = songs[n];
songName = "Now playing: "+whatsong;

extension = "mp3";
songFilename = whatsong+"."+extension;

ThisSong = new Sound();
songFolder = "songs/world/";
ThisSong.loadSound(songFolder+songFilename,true);

var whereAmI:Number = 0;
ThisSong.start(whereAmI,1);

}

Tuesday, March 17, 2009

Lesson_11: MP3 & Sound()

This week we will be playing external mp3 files using some Actionscript.

// ****************
// * FRAME SCRIPT *
// ****************
// Setting Up The Sound Object //
// 1. Assign the file folder and filename to variables
// 2. Create a new sound object
// 3. Load the sound file
// 4. Initialize the start position to 0
// 5. Start Streaming the sound file (true – streaming, false – event)
songFolder = "songs/";
songFilename = "patsong2007.mp3";
playThisSong = new Sound();
playThisSong.loadSound(songFolder + songFilename, true);

var whereAmI:Number = 0;
playThisSong.start(0, 1);


// *******************
// * Pause BUTTON *
// *******************
on(release) {
// Where Am I when I paused?
// 1. The position is stored in variable whereAmI
var whereAmI:Number = playThisSong.position/1000;

// 2. The song is set to stop playing
playThisSong.stop();

// 3. Trace to the Output Window WhereAmI
trace(whereAmI+newline);
}


// ***************
// * Play BUTTON *
// ***************
on (release) {

// Start playing the song from the most current position
playThisSong.start(whereAmI, 1);
}


// *******************
// * Rewind BUTTON *
// *******************
on (release) {
// reset position to beginning
var whereAmI:Number = 0;
}

Thursday, March 12, 2009

Deep linking

Perhaps the easiest way to organize a Flash-based website is to use a different keyframe on the main Timeline to represent each "state" ("page" or "screen") of the site

I was looking for this ... and here it is:
http://www.adobe.com/devnet/flash/articles/deep_linking.html

MovieClip.currentLabel property

I was looking for this code... here it is...
at http://lassieadventurestudio.wordpress.com/2008/09/16/movieclip-frame-labels/


The first and most basic new feature is the MovieClip.currentLabel property. That gives us the frame label of the current timeline frame. While that may seem pretty straight forward, it’s a huge step up from AS2 where the current frame label was not available at run-time (…which always seemed like a pretty big oversight to me).

However, I think the best new feature is the MovieClip.currentLabels property, which gives an array of ALL frame labels on a timeline, along with their corresponding frame numbers. AWESOME. That means that we can quickly and easily set up a scenario that will let us browse all of a MovieClip’s labeled timeline frames at run-time. Here’s an example:

import flash.display.FrameLabel;

// _displayClip = MovieClip with timeline to access.
// _select = Flash UI ComboBox component instance.

_displayClip.stop();
_select.removeAll();
_select.addEventListener(Event.CHANGE, this._onSelectLabel);

// get and populate all of displayClip's frame labels in the select menu
for each (var j:FrameLabel in _displayClip.currentLabels)
{
// add list items with FrameLabel object properties: name, frame.
_select.addItem({label:j.name, data:j.frame});
}

function _onSelectLabel(evt:Event):void
{
// update displayClip when a new frame is selected
_displayClip.gotoAndStop(_select.selectedItem.data);
}
If you set that scenario up in a new Flash document and give the _displayClip a few frame labels to browse through, then you’ll be able to select and display the various frames in your MovieClip using the combobox (…just be sure to put different graphics on each labeled timeline frame so that you can see a change in appearance when you switch between frames!).

So, what can you do with this? I’ve used it in the new Lassie Shepherd editor so that a developer can select frame labels to display within externally loaded SWF media. It works like a charm. This would also be a good means to build a really simple navigation scheme: you’d set up and label different content frames along a timeline, load that movie into a shell, and then you could populate navigation options within the shell based on the frame labels. The beauty here is that if you ever added new content frames to the loaded media, they’d plug right into the shell movie that rendered the navigation.

Lesson_10: Importing Video

This week we will be importing our Karaoke video into Flash and creating controllers to be able to start and stop the video. We will also create labels and buttons to jump to the label in the video.

Thursday, March 5, 2009

banner ad contest

FITC is running a banner ad contest. Design and build a banner ad.
First prize is 4 nights at the Hilton, plus tickets to FITC Toronto.
http://www.fitc.ca/contest/toronto/2009/

Banners
Creative Concepts are to be submitted in the form of a Flash banner ad:
Flash. SWF. 300 x 250. Max file size is 250 kb.
Audio is allowed, but not necessary, but must have a volume control in the piece
All banners must contain the following text info...
• FITC Toronto 2009
• The Design & Technology Festival
• April 24-26, 2009
• as well as including The FITC Logo, which you CAN modify.

Monday, March 2, 2009

Lesson_09: Karaoke Video

This week we will be creating a karaoke video for use in the Jukebox Project.
Remember to bring the song (mp3 or AIFF) and the lyrics to class,
and be sure to BRING HEADPHONES.