-
fixing the ESC button
i'm using very simple code such as :
Quote:
on(keyPress "<Escape>"){
_root.prevFrame(); // go back to menu
}
so that when i press escape the flash file goes to the menu.
this code works fine when i test it within flash(8).
however i am also using:
Quote:
fscommand ("fullscreen", "true");
fscommand ("allowscale", "true");
to make my program full screen.
the problem is when i press escape, the flash file escapes out of full screen mode and shows its window rather than run the code i typed in.
how can i fix this so that pressing escape will keep the game in fullscreen but also run the code to go to menu frame??
-
Script kiddie
Maybe the trapallkeys function/fscommand/whatever might help?
-
does anyone else know what the problem is related to or how it could be fixed? i'm sorry but the above answer doesnt help...
-
Hey Timmy!!!
Have tried using keyListeners. I know that there sometimes useful.
code: var keyListener:Object = new Object();
keyListener.onKeyDown = function() {
if (Key.isDown(Key.ESCAPE)) {
your action()
}
};
Key.addListener(keyListener);
-
i've used the code you have suggested because i already was using keylistener.
the weird thing is that it works fine when testing it in flash 8 but the swf file doesnt work - it still exits fullscreen mode rather than switching back to menu.
anyone know why it would work in flash but not in the final swf???
-
Senior Member
Well, are you just double-clicking the SWF to run it? That's not how people will be viewing this when you're done. Will you be showing it via a web page or by an EXE?
-
it'll be a standalone exe on cd.
-
Hype over content...
You tried
fscommand("trapallkeys","true");
( As VENGEANCE mentioned ) ?
Also I always thought alt-f4 was used to quit out of full-screen projector files. Does the same thing happen when testing it as an exe rather than just a full-screen swf ?
Squize.
-
Senior Member
Esc quits the EXE player.
-
sorry guys we might have got our wires crossed -
the esc button doesnt quit the player but instead it comes out of fullscreen mode - which is not what i want to do.
i have used code to make the screen fullscreen, and i have used code so when i press esc it goes to the menu.
however pressing escape in fullscreen mode simply exits fullscreen. HOWEVER the code works fine when testing in flash but not when using a swf or exe....
-
anybody any ideas on the above?
-
n00b
For the third time, have you tried "trapallkeys"?
Did a quick test, this works for me(it dosen´t exit fullscreen when running as standalone).
Code:
fscommand("fullscreen",true);
fscommand("trapallkeys",true);
// test var
var count:Number = 0;
var keyListener:Object = new Object();
keyListener.onKeyDown = function() {
if (Key.isDown(Key.ESCAPE)) {
++count;
}
};
Key.addListener(keyListener);
But maybe I´m missing something here...?
-
ill try that - but i was still wondering why does the original code work within flash but not outside of it?
-
Senior Member
Originally Posted by rrrrr_rav
ill try that - but i was still wondering why does the original code work within flash but not outside of it?
Alot of things are different when tested within Flash versus using the external player.
-
well ok thanks for the help, i'm sure it will help me fix the problem.
Alot of things are different when tested within Flash versus using the external player.
that seems a little weird...
-
Script kiddie
I already told you the answer... ¬_¬
fscommand("trapallkeys", "true");
-
Hype over content...
Hopefully he's taken the hint this time
Squize.
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
|