This video will help you to design visualizer for your music player.
Website: http://samsolomonprabu.com/
Source Code of the project:
----------------------------------
import flash.media.Sound;
import flash.events.MouseEvent;
import flash.net.URLRequest;
import flash.media.SoundChannel;
import flash.utils.Timer;
import flash.events.TimerEvent;
import flash.events.Event;
import flash.media.SoundTransform;
var s:Sound = new Sound();
var c:SoundChannel = new SoundChannel();
s.load(new URLRequest(-Songs-PG-28 - Track 04.mp3-));
btnPlay.addEventListener(MouseEvent.CLICK, playSong);
btnStop.addEventListener(MouseEvent.CLICK, stopSong);
btnPause.addEventListener(MouseEvent.CLICK, pauseSong);
var pos:int = 0;
function playSong(e:MouseEvent):void{
toggleButtons();
c = s.play(pos);
if(s.id3.songName != null){
txtSongName.text = s.id3.songName;
}
else{
txtSongName.text = -Name not known-;
}
txtTotalTime.text = timeCalculation(s.length);
txtCurrentTime.text = timeCalculation(c.position);
myTimer.start();
seekSlider.minimum = 0;
seekSlider.maximum = Math.floor(s.length); c.soundTransform = new SoundTransform(volumeSlider.value);
txtVolume.text = (volumeSlider.value * 100).toString();
equTimer.start();
}
function pauseSong(e:MouseEvent):void{
toggleButtons();
pos = c.position;
c.stop();
equTimer.stop();
}
function stopSong(e:MouseEvent):void{
toggleButtons();
pos = 0;
c.stop();
equTimer.stop();
}
function toggleButtons(){
swapChildren(btnPlay, btnPause);
}
function timeCalculation(time:int):String{
var min = Math.floor(time - (1000 * 60));
var sec = Math.floor((time % (60*1000))-1000);
if(min - 10) { min = -0- + min; }
if(sec - 10) { sec = -0- + sec; }
return(min + -:- + sec);
}
var myTimer:Timer = new Timer(1000);
myTimer.addEventListener(TimerEvent.TIMER, songTimer);
function songTimer(e:TimerEvent):void{
txtCurrentTime.text = timeCalculation(c.position);
seekSlider.value = Math.floor(c.position);
}
seekSlider.addEventListener(Event.CHANGE, reposition);
function reposition(e:Event):void{
c.stop();
c = s.play(seekSlider.value);
}
volumeSlider.value = 0.5;
txtVolume.text = (volumeSlider.value * 100).toString();
volumeSlider.addEventListener(Event.CHANGE, volumeControl);
panSlider.addEventListener(Event.CHANGE, panControl);
function volumeControl(e:Event):void{
c.soundTransform = new SoundTransform(volumeSlider.value);
txtVolume.text = (volumeSlider.value * 100).toString();
}
function panControl(e:Event):void{ c.soundTransform = new SoundTransform(volumeSlider.value,panSlider.value);
}
var equTimer:Timer = new Timer(1);
equTimer.addEventListener(TimerEvent.TIMER, equalizer);
function equalizer(e:TimerEvent):void{
leftBar.height = c.leftPeak * 60;
rightBar.height = c.rightPeak * 60;
}
Website: http://samsolomonprabu.com/
Source Code of the project:
----------------------------------
import flash.media.Sound;
import flash.events.MouseEvent;
import flash.net.URLRequest;
import flash.media.SoundChannel;
import flash.utils.Timer;
import flash.events.TimerEvent;
import flash.events.Event;
import flash.media.SoundTransform;
var s:Sound = new Sound();
var c:SoundChannel = new SoundChannel();
s.load(new URLRequest(-Songs-PG-28 - Track 04.mp3-));
btnPlay.addEventListener(MouseEvent.CLICK, playSong);
btnStop.addEventListener(MouseEvent.CLICK, stopSong);
btnPause.addEventListener(MouseEvent.CLICK, pauseSong);
var pos:int = 0;
function playSong(e:MouseEvent):void{
toggleButtons();
c = s.play(pos);
if(s.id3.songName != null){
txtSongName.text = s.id3.songName;
}
else{
txtSongName.text = -Name not known-;
}
txtTotalTime.text = timeCalculation(s.length);
txtCurrentTime.text = timeCalculation(c.position);
myTimer.start();
seekSlider.minimum = 0;
seekSlider.maximum = Math.floor(s.length); c.soundTransform = new SoundTransform(volumeSlider.value);
txtVolume.text = (volumeSlider.value * 100).toString();
equTimer.start();
}
function pauseSong(e:MouseEvent):void{
toggleButtons();
pos = c.position;
c.stop();
equTimer.stop();
}
function stopSong(e:MouseEvent):void{
toggleButtons();
pos = 0;
c.stop();
equTimer.stop();
}
function toggleButtons(){
swapChildren(btnPlay, btnPause);
}
function timeCalculation(time:int):String{
var min = Math.floor(time - (1000 * 60));
var sec = Math.floor((time % (60*1000))-1000);
if(min - 10) { min = -0- + min; }
if(sec - 10) { sec = -0- + sec; }
return(min + -:- + sec);
}
var myTimer:Timer = new Timer(1000);
myTimer.addEventListener(TimerEvent.TIMER, songTimer);
function songTimer(e:TimerEvent):void{
txtCurrentTime.text = timeCalculation(c.position);
seekSlider.value = Math.floor(c.position);
}
seekSlider.addEventListener(Event.CHANGE, reposition);
function reposition(e:Event):void{
c.stop();
c = s.play(seekSlider.value);
}
volumeSlider.value = 0.5;
txtVolume.text = (volumeSlider.value * 100).toString();
volumeSlider.addEventListener(Event.CHANGE, volumeControl);
panSlider.addEventListener(Event.CHANGE, panControl);
function volumeControl(e:Event):void{
c.soundTransform = new SoundTransform(volumeSlider.value);
txtVolume.text = (volumeSlider.value * 100).toString();
}
function panControl(e:Event):void{ c.soundTransform = new SoundTransform(volumeSlider.value,panSlider.value);
}
var equTimer:Timer = new Timer(1);
equTimer.addEventListener(TimerEvent.TIMER, equalizer);
function equalizer(e:TimerEvent):void{
leftBar.height = c.leftPeak * 60;
rightBar.height = c.rightPeak * 60;
}
Music Player in Flash using AS3.0 - Part 3/4 - Flash Tutorials | |
1,280 views views | followers |
4 Likes | 4 Dislikes |
People & Blogs | Upload TimePublished on 10 Apr 2015 |
music player flashable zip, music player flash, music player flash drive, music player with flash drive input, music player with flashing lights, music player adobe flash, music player using flash, how to make music player in flash, , flash tutorials for beginners with examples, flash tutorials pdf, flash tutorials for beginners with examples pdf, flash tutorialspoint, flash tutorials in tamil pdf, flash tutorials cs6, flash tutorials animation, flash tutorials for beginners pdf, flash tutorials in tamil, flash tutorials in hindi, flash tutorials for beginners step by step, flash tutorials youtube, flash tutorials step by step, flash tutorials cs5, flash tutorials videos, flash tutorials w3schools, flash tutorials for beginners in hindi, flash tutorials for beginners ppt, flash tutorials cs3, flash tutorials basic |
Không có nhận xét nào:
Đăng nhận xét