I'm primarily an ASP.NET C# coder, but the company where I work has been doing more and more with Flash Video, so I've been having to get my feet wet with ActionScript. I'm definitely not a Flash/Actionscript/Flash Media Server expert by any stretch of the imagination, but I'm generally able to get the things I need to do done. Today, while working on adding a "Full Screen" mode to our video player app, I ran into a problem that still has me stumped.
First off, making a Flash CS3/Actionscript 3.0 app go full screen is a fairly painless process. A single line of code in a CLICK event handler will get the job done.
function myFullScreenClickHandler(event:MouseEvent) : void
{
stage.displayState = "fullScreen";
}
or the arguably more correct version of the same thing:
function myFullScreenClickHandler(event:MouseEvent) : void
{
stage.displayState = StageDisplayState.FULL_SCREEN;
}
There are a few security concerns you have to be aware of like making sure you add "allowFullScreen" attributes to your object and embed tags. This information and a whole lot more regarding full screen flash apps can be found in the "Exploring full-screen mode in Flash Player 9" article available on the Adobe website.
As I mentioned before, this is easy and it works great, but it has one fairly significant issue. When a flash app goes full screen, it scales up to fit within the screen. This works pretty good if the aspect ratio of the flash application is roughly the same as that of the users monitor, but in cases where they are wildly different it doesn't work well at all.
Case in point: If I had a flash video application that was taller than it was wide, (say 160 x 360 composed of a 160 x 120 video player with a 160 x 240 video selection below) than going to full screen on a 1600 x 1200 display would cause the app to scale up to roughly 533 x 1200. In other words, a third of the screen would be blank on both sides of the flash application. Worse yet, my entire application has scaled up rather than just the video portion which is really what I wanted to go full screen.
While looking for a way to solve this little delima, I ran into an article on the Adobe Labs website entitled "Flash Player:9:Update:Full-Screen Mode HW". This article outlines a way to use the "fullScreenSourceRect" attribute of the Stage object to specify a rectangular region of the flash application to use when going into full screen mode.
From what I can tell, this is already supported in Flash Player 9, and if you are coding in ActionScript 2, then you are in luck because it works perfectly with a couple lines of code:
function myFullScreenClickHandler(event)
{
Stage["fullScreenSourceRect"] = new Rectangle(myVideo.x, myVideo.y, myVideo.width, myVideo.height);
Stage["displayState"] = "fullScreen";
}
However, in ActionScript 3.0 it's a little bit different. Based on the Adobe Labs article, I believe the ActionScript 3.0 code is supposed to look something like this (note, this may not be correct):
function myFullScreenClickHandler(event:MouseEvent) : void
{
stage.fullScreenSourceRect = new Rectangle(myVideo.x, myVideo.y, myVideo.width, myVideo.height);
stage.displayState = StageDisplayState.FULL_SCREEN;
}
I tried running this code and the following compiler error was generated:
ReferenceError: Error #1056: Cannot create property fullScreenSourceRect on flash.display.Stage
Reading further in the Adobe Labs article, it states that if you are using ActionScript 3.0 with Flash CS3 or Flex Builder, an updated playerglobal.swc needs to be installed for the fullScreenSourceRect property to be recognized. This file and information on where to place it is also included in the Adobe Labs article.
Next, I downloaded the file with the new playerglobal.swc file, located and renamed the existing file and then put the new one in it's place. At this point I was pretty confident that I was only moments away from having a flash video player with very sweet full screen functionality. However, I immediately started getting new compilation errors like the following:
1046: Type was not found or was not a compile-time constant: FullScreenEvent.
1172: Definition flash.display:StageDisplayState could not be found.
1172: Definition flash.events:FullScreenEvent could not be found.
After digging around at the Adobe Labs site, I noticed that someone had commented on this very issue, but there were no further responses regarding how to resolve it.
At this point, I can only assume that either the file is bad, or there is something wrong with some Flash CS3 installations (including mine) that prevents it from working properly. I would be very interested in finding out if anyone else has experienced this issue and better yet if they have found a solution to it.
** UPDATE 8/3/2007 ** - RESOLVED!
Adobe has updated the article on the Adobe Labs site to include a new version of playerglobal.swc which works properly. Note that in order to be able to set the "fullScreenSourceRect" attribute of the stage object, you need to be using the Flash 9 Update 3 Beta player or newer, otherwise an error will be thrown when you try and set the attribute.
Well, it's been almost 8 months since I setup my first saltwater aquarium. It's definitely been a learning process and there is still a lot left to learn. My ultimate goal is to have a stunning reef tank that is filled with colorful fish and coral. I'm not close to being there yet, but things are at least starting to take shape. Hopefully over time I'll be able to aquire the equiipment, skills and coral frags that I need in order to achieve my goal. I've uploaded a few pics of the tank into a new photo gallery.
[ View Photo Gallery ]
Here's the current stock list for my tank
Fish: Percula Clowns (3), Blue/Green Chromis(4), Diamond Goby, Lawnmower Blenny, Blue Tang, Royal Gramma, Yellow Tail Damsel
Inverts: Green Brittle Star, Grey Serpent Star, 15 Blue/Red Leg Hermits, Emerald Crab, Skunk Cleaner Shrimp, Pepermint Shrimp
Corals: CandyCane, Red/Purple Mushrooms, Green Mushrooms, Green Star Polyp Colony, Brown Poly (single), Kenya Tree, Anthelia Colony
Last but not least, a big thanks to all the people from The Greater Iowa Reef Society who've been so much help as I learn about all of this.
Well, I finally did something I've wanted to do for a long time: Create a blog for myself. Hopefully I will find worthy things to blog about in the future and maybe someone will even find them worth reading on occasion. Only time will tell I guess.