So I've spent the last 3 hours trying to make my Flash site go fullscreen. Amazing how much you learn and how much time you can waste on hidden, obscure bugs and missing features. Especially frustrating when your deadline is fast approaching and at the end of it all, you realize you've probably just spent that last 3-4 hours in vain.
The source of my frustration? wmode = transparent. Apparently, Flash doesn't like working in fullscreen mode with this little piece of code put into place. They supposedly fixed this with Flash player 9,0,28,0. Well, according to their own site, I have 9,0,115,0 installed. Basically, I wanted my HTML background image to show through (for loading reasons, for my site's hovering reasons, matching the landing page reasons, etc.). I just placed the background inside of my Flash to fix this, because going full screen was more important than not.
So I go ahead and set my HTML to 100% width and 100% height. Who knows what I did here, but apparently Firefox didn't like that. It refused to display the bottom 3/4 of my site. The header looked great though, if I do say so myself. Luckily, I cared less about my height being 100%, since my site is a fixed 850 tall. This worked.
So now I've set everything up, first frame of my site:
Stage.scaleMode = "noScale";
Stage.align = "TL";
The most important part of this fullscreen was that my movieClip displays at 100%x100% of the stage size. So I set this code on the same frame as where my movieClip appears:
movieClip._x = 0;
movieClip._y = 0;
movieClip._height=Stage.height;
movieClip._width=Stage.width;
sizeListener = new Object();sizeListener.onResize = function() {
trueX = (Stage.width - 1050)/2;
movieClip._x = 0;
movieClip._y = 0;
movieClip._width = Stage.width;
movieClip._height = Stage.height;
};
Stage.addListener(sizeListener);
I quickly find out that since my movieClip is nested in another clip, it uses the 0,0 of that parent clip. Being impatient and not really a Flash developer, I decide I can live with having that movieClip on my main timeline. I'm sure there's a way to pass the _root x and y values through, maybe some code where I know the starting x,y of the parent clip and using subtraction/division/shorthand/the Lord, etc., get this to work.
So now I realize, this works nicely. But now my site isn't centered. It's that pesky Stage.align = "TL". I don't like that. So I set the value to "T", only to find out why we use "TL". 0,0 is not the top most corner of the entire browser window; it's the top left corner of your movie itself. So now my movieClip is about an inch from the left when it appears. That won't work.
So doing a little Googling, I find out everything I want to know about centering a movieClip while fullscreen, but not my entire Flash site. So I figure, let me just put my entire site into a movieClip and I can work with that. After I do this, I realize I'm way too deep into this to have to go back and redo all of my paths, so I scrap that idea.
I put on my thinker's cap and figure, hmmm.... if I know the width of my site (1050) and I know the width of the stage (Stage.width), I should be able to throw together a little equation to figure out the top left x,y of the browser window. I'm an Art major, I only had to take one math class. Work with me here:
trueX = (Stage.width - 1050)/2;
Let's say, my Stage.width minus my Flash width is 200. Well, this is gonna leave 100px on each side of my SWF, since it's centered. So I subtract and divide by two, to get my "trueX". Well, that's all well and good, but 100 is obviously to the right of 0,0. So my next line is:
movieClip._x = -(trueX);
This places my movieClip at -100,0, which is the true 0,0 of this browser screen.
Whew. I don't have to cry now.
I don't know what this blog will be or if I'll even be writing in it after my launch date. It's more of a way to express my frustrations and maybe help point someone else in the right direction.
2 comments:
So I stopped being lazy. I place my movieClip back into the "nest". I knew my parent MC's x,y was 278,252, to I subtracted each of those from my other values. So my y ends up -252 and my x, -(trueX) - 278.
Sigh. Worked.
I think I found the Firefox, 3/4 screen fix. According to "Guest":
The problem isn't a bug and it isn't a flash problem. What 100% height computes to depends on the height of the containing element. There is no explicit height for the containing elements body and html. Set those with CSS:
html style="height: 100%">
body style="height: 100%">
object...>
embed...>
I'll try it out later.
Post a Comment