在个人全闪存网站上工作,我真的想不出如何让MC在舞台上的位置在Firefox浏览器上对齐。使用Safari一切都很顺利。
我尝试了一种方法,每次计时器关闭时(大约每隔200ms),它会检查stage.stageWidth是否> 0。如果是这种情况,请停止计时器并在舞台上开始调整大小。然而,它仍然不能在MAC的Firefox上工作。:(
在我的HTML代码中:
<link href="css/site.css" rel="stylesheet" type="text/css" />
Test Site<script type="text/javascript">
var swf = new SWFObject("main.swf", "mymovie", "100%", "100%", "10", "#000000");
swf.addParam("allowScriptAccess", "always");
swf.addParam("scale", "noscale");
swf.write("flashcontent");
</script>
我不想找到正确的方法来解决这个问题。下面是我当前的代码:
public function Main()
{
addEventListener(Event.ADDED_TO_STAGE, handleOnStage, false, 0, true);
}
private function handleOnStage(event:Event):void
{
removeEventListener(Event.ADDED_TO_STAGE, handleOnStage);
tabSWFLoader = Vector.<String>([INTRO_SWF, BOOK1_SWF, BOOK2_SWF, PERSONAL_SWF]);
menuItems = new MovieClip();
nextMC = new Sprite();
currentMC = new Sprite();
topBarMC = new BGTopBarMC();
bottomBarMC = new BGBottomBarMC();
logoMC = new Logo();
menuContainer = new MovieClip();
setReceiver();
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.addEventListener(Event.RESIZE, handleResizeObjectsOnStage, false, 0, true);
// Set timer to start initialize objects on stage
stageTime = new Timer(200);
stageTime.addEventListener(TimerEvent.TIMER, handleTime, false, 0, true);
stageTime.start();
}
private function handleTime(event:TimerEvent):void
{
if (stage.stageWidth > 0 && stage.stageHeight > 0) {
initObjectsOnStage();
}
}
private function handleResizeObjectsOnStage(event:Event=null):void
{
if (stage.stageWidth > 0 && stage.stageHeight > 0) {
initObjectsOnStage();
}
}
private function initObjectsOnStage():void
{
if (!isReady) {
isReady = true;
stageTime.stop();
stage.removeEventListener(Event.RESIZE, handleResizeObjectsOnStage);
// Resize dynamically bottomBarMC
bottomBarMC.width = stage.stageWidth;
bottomBarMC.height = stage.stageHeight;
addChild(bottomBarMC);
bottomBarMC.x = 0;
bottomBarMC.y = stage.stageHeight - bottomBarMC.height;
// Resize dynamically logo
logoMC.x = 40;
logoMC.y = topBarMC.height+50;
addChild(logoMC);
// Add listener
logoMC.addEventListener(MouseEvent.CLICK, handleClickedLogo, false, 0, true);
// ** In Firefox doesn't show up this menu, couldn't recognize
menuContainer.x = 65;
menuContainer.y = 720;
addChild(menuContainer);
menuContainer.addChild(menu);
// Get objects from Menu class
menu.addEventListener(CustomEventCenter.OBJECT_USED, handleMenu, false, 0, true);
// Call intro method
initIntro();
}
} 发布于 2010-06-05 05:49:15
我使用一个ENTER_FRAME处理程序来侦听,直到stage.stageWidth > 0 && stage.stageHeight > 0。
public function Main()
{
addEventListener(Event.ENTER_FRAME, enter_frame );
}
private function enter_frame(e:Event)
{
if ( stage.stageWidth > 0 && stage.stageHeight > 0 )
{
removeEventListener( Event.ENTER_FRAME, enter_frame );
init();
}
}
private function init()
{
// GOOD TO GO!
}https://stackoverflow.com/questions/2968036
复制相似问题