Flash Downloads | Freesome - Pete Hobson

Flash Downloads

MarioR3mix AS3 Demo

View it

The source code for the demo is here You need Flex Bulder 2 or the SDK. No comments in the code either i'm afraid.

The wikid little dancehall remix of the theme tune is graciously donated by Mike Vafeas. Check ot his other phat remakes of some classic game themes over at OcRemix.org. Nice one ;)

For more info on this demo, please check my blog entry

LcBroadcast - localConnection ActionScript 2 broadcasting class

Demo | Download | Documentation

LcBroadcast provides an easy mechanism to broadcast messages to different instances of the flash payer running on local machine. It addresses a limitation of the localConnection object, in that localConnection must know the connection name of each instance to communicate with. LcBroadcast is ideal in situations where you only want one instance of your movie preforming an action at any given time, for example an embedded video player, may tell all other instances to stop playback once its play button in pressed.

Usage

download and unpack the ZIP and place the com folder in your ActionScript class path. The following example shows a trivial setup example

import com.freesome.events.LcBroadcast;

	var my_lcb:LcBroadcast;
	
	//create an instance of LcBroadcast
        //the string passsed is any unique id for your application
        //this ensures that any other apps using LcBroadcast will not pickup your events

	my_lcb = new LcBroadcast("com.freesome.demo");		

	//create a new object to act as a listener.
	//lcBroadcast will broadcast two events 'onInit' and 'onBroadcast'	
	//in each case we just want to trace the events to the output window

	var listen = new Object();

	listen.onInit = function (ob:Object) { 
		for( var i in ob ) trace( "key: " + i + ", value: " + ob[ i ]) ;}			

	listen.onBroadcast = function (ob:Object) {
		for( trace) Main.dtrace( "key: " + i + ", value: " + ob[ i ]);}

	//add the listener
	my_lcb.addListener(listen);

	//broadcast the message “hello world”
	my_lcb.broadcast({msg:”hello world”});

The final line:

my_lcb.broadcast({msg:”hello world”});

- illustrates the use of an object for broadcast. In the example a single field is passed named msg, in this case containing the string “hello world”. However the fields created in this object are completely user defined. A common addition would be the internalID of the object, this would allow an object to filter out messages from itself. For example

my_lcb.broadcast({msg:”hello world”, id:my_lcb.internalID});

Then the onBroadcast handler would preform a check similar to

	if (ob.id == my_lcb.internalID) {
		//code for broadcast from self
	} else {
		//code for broadcast from others
	}

Compiling the example

Full source code for the demo.html and swf is provided. If you want to compile this example you will need the fantastic FlashDevelop open source flash environment. Alternately you should simply copy the actionscript from main.as into the timeline within the flash IDE.

Flash AS2 MP3 Player

This is a very simple AS2 MP3Player, that you can freely use and place on your site.

Download the zip here.

You will need Flash 2004 or later to open the file. If you just want to use the player directly on your site, the player directory contains the SWF, and HTML files. There is also a directory called MP3, which contains a couple of example tunes. And the Playlist.xml file (click here for an example playlist file), which you will have to alter with a text editor, to play your own MP3s.

Drop us an email if you do use this.

Syndicate content