可能是因为我写了它,但是,错误在哪里?
function getTotalVideoFrame ():int {
if (video.current > 0) {
var frames:int = 0;
for (i:int = 0; i < video.current; i ++) {
frames += video.chapters[i].frames;
}
frames = frames + getCurrentVideoFrame ();
return frames;
}
return getCurrentVideoFrame ();
}
错误:
Scene 1, Layer 'as3', Frame 1, Line 1051 1084: Syntax error: expecting in before colon.
Scene 1, Layer 'as3', Frame 1, Line 1051 1084: Syntax error: expecting rightbrace before rightparen.
如果我comment the for statement
一切正常,我必须花时间看不到错误。
答案 0 :(得分:2)
我认为您在var
循环中遗漏了for
:
for (var i:int = 0; i < video.current; i ++)
答案 1 :(得分:0)
arghh !!找到了......
// the wrong for
for (i:int = 0; i < video.current; i ++) {
frames += video.chapters[i].frames;
}
我忘了添加var
关键字
// the right for
for (var i:int = 0; i < video.current; i ++) {
frames += video.chapters[i].frames;
}
答案 2 :(得分:0)
function getTotalVideoFrame():int {
if(video.current&gt; 0){
var frames:int = 0;
for(var i:int = 0; i&lt; video.current; i ++){
frames + = video.chapters [i] .frames;
}
frames = frames + getCurrentVideoFrame();
返回帧;
}
return getCurrentVideoFrame();
}