[RESOLVED] Creating filepath out of strings
I know I'm close, but can't find what I'm doing wrong.
If I remove the variables and just type in the path name, the file does play. So there's no other error in this piece of code.
I just can't seem to figure out how to create that filename from variables.
If anyone could help me out I'd be very grateful.
Thx in advance!
EDIT: I should point out more clearly its about the line = public var soundRequest:URLRequest = new URLRequest("sounds/" + Champ + soundType + ".mp3");
I get a 2044 unhandled ioerrorevent error and a 2032 stream error.
Actionscript Code:
package {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.media.*;
public class button extends MovieClip {
public var btn1:MovieClip;
public var btn2:MovieClip;
public var Champ:String = new String();
public var soundType:String = new String();
public var soundRequest:URLRequest = new URLRequest("sounds/" + Champ + soundType + ".mp3");
public var mySound:Sound = new Sound();
public var soundChannel1:SoundChannel = new SoundChannel();
public function button() {
btn1.addEventListener(MouseEvent.MOUSE_DOWN, btn1Down);
btn1.addEventListener(MouseEvent.MOUSE_UP, btn1Up);
}
function btn1Down(e:MouseEvent){
trace("click");
Champ = "Akali.";
soundType = "joke";
mySound.load(soundRequest);
soundChannel1 = mySound.play();
}
function btn1Up(e:MouseEvent){
trace("up");
}
}
}