Need help with passing a variable in a function
Hello. I am working on a Flash app that needs to play videos. I have code using netstream that works great for one movie. The problem is I have 3 movies I want to play and I need to figure out how to replace the string variable with the correct path info depending on what button is pushed. I'm thinking this needs to be an array which I have coded but it is not working. Here is the code:
var buttonArray:Array = [chamber.btnV01,chamber.btnV02];
var strSource:Array = ["HiFlow_Conventional_4.mp4","Tool_Less_5.mp4"];
trace (buttonArray)
for (var i:int = 0; i < buttonArray.length; i++) {
buttonArray.addEventListener(MouseEvent.CLICK, playClicked);
}
function playClicked(e:MouseEvent):void {
// check's, if the flv has already begun
// to download. if so, resume playback, else
// load the file
if(!bolLoaded) {
var clickedIndex:int = buttonArray.indexOf(event.currentTarget);
nsStream.play(strSource[clickedIndex]);
bolLoaded = true;
trace (strSource)
}
else{
nsStream.resume();
}
This is just set for two buttons for testing. I keep getting the "1120: Access of undefined property event." right at the "nsStream.play(strSource[clickedIndex]);" line. The variable strSource is what I am trying to pass different movie paths into, but I am having no luck. Am setting this up right or is there another way to do this? Any help would be much appreciated. Thanks.
-Shawn