2012-02-03 47 views
0

默认情况下,我在主时间轴的第一帧上有2个动画片段。还有前两个动画片段的actionscript代码。它们保存在每个单独的图层上。他们工作得很好,但是当我在maintime行中将所有三个关键帧从第一帧转移到第二帧时。它不能正常工作。我将它们转移到下一个关键帧的原因是因为我不想在第一帧插入预加载器。下面是我得到的输出消息:当动画片段移动到下一个关键帧as3时,动画无法正常工作

at Flashphotographygallerywebsite10_fla::MainTimeline/frame2() 
      at flash.display::Sprite/constructChildren() 
      at flash.display::Sprite() 
      at flash.display::MovieClip() 
      at flash.display::Sprite/constructChildren() 
      at flash.display::Sprite() 
      at flash.display::MovieClip() 
      at Flashphotographygallerywebsite10_fla::envolop_3() 

这里的ActionScript代码:

/*Re-sizeable background*/ 
//set stage for FBF 
stage.align = "TL"; 
stage.scaleMode = "noScale"; 


//define dynamic aspect ratios 
var bg_mainHeight = bg_main.height/bg_main.width; 
var bg_mainWidth = bg_main.width/bg_main.height; 


//add event listener to the stage 
stage.addEventListener(Event.RESIZE, sizeListener); 


//conditional statement to account for various initial browswer sizes and proportions 
function scaleProportional():void { 
      if ((stage.stageHeight/stage.stageWidth) < bg_mainHeight) { 
        bg_main.width = stage.stageWidth; 
        bg_main.height = bg_mainHeight * bg_main.width; 
      } else { 
        bg_main.height = stage.stageHeight; 
        bg_main.width = bg_mainWidth * bg_main.height; 
      }; 
} 


//center bg_mainture on stage 
function centerbg_main():void { 
      bg_main.x = stage.stageWidth/1000; 
      bg_main.y = stage.stageHeight/1000; 
} 


// make listener change bg_mainture size and center bg_mainture on browser resize 
function sizeListener(e:Event):void { 
      scaleProportional(); 
      centerbg_main(); 
} 


//run initial locations and size 
scaleProportional(); 
centerbg_main(); 




/*envelope align to center*/ 
function resizeHandler(e:Event):void 
{ 
    envelope_mc.x = (envelope_mc.stage.stageWidth/2) - (envelope_mc.width/1.15); 
    envelope_mc.y = (envelope_mc.stage.stageHeight/2) - (envelope_mc.height/1.15); 
} 

stage.align = StageAlign.TOP_LEFT; 
stage.scaleMode = StageScaleMode.NO_SCALE; 
stage.addEventListener(Event.RESIZE, resizeHandler); 

stage.dispatchEvent(new Event(Event.RESIZE)); 



stop(); 
+0

什么是ERROR码? – Benny 2012-02-03 12:57:50

+0

此框架上是否存在envelope_mc和bg_main? – 2012-02-03 13:20:24

+0

输出之后调试模式SET ON:式2:59] \t在flash.display使用::雪碧/ constructChildren() \t在flash.display使用::精灵() \t在flash.display使用::的MovieClip() \t在flash.display一::雪碧/ constructChildren() \t在flash.display使用::雪碧() \t在flash.display使用::影片剪辑() \t在Flashphotographygallerywebsite10_fla :: envolop_3() 有我没有得到错误信息。 – 2012-02-03 14:37:50

回答

0

,因为你的第一帧是空的,这意味着你的2个影片剪辑中没有定义您收到此错误,当您运行程序。确定这是问题的最简单方法是使第一帧的alpha = 0和第二帧的alpha = 1。如果您没有错误,那么这将确认这些影片剪辑未在第一帧中定义。

解决方法是从这些影片剪辑真正存在的时候开始放弃第二个代码。或者让它们在第一帧显示= false,以便它们始终可用。