Posts tagged as:

Flash

I use flash to achieve this. Create a new flash file with AS3. Create two buttons which will be placed one above the other. The stop button instance is called xstop and the play button instance is called xplay.

And this is the code:

//think of the soundchannel as a speaker system and the sound as an mp3 player
var soundChannel:SoundChannel = new SoundChannel();
var sound:Sound = new Sound(new URLRequest("http://www.kavdesign.net/sites/stgeorge/birds1.mp3"));

xstop.addEventListener(MouseEvent.CLICK, clickStop);
xplay.addEventListener(MouseEvent.CLICK, clickPlay);

playMusic();

function clickPlay(evt:MouseEvent) {
	playMusic();
}

function clickStop(evt:MouseEvent) {
		soundChannel.stop();
		soundChannel.removeEventListener(Event.SOUND_COMPLETE, loopMusic);
		xstop.visible = false;
		xplay.visible = true;
}

function playMusic():void
	{
		 soundChannel = sound.play();
		 soundChannel.addEventListener(Event.SOUND_COMPLETE, loopMusic);
		 xstop.visible = true;
		 xplay.visible = false;
	}

function loopMusic(e:Event):void
	{
		 if (soundChannel != null)
		 {
			  soundChannel.removeEventListener(Event.SOUND_COMPLETE, loopMusic);
			  playMusic();
		 }
	}

{ 0 comments }

Create a button on the movie.
Give a name to the instance of the button with the name button.
Put this code on the first frame of your flash movie.

button.addEventListener(MouseEvent.CLICK, btn_function);
var button_request:URLRequest = new URLRequest("http://mysite.com");
function btn_function(event: MouseEvent)
{
navigateToURL(button_request, "_blank");
}

{ 0 comments }

Open the .fla file with the flash movie and add to the first frame of the movie these 2 lines of action script:

Stage.align = “TL”;
Stage.scaleMode = “noScale”;

Where TL means top-left. In my case it was TR.

More tricks for flash move alignment could be found here: http://www.tutorio.com/tutorial/liquid-flash-layout

{ 0 comments }