ciao a tutti ragazzi,
ho un player scaricato dalla sezione flash di html che mi fa avviare e stoppare un suono
questo è lo script:
Codice PHP:
// numbers needed for the visuals, you can play around with altering them
const PLOT_HEIGHT:int = 11;
const CHANNEL_LENGTH:int = 100;
// Byte array also needed for the visuals
var bytes:ByteArray = new ByteArray();
// Assign The mp3 to play
var req:URLRequest = new URLRequest("song.mp3");
// Boolean value for button functions, to switch in the conditionals
var isPlaying:Boolean = false;
// Create the sound object
var snd:Sound = new Sound(req);
// Assign a var name for the sound channel
var channel:SoundChannel;
// Play Button Listener ///////////////////////////////////////////////////////////////////////
playBtn.addEventListener(MouseEvent.CLICK, playPause);
/////////////////////////// Start Play button function //////////////////////////////////////////////////////
function playPause(event:MouseEvent):void {
// This conditional makes the magic of our play/pause functionality
if (isPlaying == false) {
channel = snd.play(); // Start playing
isPlaying = true;
}
// Stop button listener and function
stopBtn.addEventListener(MouseEvent.CLICK, stopSound);
function stopSound(event:MouseEvent):void {
channel.stop();
isPlaying = false;
}
// On playback complete listener and function, needed to reset some things
channel.addEventListener(Event.SOUND_COMPLETE, onPlaybackComplete);
function onPlaybackComplete(event:Event) {
isPlaying = false;
//trace("The sound has finished playing.");
}
} /////////////////////////// End Play button function //////////////////////////////////////////////////////
all'inizio del filmato secondo questo script la musica è in stop, e bisogna clicare sul pulsante per avviarla..... vorrei invece che la musica partisse già appena carico il filmato.. ho fatto un sacco di prove.. ma non ci riesco...
qualcuno mi può dare un suggerimento..?
buona giornata
Giuseppe

Rispondi quotando
