【发布时间】:2012-02-03 11:56:21
【问题描述】:
默认情况下,我在主时间轴的第一帧上有 2 个影片剪辑。以及前两个movieclips的actionscript代码。它们保存在每个单独的层上。他们工作得很好,但是当我将所有三个关键帧从主时间线上的第一帧转移到第二帧时。它不能正常工作。我将它们转移到下一个关键帧的原因是因为我不想在第一帧插入预加载器。这是我收到的输出消息:
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()
这是动作脚本代码:
/*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();
【问题讨论】:
-
信封_mc和bg_main是否存在于这个框架上?
-
调试模式设置为 ON 后的输出:frame2:59] 在 flash.display::Sprite/constructChildren() 在 flash.display::Sprite() 在 flash.display::MovieClip() 在 flash .display::Sprite/constructChildren() at flash.display::Sprite() at flash.display::MovieClip() at Flashphotographygallerywebsite10_fla::envolop_3() 我没有收到任何错误消息。
标签: flash actionscript-3