Hi Everybody !
here is the topic :
we have a video which is played.
while it’s playing, a .wma file is being downloaded with URLLoader() with an URL
which will exist only once,
by the way is this file put in a kind of buffer/cache ?
then when the video is finished, we want to save the .wma file which is in the buffer(?),
so without calling again the URL which doesn’t exist anymore…
does it make sense ? is it possible and how ?
Thx for help !
here is some code :
public function Main_2()
{
son = new URLLoader( _url )
addEventListener( Event.ENTER_FRAME, loadingSound );
obj = new Object();
obj.onMetaData = function( obj:Object ) {
for ( var propName:String in obj ) {
trace(propName + " = " + obj[propName]);
}
}
playVideo();
}
private function playVideo( ):void
{
nc = new NetConnection();
nc.connect( null );
ns = new NetStream( nc );
ns.client = obj;
vid.attachNetStream( ns );
addChild( videoBox );
videoBox.addChild( vid );
ns.play( videoURL );
ns.addEventListener(NetStatusEvent.NET_STATUS, onStatusEvent);
}
private function onStatusEvent( stat:Object ):void
{
if ( stat.info.code == "NetStream.Play.Stop" ) {
checkDownload();
}
}
private function loadingSound( evt:Event ):void
{
var bLoaded:Number = son.bytesLoaded;
var bTotal:Number = son.bytesTotal;
if ( bLoaded == bTotal && bLoaded > 20 )
{
removeEventListener( Event.ENTER_FRAME, loadingSound );
}
}
private function checkDownload():void
{
// the trouble is here because the url doesn't exist anymore !...???
file.download( _url, "nouvelles_histoires.wma" );
}