How would i go about caching sound assets in Flex, I load the sounds for play via:
private function set_streamingMedia(mediaURL:String) : void {
var req:URLRequest = new URLRequest(mediaURL);
if (streamChannel) {
streamChannel.stop()
}
auth_play(req);
}
private function auth_play(reqestURL:URLRequest) : void {
stream = new Sound();
var credsHeader:URLRequestHeader = new URLRequestHeader("Authorization", "Basic " + credentials);
reqestURL.requestHeaders.push(credsHeader);
var context:SoundLoaderContext = new SoundLoaderContext(1000, true);
stream.load(reqestURL, context);
timer = new Timer(100);
timer.addEventListener(TimerEvent.TIMER, mediaPositionChange);
play();
}
private function play():void{
if(isPaused){
streamChannel = stream.play(trackPosition);
timer.start();
isPaused = false;
}
else{
if (streamChannel) {
stop();
}
streamChannel = stream.play();
timer.start();
isPaused = false;
}
ChangeVolume();
}
I am on the playbook, so I can save it in a directory, put it in as a BLOB on SQLite (seems like a terrible idea) - Ideas would be much appreciate.
Also want to thank all the people here who have been taking the time to teach me Flex :) - you guys are better than the book I spent money on!