您好我是flash新手,我正在测试网站demo的Flash代码 但它会出现像
这样的错误 Scene 1, Layer 'Layer 1', Frame 1, Line 1 1172: Definition caurina.transitions:Tweener could not be found.
Scene 1, Layer 'Layer 1', Frame 1, Line 1 1172: Definition caurina.transitions:Tweener could not be found.
Scene 1, Layer 'Layer 1', Frame 1, Line 31 1120: Access of undefined property Tweener.
Scene 1, Layer 'Layer 1', Frame 1, Line 41 1120: Access of undefined property Tweener.
Scene 1, Layer 'Layer 1', Frame 1, Line 44 1120: Access of undefined property Tweener.
我的代码是:
import caurina.transitions.Tweener;
var last_item:Number;
var first_item:Boolean = true;
var rand_num:Number;
var timer:Timer = new Timer(4000, 1);
// Create MovieClips
for(var i=0; i<8;i++) {
var newNum = i + 1;
var clip = new Array();
clip[i] = new item();
clip[i].name = "clip" + newNum;
clip[i].x = 337;
clip[i].dyn_text.text = newNum;
addChild(clip[i]);
}
// Begin scrolling of content
auto_scroll();
function auto_scroll():void {
//Generate random number between 1 and array length
rand_num = randomNumber(1, clip.length);
//Generate another random number until is doesn't equal the last one
while(rand_num == last_item) {
rand_num = randomNumber(1, clip.length);
}
//Only scroll in content if item is the first one
if(first_item == true) {
Tweener.addTween(getChildByName("clip" + rand_num), {x: 10, time:1, transition:"Linear"});
first_item = false;
last_item = rand_num;
}
timer.addEventListener(TimerEvent.TIMER, transition_items);
timer.start();
}
function transition_items(event:TimerEvent):void {
// Scroll last item out of view and scroll new content in
Tweener.addTween(getChildByName("clip" + last_item), {x: -336, time:1, transition:"Linear", onComplete: function():void {getChildByName("clip" + last_item).x = 337;} });
Tweener.addTween(getChildByName("clip" + rand_num), {x: 10, time:1.2, transition:"Linear", onComplete: function():void {last_item = rand_num;auto_scroll()} });
}
function randomNumber(low:Number=0, high:Number=1):Number {
return Math.floor(Math.random() * (1+high-low)) + low;
}
我无法理清这个错误,当我按ctrl+Enter
进行测试时,此代码会出错。我还会下载tweener package并将该文件夹放在我的fla文件所在的位置。但不幸的是它没有不行。
链接stackoverflow可能重复,但我不明白这个解决方案。
任何帮助?
答案 0 :(得分:1)
在Game.fla所在的目录中创建一个新文件夹将该文件夹命名为 Classes 之后将 Classes 文件夹中的caurina文件夹转到File-&gt; Actionscript Settings-&gt; Source Path点击(+)并写下 ./ Classes
这对我有把戏