07-15-2008, 07:20 AM
|
#1
|
|
Registered User
Join Date: Jul 2008
Posts: 13
|
on/off button for fullscreen
hello,
i want to make an on/off button for a flash programm, but i cant figure out how to create this.
(the point is, i DO NOT want:
fullscreen on/off, and that you have to click on to go fullscreen and off to go windowed...)
i want that if you click the whole line (fullscreen on/off) when your screen is full, that it goes windowed, and when its windowed, it goes fullscreen....
maybe a bit shitty description, but ill try to write it out:
first i make fullscreen on/off a button,
the code should be something like this (i think :P):
Code:
on (release) {
if (fscommand("fullscreen") == false) {
fscommand("fullscreen", true); }
else{
fscommand("fullscreen", false);
}
}
when it is fullscreen it will go back to windowed, but it doesnt work to get it from windowed to fullscreen...
dont know how to fix, could anyone help? (sorry im just a starter  )
Last edited by 3747; 07-15-2008 at 07:28 AM.
|
|
|
07-15-2008, 07:31 AM
|
#2
|
|
Registered User
Join Date: Jul 2008
Posts: 13
|
i hope its ok if i reserve this 1 for when the answer is found, i can post it.
|
|
|
07-15-2008, 08:06 AM
|
#3
|
|
Senior Member
Join Date: Feb 2007
Posts: 173
|
i hope this will helps you....
|
|
|
07-15-2008, 03:25 PM
|
#4
|
|
Registered User
Join Date: Jul 2008
Posts: 13
|
Quote:
Originally Posted by jorawar
i hope this will helps you....
|
well, the .swf file is what im looking for yes, but i cant open the .fla file :S
says unexpected file format, could u paste the code please?
thanks anyway
|
|
|
07-15-2008, 04:13 PM
|
#5
|
|
Senior Member
Join Date: Apr 2007
Posts: 4,772
|
Either of these should work to toggle fullscreen...
ActionScript Code:
// Using FSCommand
stop();
Stage.scaleMode = "noScale"; // optional
Stage.align = "TL"; // optional
//
var toggleScreen:Boolean = false;
yourMC_btn.onRelease = function():Void {
if (toggleScreen) {
fscommand('fullscreen', false);
toggleScreen = false;
} else {
fscommand('fullscreen', true);
toggleScreen = true;
}
};
ActionScript Code:
// Or Flash Player 9 Fullscreen Feature
stop();
Stage.scaleMode = "noScale"; // optional
Stage.align = "TL"; // optional
//
function toggleScreen():Void {
if (Stage["displayState"] == "normal") {
Stage["displayState"] = "fullScreen";
} else {
Stage["displayState"] = "normal";
}
}
yourMC_btn.onRelease = function():Void {
toggleScreen();
};
|
|
|
07-15-2008, 06:51 PM
|
#6
|
|
Registered User
Join Date: Jul 2008
Posts: 13
|
Quote:
Originally Posted by asf8
Either of these should work to toggle fullscreen...
ActionScript Code:
// Using FSCommand
stop();
Stage.scaleMode = "noScale"; // optional
Stage.align = "TL"; // optional
//
var toggleScreen:Boolean = false;
yourMC_btn.onRelease = function():Void {
if (toggleScreen) {
fscommand('fullscreen', false);
toggleScreen = false;
} else {
fscommand('fullscreen', true);
toggleScreen = true;
}
};
ActionScript Code:
// Or Flash Player 9 Fullscreen Feature
stop();
Stage.scaleMode = "noScale"; // optional
Stage.align = "TL"; // optional
//
function toggleScreen():Void {
if (Stage["displayState"] == "normal") {
Stage["displayState"] = "fullScreen";
} else {
Stage["displayState"] = "normal";
}
}
yourMC_btn.onRelease = function():Void {
toggleScreen();
};
|
does not seem to work  ?
the one with the zip file added is perfect, but cant load the .fla, can someone load it for me and copy code??
thnx :$
|
|
|
07-15-2008, 08:51 PM
|
#7
|
|
Senior Member
Join Date: Apr 2007
Posts: 4,772
|
Quote:
Originally Posted by 3747
does not seem to work? the one with the zip file added is perfect, but cant load the .fla, can someone load it for me and copy code?? thnx
|
What version of Flash do you have? The first code should work fine for you and does the same things as the SWF jorawar provided, except I added the scale as "optional"... but if you take that out it should do what jorawar's SWF does?
ActionScript Code:
stop();
var toggleScreen:Boolean = false;
yourMC_btn.onRelease = function():Void {
if (toggleScreen) {
fscommand('fullscreen', false);
toggleScreen = false;
} else {
fscommand('fullscreen', true);
toggleScreen = true;
}
};
The second code I provided needs Flash 9, or Flash 8 with one line of code added to the Stage Class file that comes with Flash. I do not have CS3 either to open jorwar's FLA, however in looking at the outcome of the SWF, the code I provided does the same (atleast for me).
Sorry, tried to help.
Last edited by asf8; 07-15-2008 at 08:54 PM.
|
|
|
07-15-2008, 10:21 PM
|
#8
|
|
Registered User
Join Date: Jul 2008
Posts: 13
|
Quote:
Originally Posted by asf8
What version of Flash do you have? The first code should work fine for you and does the same things as the SWF jorawar provided, except I added the scale as "optional"... but if you take that out it should do what jorawar's SWF does?
ActionScript Code:
stop();
var toggleScreen:Boolean = false;
yourMC_btn.onRelease = function():Void {
if (toggleScreen) {
fscommand('fullscreen', false);
toggleScreen = false;
} else {
fscommand('fullscreen', true);
toggleScreen = true;
}
};
The second code I provided needs Flash 9, or Flash 8 with one line of code added to the Stage Class file that comes with Flash. I do not have CS3 either to open jorwar's FLA, however in looking at the outcome of the SWF, the code I provided does the same (atleast for me).
Sorry, tried to help.
|
i use macromedia flash 8.0, + actionscript 2.0
doesnt matter  any help is welcome :P
|
|
|
07-16-2008, 07:13 AM
|
#9
|
|
Registered User
Join Date: Jul 2008
Posts: 13
|
still havent got a workin one
|
|
|
07-16-2008, 02:54 PM
|
#10
|
|
Senior Member
Join Date: Apr 2007
Posts: 4,772
|
Quote:
Originally Posted by 3747
still havent got a workin one
|
* If your trying to test in the Flash IDE it will NOT work from within there, it will NOT work in a browser window either. You need to directly launch the SWF or projector file to see it in action. (atleast to the best of my knowledge)
Otherwise, I am really confused as to why its not working for you? For me the result looks identical to jorawar's example swf. Are you making a button, giving it an instance name of yourMC_btn , then placing the code I provided on an actions layer on the main timeline (not on the movieclip itself)? Should work fine, does for me.

Here is another simple code also...
ActionScript Code:
on (release) {
if (fullscreen = !fullscreen){
fscommand("fullscreen", "true");
}else{
fscommand("fullscreen", "false");
}
}
*But any of the codes posted will work when used as described above (directly launching the SWF or projector).
|
|
|
| Thread Tools |
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT. The time now is 05:56 AM.
///
|
|