2010-01-26 69 views
0

我有視頻負載訪問的NetStream或MovieClip從環AS2

var ns1:NetStream = new NetStream(nc); 
container1.compMa.theVideo.attachVideo(ns1); 
ns1.play("sukh_diesel.flv", 1); 

//

var ns2:NetStream = new NetStream(nc); 
container2.compMa.theVideo.attachVideo(ns2); 
ns2.play("sukh_beneath.flv", 1); 

//和4個,我已經離開了簡明扼要

我想

function pauseVid(){ 
this.ns1.pause(); 
    for(i=1;i<7;i++){ 
    this["ns"+i]pause(); 
    } 
} 

的COMME暫停他們nted脫節:

this.ns1.pause()

的作品,但是當我嘗試在一個循環就不能訪問它?

回答

0

您是否嘗試過使用eval來按名稱訪問您的流?

function pauseVid(){ 
    var localStream:NetStream; 
    for(i=1;i<=7;i++){ 
     localStream = eval("ns"+i); 
     localStream.pause(); 
    } 
} 

我會建議跟蹤您的對象與流的數組例如。這樣你可以避免改變你的陳述的上限。