|
-
Banned
[CS3] Screen Resolution
Step 1: In the first frame, flash checks for screen resolution. If it is not 1024x768, the flash will display a message saying "Please change your screen resolution to 1024x768 and then press OK".
I am using System.capabilities.screenResolutionX and System.capabilities.screenResolutionY to check for screen resolution.
Step 2: Now the user is supposed to change his screen resolution and then click on OK. Now it goes to next frame where again I use the same code to check for screen resolution.
The Problem is that: Even after the user has changed the screen resolution and pressed OK, flash again reads the same screen resolution that he had before. why does this happen????
Last edited by deepakflash; 05-15-2008 at 05:27 AM.
-
Flashmatics
because System.capabilities.screenResolutionX holds the value of the resolution of the screen when the flash movie is first loaded.. you will need to refresh the page to get the new resolution..
P.S I would recommend not forcing users ..very few people will want to change their resolution for visiting a website..you will lose a lot of traffic in my opinion
Last edited by silentweed; 05-15-2008 at 09:08 AM.
-
Banned
okay, so is ther a way i can do it without refreshing the page?
-
http://www.in3d.eu
Hi,
At the moment an alternative I can think is:
To use the externalInterface class of flash (or any other way to pass data from html page to flash) to call a JavaScript function that itself returns the resolution using the javascript "screen.width" and "screen.height" properties
Assume use your flash inside a browser (and also that the browser support the externnalInterface)
Also just a thought: maybe if unload the _root movie [unloadMovie(_root)] and after a while reload the file [_root.loadMovie("MovieFile.swf") OR using the MovieClipLoader], forces the System.capabilities to get upaded values (have not test it. Just an idea..)
Kostas
Last edited by Kostas Zotos; 05-15-2008 at 09:25 AM.
-
Banned
hmm.... i think i will go with your second point. i will load the swf into an movieClip. When user clicks on OK, it immediately unloads the swf and then AGAIN loads it immediately. So, the same system.capabilities will get triggered and may be it can show up the new resolution.
Thanks mate. I will try it and get back.
-
http://www.in3d.eu
Hi again,
The externalInterface example can be like this:
In your AS inside flash:
(Need a button on stage named: "myButton". When press the button a javascript function called which returns the screen resolution) :
PHP Code:
import flash.external.*;
// IMPORTANT: THIS REQUIRES A BUTTON ON THE STAGE NAMED: "myButton"
var Width:Number
var Height:Number
var myFunctionName:String = "SendResolution" // The name used inside HTML
var myFunction:Function = UpdateResolution; // The AS function
ExternalInterface.addCallback(myFunctionName, null, myFunction);
// Used to display the resolution input from JavaScript
var StatusField=this.createTextField("StatusField",getNextHieghestDepth(),20,20,Stage.width-40,30)
StatusField.border=true
if (!myButton) trace('THIS REQUIRES A BUTTON ON THE STAGE NAMED: "myButton"')
function UpdateResolution(Input:String):Void {
var Res=Input.split("*")
Width=Number(Res[0])
Height=Number(Res[1])
StatusField.text = "W: "+Width+" H: "+Height
}
myButton.onRelease=function(){
getURL("javascript:void(GetResolution())") // Call the JavaScript function (must exists in the HTML doc)
}
In the HTML file insert this JavaScript code (example inside the "head" section):
Code:
<script language="javascript">
function GetResolution() {
// USE YOUR FLASH MOVIE NAME INSTEAD (the file name without the .swf)
var MovieName="ExternalInterface_getScreenResolution"
var Movie=null
if (navigator.appName.indexOf("Microsoft") != -1) {
Movie=window[MovieName]
} else{
Movie= document[MovieName]
}
// Send a single argument using the * as delimiter (i split it inside flash)
if (Movie) Movie.SendResolution(screen.width+"*"+screen.height);
}
</script>
Note1: This had tested and worked with flash 8
Note2: ExternalInterface not supported in all browsers and operating systems however..
Regards!
Kostas
Last edited by Kostas Zotos; 05-15-2008 at 11:26 AM.
-
Banned
-
another voice for not forcing people to run a certain resolution. Who knows perhaps at some point the newest flash player doesn´t support that System.capabilities object- or a user blocked Javascript and then a stupid message like "oh your computer settings dont match the minimal requirements..."
its the same mistake many webdesigners did in the past for the IE
-
my question is why would you need do to that???
on a side note, maybe 1 user on 1000 knows how to change his screen res. and .0001 of that % will be willing to do so.
gparis
-
http://www.in3d.eu
 Originally Posted by deepakflash
Kostas, thanks a Ton ... i would actually love it if it had supported all browsers
Your welcome! 
Yes is problem (is not a reliable cross browser/platform solution..)
There was also a "SetVariable" method to pass data from JavaScript to Flash, but seems that is not working in flash player 9 
Here is the available list of browser-OS combinations (and other details) given by Adobe:
http://livedocs.adobe.com/flash/9.0/...Interface.html
Maybe this "Flash / JavaScript Integration kit" provides some good implementation for JavaScript-Flash connection (I have not try it):
http://weblogs.macromedia.com/flashjavascript
Also indeed ask the user to change the screen resolution is not a recommended practice.. This even may distract a hevy of shortcuts and icons user's initial desktop layout... (a possibly angry visitor.. is not a good visitor..)
However It would be nice if the "System.capabilities" reflected always updated data..
Best Regards!
Kostas
Last edited by Kostas Zotos; 05-17-2008 at 11:55 AM.
-
5+5=55
I agree with render and gparis... I think you'd be better off just suggesting they change their resolution, instead of forcing them. Some people might not even be able to change their resolution to 1024x768 (like people using an Eee PC). Maybe you could include some simple instructions about how to change resolution (on Windows & Mac) so they'll be more likely to do it if they don't know how.
-
Banned
 Originally Posted by gparis
maybe 1 user on 1000 knows how to change his screen res. and .0001 of that % will be willing to do so.
gparis
hmm... very true
-
Banned
 Originally Posted by Schfifty Five
I think you'd be better off just suggesting they change their resolution, instead of forcing them. Some people might not even be able to change their resolution to 1024x768 (like people using an Eee PC). Maybe you could include some simple instructions about how to change resolution (on Windows & Mac) so they'll be more likely to do it if they don't know how.
Yes, i think I will instruct them, but how do i instruct them about changing the screen resolution in a Mac, I haven't used it. Can someone tell me?
And the reason why i am forcing people to change screen resolution is that when i tested it with some of my IDIOTIC primitive-resolution-using-friends, they were still on 800 by 600 resoultion, and my site looks like a monster to them with all the texts looking UGLY BIG and scrolling bars all over. Some of them dont even have the common sense to scroll to the other side and see what is to be clicked. They just sit in front of PC like watching TV...I HATE it.
So i decided, if you really want to see my site then better change your resolution else DONT
Last edited by deepakflash; 05-19-2008 at 01:54 AM.
-
maybe configure your friends,- not the resolution 
The more you demand from your visitor the less visitors you will welcome in the end.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|