루프를 위해 나는 작업으로 onRollOver와 루프를 들어이를 얻을 수 없습니다.에으로 onRollOver 문제
for (var i:Number = 1; i<=4; i++) {
this['videobutton'+i].onRollOver = function() {
trace(i);
this['stream'+i].pause(false);
this['video'+i].attachVideo(this['stream'+i]);
fadeIn(this['video'+i]);
};
}
변수 범위와 i와는 관련이 있다고 생각하지만 해결 방법을 모르겠습니다. 5
어떤 아이디어 :
추적은 저를 준다?
다음은 소스 파일의 : http://drop.io/gqdcyp3
업데이트
내가 나 자신을 해결,하지만 난 그게 최적의 솔루션 생각하지 않습니다 :
var videos:Array = new Array(
'ltp_video-low1.flv',
'ltp_video-low1.flv',
'ltp_video-low1.flv',
'ltp_video-low1.flv'
);
function videoOver(buttonMC,video,stream) {
buttonMC.onRollOver = function() {
stream.pause(false);
video.attachVideo(stream);
fadeIn(video);
};
}
function videoOut(buttonMC,video,stream) {
buttonMC.onRollOut = function() {
fadeOut(video);
stream.pause();
};
}
for (var i:Number=1; i<=4; i++) {
this['connection'+i] = new NetConnection();
this['connection'+i].connect(null);
this['stream'+i] = new NetStream(this['connection'+i]);
this['stream'+i].play(videos[i-1]);
videoOver(this['videobutton'+i],this['video'+i],this['stream'+i]);
videoOut(this['videobutton'+i],this['video'+i],this['stream'+i]);
}
는 어쨌든이 작동합니다. 그러나 누군가가 내게이 솔루션을 만들어 줄 수 있다면 좋을 것입니다. 루프에서 함수를 어떻게 가질 수 있습니까?
다른 것들처럼 작동하지 않았다. 추적 결과에 올바른 번호가 표시되지만 아무 일도 일어나지 않습니다. 당신은 FLA를 다운로드하여보세요. –
글쎄, 그럼 당신의 문제가 해결되고 그래서이 질문입니다. for 루프가 작동합니다. 이 질문을 닫고 다른 것을 게시해야합니다. 어쩌면 .. – evilpenguin
첫 번째 다른 실수는 스트림이 비디오 버튼에 없지만 무대에 있기 때문에 attachVideo (this [ 'stream'+ this.id ]) with attachVideo ([ 'stream'+ this.id]) – evilpenguin