Hi all,
Working on personal full flash site and I can't really figure out how to make MC's position on Stage aligned on Firefox browser. Everything goes fine using Safari.
I have tried a method of set a timer every time it goes off (every 200 ms or so) it checks to see if stage.stageWidth > 0. If that is the case, do stop the timer and start resize on stage. However it's still not working on Firefox of MAC. :(
In my HTML code:
<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>
I'm desesperated of finding the right way to fix it. Here's my current code:
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();
}
}