0

嗨,我是 Flash 新手,我正在测试站点演示中的 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 包并将该文件夹放在我的 fla 文件所在的位置。但不幸的是它不起作用。

链接stackoverflow可能重复,但我不明白这个解决方案。

有什么帮助吗?

4

1 回答 1

1

在您的 Game.fla 所在的目录中创建一个新文件夹,然后将该文件夹命名为Classes ,然后将 caurina 文件夹放入该Classes文件夹中,现在转到 File->Actionscript Settings->Source Path click(+) 并写入./Classes

这对我有用

于 2013-04-14T06:46:08.000 回答