Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > Desktop, Mobile and non-browser Environments > Projectors and CDs

Reply
 
Thread Tools Rate Thread Display Modes
Old 07-15-2008, 07:20 AM   #1
3747
Registered User
 
Join Date: Jul 2008
Posts: 13
Default 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.
3747 is offline   Reply With Quote
Old 07-15-2008, 07:31 AM   #2
3747
Registered User
 
Join Date: Jul 2008
Posts: 13
Default

i hope its ok if i reserve this 1 for when the answer is found, i can post it.
3747 is offline   Reply With Quote
Old 07-15-2008, 08:06 AM   #3
jorawar
Senior Member
 
Join Date: Feb 2007
Posts: 173
Default

i hope this will helps you....
Attached Files
File Type: zip Desktop.zip (4.9 KB, 126 views)
jorawar is offline   Reply With Quote
Old 07-15-2008, 03:25 PM   #4
3747
Registered User
 
Join Date: Jul 2008
Posts: 13
Default

Quote:
Originally Posted by jorawar View Post
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
3747 is offline   Reply With Quote
Old 07-15-2008, 04:13 PM   #5
asf8
Senior Member
 
Join Date: Apr 2007
Posts: 4,772
Default

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(); };
asf8 is offline   Reply With Quote
Old 07-15-2008, 06:51 PM   #6
3747
Registered User
 
Join Date: Jul 2008
Posts: 13
Default

Quote:
Originally Posted by asf8 View Post
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 :$
3747 is offline   Reply With Quote
Old 07-15-2008, 08:51 PM   #7
asf8
Senior Member
 
Join Date: Apr 2007
Posts: 4,772
Default

Quote:
Originally Posted by 3747 View Post
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.
asf8 is offline   Reply With Quote
Old 07-15-2008, 10:21 PM   #8
3747
Registered User
 
Join Date: Jul 2008
Posts: 13
Default

Quote:
Originally Posted by asf8 View Post
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
3747 is offline   Reply With Quote
Old 07-16-2008, 07:13 AM   #9
3747
Registered User
 
Join Date: Jul 2008
Posts: 13
Default

still havent got a workin one
3747 is offline   Reply With Quote
Old 07-16-2008, 02:54 PM   #10
asf8
Senior Member
 
Join Date: Apr 2007
Posts: 4,772
Default

Quote:
Originally Posted by 3747 View Post
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).
asf8 is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
music on/off button within a movie clip? djlukasz ActionScript 1.0 (and below) 4 06-14-2007 06:03 PM
Button does not call ActionScript!!!! Zath Other Flash General Questions 1 01-19-2006 03:39 PM
I need some help about a on/off music button!!! lilp ActionScript 1.0 (and below) 3 11-08-2004 01:32 PM
on/off music button red-eye ActionScript 1.0 (and below) 2 03-01-2003 06:17 PM
on/off music button red-eye Simple Stuff (Newbies) 1 02-28-2003 06:10 AM


All times are GMT. The time now is 11:56 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.