Need help with passing a variable in a function


hello. working on flash app needs play videos. have code using netstream works great 1 movie. problem have 3 movies want play , need figure out how replace string variable correct path info depending on button pushed. i'm thinking needs array have coded not working. here 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; < buttonarray.length; i++) {

 

buttonarray[i].addeventlistener(mouseevent.click, playclicked);

 

}

 

function playclicked(e:mouseevent):void {

 

// check's, if flv has begun

 

// download. if so, resume playback, else

 

// load file

 

if(!bolloaded) {

 

var clickedindex:int = buttonarray.indexof(event.currenttarget);

 

nsstream.play(strsource[clickedindex]);

 

bolloaded = true;

 

trace (strsource)

 

}

 

else{

 

nsstream.resume();

 

}

 

this set 2 buttons testing. keep getting "1120: access of undefined property event." right @ "nsstream.play(strsource[clickedindex]);" line. variable strsource trying pass different movie paths into, having no luck. setting right or there way this? appreciated. thanks.

-shawn

try trying event.target instead of event.currenttarget - way have setup event.currenttarget else , not value in array.



More discussions in ActionScript 3


adobe

Comments

Popular posts from this blog

How to set the order of FAQs instead of alphabetical

Thread: Get UK Keyboard working

how do I change the e-mail address for my merchant account