Flash 如何修复在Firefox 3.5上识别的stage.stageWidth和stageHeight?
在个人全速闪现网站上工作,我真的不知道如何在Firefox浏览器上使MC在舞台上的地位保持一致。使用Safari,一切都很顺利 我尝试过一种方法,每次定时器关闭时(大约每200毫秒)设置一个定时器,它检查stage.stageWidth>0。如果是这种情况,请停止计时器并在舞台上开始调整大小。然而,它仍然无法在MAC的Firefox上运行( 在我的HTML代码中:Flash 如何修复在Firefox 3.5上识别的stage.stageWidth和stageHeight?,flash,resize,actionscript-3,Flash,Resize,Actionscript 3,在个人全速闪现网站上工作,我真的不知道如何在Firefox浏览器上使MC在舞台上的地位保持一致。使用Safari,一切都很顺利 我尝试过一种方法,每次定时器关闭时(大约每200毫秒)设置一个定时器,它检查stage.stageWidth>0。如果是这种情况,请停止计时器并在舞台上开始调整大小。然而,它仍然无法在MAC的Firefox上运行( 在我的HTML代码中: <link href="css/site.css" rel="stylesheet" type="text/css" />
<link href="css/site.css" rel="stylesheet" type="text/css" />
试验场地
<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>
var swf=新的SWFObject(“main.swf”、“mymovie”、“100%”、“100%””、“10%”、“000000”);
addParam(“allowScriptAccess”,“始终”);
swf.addParam(“比例”、“无比例”);
swf.write(“flashcontent”);
我不赞成找到正确的方法来修复它。以下是我当前的代码:
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();
}
}
public函数Main()
{
addEventListener(Event.ADDED_TO_STAGE,handleon STAGE,false,0,true);
}
私有函数阶段(事件:事件):无效
{
removeEventListener(Event.ADDED_TO_STAGE,handleon STAGE);
tabSWFLoader=Vector.([INTRO_SWF,BOOK1_SWF,BOOK2_SWF,PERSONAL_SWF]);
menuItems=新的MovieClip();
nextMC=新精灵();
currentMC=新精灵();
topBarMC=新的bgtobarmc();
bottomBarMC=新的BGBottomBarMC();
logoMC=新徽标();
menuContainer=新的MovieClip();
setReceiver();
stage.align=StageAlign.TOP\u左;
stage.scaleMode=StageScaleMode.NO_SCALE;
stage.addEventListener(Event.RESIZE,handleResizeObjectsOnStage,false,0,true);
//设置计时器以启动舞台上的初始化对象
阶段时间=新定时器(200);
stageTime.addEventListener(TimerEvent.TIMER,handleTime,false,0,true);
stageTime.start();
}
私有函数handleTime(事件:TimerEvent):无效
{
如果(stage.stageWidth>0&&stage.stageHeight>0){
initObjectsOnStage();
}
}
私有函数handleResizeObjectsOnStage(事件:事件=null):无效
{
如果(stage.stageWidth>0&&stage.stageHeight>0){
initObjectsOnStage();
}
}
私有函数initObjectsOnStage():void
{
如果(!isReady){
isReady=真;
stageTime.stop();
stage.removeEventListener(Event.RESIZE,handleResizeObjectsOnStage);
//动态调整BARMC的大小
底部Barmc.width=stage.stageWidth;
底部高度=舞台高度;
addChild(BARMC);
底部barmc.x=0;
bottomBarMC.y=stage.stageHeight-bottomBarMC.height;
//动态调整徽标大小
logoMC.x=40;
logoMC.y=顶杆高度+50;
addChild(logoMC);
//添加侦听器
logoMC.addEventListener(MouseEvent.CLICK,handleClickedLogo,false,0,true);
//**在Firefox中未显示此菜单,无法识别
menuContainer.x=65;
菜单容器y=720;
addChild(menuContainer);
menuContainer.addChild(菜单);
//从菜单类获取对象
menu.addEventListener(使用CustomEventCenter.OBJECT,handleMenu,false,0,true);
//调用介绍方法
initIntro();
}
}
我使用ENTER\u帧处理程序监听,直到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!
}
等等,让我直说吧,你在一个“全速闪现网站”上工作,而不是被你的上级强迫这么做?