Semplice player per flusso shoucast in streaming: 2 pulsanti uno per play uno per stop
Ecco l' AS3 sul 1° frame:
Se per la prima volta faccio play il suono viene riprodotto. Se faccio stop viene fermato.codice:import flash.media.Sound; import flash.media.SoundLoaderContext; import flash.net.URLRequest; import flash.media.SoundChannel; var mySound:Sound = new Sound(); var req:URLRequest = new URLRequest("HTTP://91.121.173.25:8540"); var context:SoundLoaderContext = new SoundLoaderContext(1000, true); var mySoundChannel :SoundChannel = new SoundChannel(); play_btn.addEventListener(MouseEvent.CLICK, soundplay); stop_btn.addEventListener(MouseEvent.CLICK, soundstop); function soundplay(event:MouseEvent):void { mySound.load(req, context); mySoundChannel = mySound.play(); } function soundstop(event:MouseEvent):void { mySoundChannel.stop(); }
Se provo a fare play dopo aver stoppato esce fuori questo errore:
Dove sbaglio?codice:Error: Error #2037: Le funzioni sono state richiamate usando una sequenza non valida oppure una chiamata precedente ha avuto esito negativo. at flash.media::Sound/_load() at flash.media::Sound/load() at player_fla::MainTimeline/soundplay()

Rispondi quotando
