Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




On KeyPress Enter....



Hey guys,
I cannot figure out the scripting for a search form. I want it to continue to go to the search.asp page on key command of Enter. Here is my actionscript thus far...


searchURL = 'search.asp';
searchMETHOD = 'get';
bgColor = "0x"+backgroundColor;
fgColor = "0x"+forgroundColor;
fgColorOver = "0x"+forgroundColorOver;
fgColorPress = "0x"+forgroundColorPress;
dsearch = defaultSearchTerm;

//test variables
/*
bgColor = "0x"+"3399aa";
fgColor = "0x"+"aa00ff";
fgColorOver = "0x"+"255234";
fgColorPress = "0x"+"989898";
dsearch = "Find Something";
*/
//Set the background color
var allBGcolor = new Color("_root.allBG");
allBGcolor.setRGB(bgColor);
//Set the button color
var searchButtonColor = new Color("_root.searchButton");

searchButtonColor.setRGB(fgColor);
//Set inital search String
searchString.text = dsearch;
//Set the font color
searchStringStyle = new TextFormat();
searchStringStyle.color = fgColor;
//mytext.setTextFormat(myformat);
searchString.setTextFormat(searchStringStyle);
//set functionality for button colors
searchButton.onRollOut = function() {
searchButtonColor.setRGB(fgColor);
};
searchButton.onRollOver = function() {
searchButtonColor.setRGB(fgColorOver);
};

searchButton.onPress = function() {
searchButtonColor.setRGB(fgColorPress);
};


searchButton.onRelease = function() {
//searchStringText
searchButtonColor.setRGB(fgColorOver);
if (searchStringText != "") {
getURL(searchURL+"?mode=allwords&search="+searchSt ringText,"_self","get");
}
};

searchString.onSetFocus = function(){
searchString.text = "";
searchStringtext.setRGB(fgColor);
};
stop();



ActionScript.org Forums > ActionScript Forums Group > ActionScript 1.0 (and below)
Posted on: 04-03-2007, 05:54 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

KeyPress <enter>
Hi,
i have 2 input boxes (with btns to put the code on) for 2 different searches and want the enter key to initiate the search in each case eg.

on (release, keyPress "<Enter>") {
//do this
}
how can i distinguish between the 2 searches, so if the user has just written in 1 of the boxes and hits enter that particular search is initiated. Currently if enter is pressed, the first of the searches is always initiated no matter which input box you type in.

any ideas would be appreciated
thanks
robin

On KeyPress Enter...
Hi. Im a flash beginner so excuse me if this is a very obvious and simple problem. I have applied the on keyPress action to the whole of my flash document... 6 scenes worth of info (this is for a flash presentation seminar rather than a website).

The enter key is used to pause and play the presentation. It works fine in flash put not when I publish the movie. Does anyone know why this might be?

Thank you for your help.

You can see the document @ http://www.rebeccapike.co.uk/RecastingSubjectivity but you need to right click and play for the thing to work.

Rebecca

[F8] ENTER Keypress Not Being Captured
I've got a movie that stops until the user hits ENTER. Problem is my movie seems not to be noticing when ENTER is being hit at all. At the point, I'm just trying to get the movie to detect that ENTER has been pressed but to no avail:


PHP Code:




keyListener = new Object();
keyListener.onKeyUp = function() {
    trace("key up! key code is " + Key.getCode());
    }
Key.addListener(keyListener);







This works just fine if I hit any key on the keyboard, but gives me no response at all if I press ENTER - either on the number pad or on the regular keyboard. Does anyone have any suggestions?

KeyPress Not Working For Enter, Backspace, Tab
Hi all,
I'm trying to capture certain keypresses and this is working for any alphabets/numbers that I press, but not for Enter, Backspace, Tab etc. However, if I click the mouse once and then press enter the event is detected. Any idea how I can being to detect enter, backspace without having to click my mouse even once.

I am running the file in the Authoring Environment.

Here's my code

_root.onEnterFrame = function(){
trace(Key.getCode());
}

Any help with this would be greatly appreciated!!!

Thanks,
Diablo

Keypress, Getting ENTER, F1, ESC To Work With My Code
Hey all,

Anyone have an idea how to get keys like ENTER, ESCAPE, F1 and such to work with this code? I have tried the Ascii numbers and F1 for example, but they don't seem to work.


Quote:




// SETUP MENU - TOTAL GAS - NAME NEW TRACE ORDER
keyListener_SETUPTrace_Order_Cust = new Object()
keyListener_SETUPTrace_Order_Cust.onKeyDown = function() {
switch (String.fromCharCode(Key.getAscii())) {
case "k" :// ENTER (OK)
_root.Setup_Trace_Order.gotoAndStop("Menu");
Key.removeListener(keyListener_SETUPTrace_Order_Cu st);
break;
case "n" :// F1 (CANCEL)
_root.Setup_Trace_Order.gotoAndStop("Menu");
Key.removeListener(keyListener_SETUPTrace_Order_Cu st);
break;
case "x" :// X (EXIT)
_root.Setup_Trace_Order.gotoAndStop("Menu")
Key.removeListener(keyListener_SETUPTrace_Order_Cu st);
break;
default :
break;
}
};
Key.addListener(keyListener_SETUPTrace_Order_Cust) ;

Keypress ENTER Wont Work
i have this code and it works fine

Code:
on(keyPress "<Space>"){
if (txtNum == 9){
boxmc.paper.box.text += " ";
}


but if i change it to Enter it wont work

Code:
on (keyPress "<Enter>") {
if (txtNum == 9){
boxmc.paper.box.text += " ";
}
}



can any body help me out

Thanks

[F8] Button Release OR Enter Keypress
I'm making a simplistic flash RPG, and we have included some quiz elements.
When you enter this frame, the focus is in the dynamic text box, the user enters the correct number, and then clicks the "answerBtn".

answerBtn.onRelease = function() {switch case here}

But I want the option to either click the "answerBtn", or simply hit the enter button. I know the enter btn code is something like:
on(release, keyPress "<Enter>") { codegoeshere }

But how do I put this into an OR statement?
Something like:
((answerBtn.onRelease) || (release, keyPress "<Enter>)) { codegoeshere }

(The code it runs is on the same frame, and all actionscript is in one layer.)

Can anyone help me out?
Thanks in advance

How Do I Trap 'enter Keypress' After Certain Presses And Disable Further Typing In Atext Area?
my textarea needs to be restricted to 16 lines no matter what. I have used the change listener and tried getting the number of 'enter' clicks. But how do i lock the textarea such that, the user cannot type anything further, but can edit what all he has written.

I can disable the textarea but this will not allow editing. Can anyone provide me with the thing i need? Hope the idea is clear.


Regards
Roshan

The KeyPress "<Enter>" Doesn't Work On A Button
Hi,

I just exported a movie which has a member section that can only be accessed by putting in a username and password and clicking on "GO" or supposedly pressing "enter". When I went to test it, the mouse release worked fine, but when I tabbed onto the "GO" button and pressed "enter" it wouldn't work (it just didn't do anything). Please see below for a sample of the code which is attached to the "go" button.

on (release, keyPress "<Enter>") {
counter = one+two;
}
on (release, keyPress "<Enter>") {
if (counter eq "blahblahblah") {
gotoAndPlay (21);
} else {
tellTarget ("sorryclip") {
gotoAndPlay ("Sorry Clip", 2);
}
}
}

Now, I tried just (keyPress "<Enter>") without the mouse "release" and that didn't work either.

Can anybody help me?

I'm using Flash 5.

Dan

Replacing On (release, KeyPress "<Enter")
I want to put all my AS in a single actions layer and I want the equivalent of having action on a button

Code:
on (release, keyPress "<Enter>") {
do something
}
Do I need to replace it with two functions

Code:
button.onRelease=function() {
do something
}
and something similar for the keyPress event? If so what's the equivalent for the on(keyPress) please?

SetFocus & KeyPress "<Enter>" Problem
Hi all!
I have made mail form with a few text fields. I have also set order No. when jumping with TAB bttn between text fields:

name.tabIndex = 1;
email.tabIndex = 2;
comment.tabIndex = 3;
sendButton.tabIndex = 4;

I have also attached some action to my "sendButton". It starts with:

on(release, keyPress "<Enter>") {
...

My problem is this:
Whenever I press "ENTER" it submits the form! And I would like to allow visitors to use "ENTER" key to move down in "comment" field and submit the form with "ENTER" only when they set focus on "sendBttn" with TAB.
How to do that?

Thanx!

KeyPress "<Enter>" Doesn't Work?
I am trying to get the enter button to skip to anotehr frame by clicking on it, but for some reason it doesn't work, is this a glitch with flash?

ie.

on (keyPress "<Enter>") {
gotoAndStop("50");
}

[how?] Component Button "Enter" Keypress
How do I get a component button to respond on keypress "<Enter>"

This is the code I have now:


ActionScript Code:
on (release, keyPress "<Enter>") {


And it's not working, but I can click the button and the code executes perfectly.

Help?

On(keyPress "<enter>") Not Working
I used the following code on a button on my stage and it seems to not be working what am missing?


Code:
on (keyPress "<enter>"){
call a function here();
}
Is there another way to acomplish what I'm looking to do here?

[F5] On (release, KeyPress "<Enter>") {
I have a login on my game called Community World, but there is something wrong with it. Yet I can't figure out what!

Here is the code (passwords blocked out):

on (release, keyPress "<Enter>") {
if (username eq "petra036") {
;
}
if (password eq "-----") {
if (code eq "A1GP") {
gotoAndStop ("petra036");
} else if (username eq "chicken036") {
if (password eq "-----") {
if (code eq "A1GP") {
gotoAndStop ("chicken036");
} else if (username eq "surfer_girl13") {
if (password eq "-----") {
if (code eq "A1GP") {
gotoAndStop ("surfer_girl13");
}
}
}
}
}
}
}

Usually it can login to mine (petra036) and chicken036's account, but now the only one that will login is mine. Not chicken036s', and not surfer_girl13s', even though the spelling of everything is correct.

Any help?

(P.S I ALSO HAVE A "CODE" BOX)

On(release, KeyPress "<Enter>" )
I'm trying to get a button with a text input field to go to a specific frame. The text input field is inside the button (it doesn't matter what is input by the user, I just need it to go to a certain frame when they hit enter). I'm a noob at code, but I understand a little. What is the best way to get a text input field to go to a specific frame using keyPress enter?

Thank you so much in advance

On(release, KeyPress "<Enter>" ) [CS3]
I'm trying to get a button with a text input field to go to a specific frame. The text input field is inside the button (it doesn't matter what is input by the user, I just need it to go to a certain frame when they hit enter). I'm a noob at code, but I understand a little. What is the best way to get a text input field to go to a specific frame using keyPress enter? AS2 doc

Thank you so much in advance

On(release, KeyPress "<Enter>"){
I have 2 input feilds and 1 button in a MC.

when user fills the input fields and clicks Enter Key, i want it to work.
How? I read through many of the message board, but can't find an answer for a regualar button.

also, if you know how to make the feilds non case sensitive, that would help too.

here's the code I have so far:
on(release, keyPress "<Enter>"){
//See if at least the comment form has been filled
if (this.sUserID=="" || this.sUserID==null || this.sPassword=="" || this.sPassword==null){
this.UserID_inst.text="";
this.Password_inst.text="";
this.alert_inst.text="Please enter User ID & Password"
return;
}
if (this.sUserID=="fsptraining" && sPassword=="fspsupplier"){
this._visible=false
_root.Applications_MC_AC._visible=true
return;
}
// Post the Variables
if (this.sUserID != "fsptraining" || sPassword != "fspsupplier"){
this.UserID_inst.text="";
this.Password_inst.text="";
this.alert_inst.text="Incorrect User ID or Password";
return;
}

}

On(release, KeyPress "<Enter>")
Here is my problem,,,,,, I got 2 layers , one has a button and a text box and the second (called movie) has a keyframe in 10 and 20. the button has the code below and it works fine when i put some text in frame 10 and 20 of "movie" layer. the problem is that i want to put a Loader in frame 10 and 20 of the movie layer but when i do the "Enter" key does not work any more. If i click on the button with the mouse it works fine but ckicking Enter with a loader anywhere in the movie breaks the keyPress "<Enter>" function. anyone have any ideas??????

on(release, keyPress "<Enter>") {
if (usr == "rooster" || usr == "10") {
gotoAndStop(10);
usr="";
} else if (usr == "hen" || usr == "20") {
gotoAndStop(20);
usr="";
} else {
gotoAndStop(1);
usr="";
}
}

On(release, KeyPress "<Enter>")
Here is my problem,,,,,, I got 2 layers , one has a button and a text box and the second (called movie) has a keyframe in 10 and 20. the button has the code below and it works fine when i put some text in frame 10 and 20 of "movie" layer. the problem is that i want to put a Loader in frame 10 and 20 of the movie layer but when i do the "Enter" key does not work any more. If i click on the button with the mouse it works fine but ckicking Enter with a loader anywhere in the movie breaks the keyPress "<Enter>" function. anyone have any ideas??????

on(release, keyPress "<Enter>") {
if (usr == "rooster" || usr == "10") {
gotoAndStop(10);
usr="";
} else if (usr == "hen" || usr == "20") {
gotoAndStop(20);
usr="";
} else {
gotoAndStop(1);
usr="";
}
}

On(release, KeyPress "<Enter>" )
I'm trying to get a button with a text input field to go to a specific frame. The text input field is inside the button (it doesn't matter what is input by the user, I just need it to go to a certain frame when they hit enter). I'm a noob at code, but I understand a little. What is the best way to get a text input field to go to a specific frame using keyPress enter?

Thank you so much in advance

On (keyPress "<Enter>")
I am building/modifer a mail form (php, still...)
everything works great, but I am just wondering is there a way I can set it when the user hits "enter" it'll be the same as hit the "send" button?

I have tried to follow code, Ive put it in the 1st frame of my mail form movie, but the Output says "Mouse events are permitted only for button instances on (keyPress "<Enter>") {" Is there any ways to do it correctly?

Here is my code:


on (keyPress "<Enter>") {
if (!Email.length || Email.indexOf("@") == -1 || Email.indexOf(".") == -1) {
EmailStatus = "Please enter a valid E-mail address";
}

else if (!Name.length) {
EmailStatus = "Please enter your name";
}

else if (!Company.length) {
EmailStatus = "Please enter your company name";
}

else if (!Comment.length) {
EmailStatus = "Please enter some comments";
}

else {
loadVariablesNum ("snowMailPHP.php", "0", "Post");
EmailStatus = "Please wait while it is sending...";

}
Name=""
Email=""
Phone=""
Company=""
Comment=""
}



Thanks!

KeyPress "<Enter>" Bug?
I have a file which has multiple forms in it. On the forms I have set the tabIndex and the submit buttons so that the forms work much as they would in a web page. One of my buttons mysteriously stopped working on the keyPress.

I have attempted completly deleting and recreating the button, and I have checked all objects available in the frame to verify that nothing else is attempting to capture the enter key. The code I have on the button is below.

Any help or suggestions would be appreciated.

on(press,keyPress "<Enter>") {
if (MemberName.length > 0 && Password.length > 2) {
_root.ActivateAccessing();
SendVars = "AttemptLogin=1&LoginLoaded=1";
SendVars += "&MemberName=" + MemberName;
SendVars += "&Password=" + Password;
loadVariables("login.php?" + SendVars, VariableLoader);
} else {
Selection.setFocus("Errors");
_root.FormError = "<b>Error: </b>";
if (MemberName.length < 1) {
_root.FormError += "Member Name cannot be blank!
";
}
if (Password.length < 3) {
_root.FormError += "Password must be at least 3 characters.";
}
}
}

The button works on press, but nothing happens when I press the enter key. I have verified that the code on the button is not being hit at all on keypress.

Thanks
-Dalberon

On (keyPress "<Enter>") In Two Mc's
I have two different movie clips that have a google search and an address bar in them. I have two different buttons that when pressed, either search google or go to the designated website. On both of them, I have on (release, keyPress "<Enter>") to do the action, but the keypress part is getting messed up

is there anyway that flash can detect which one I'm telling to search? Like which one I typed something in and then just do that one, not the other. If anyone doesn't understand I'll try and explain better

On (keypress <"Enter">{
hi!

i am doing an application where only the keyboard should be used. it all works fine with the direction buttons on the keyboard (left, right, up, down) but when i want to enable the enter button it doesn't work. i want the movie to jump to a specific frame or play a specific mc when the enter button is clicked. the code on one button is ie:

[code]
on(keyPress "<Left>"){
gotoAndStop(10);
}

on(keyPress "<Down>"){
gotoAndStop(3);
}

on(keyPress "<Enter>"){
_root.mc_test.gotoAndStop(2);
}

it works fine to got left and right but when i press the enter button it always jumps to the next frame of the main timeline and doesn't recognise what i want it to do.

any suggestions?

thanks

netchen

On(keyPress "<Enter>"){
hi!

i am doing an application where only the keyboard should be used. it all works fine with the direction buttons on the keyboard (left, right, up, down) but when i want to enable the enter button it doesn't work. i want the movie to jump to a specific frame or play a specific mc when the enter button is clicked. the code on one button is ie:

CODE     on(keyPress "<Left>"){
      gotoAndStop(10);
     }

     on(keyPress "<Down>"){
      gotoAndStop(3);
     }

     on(keyPress "<Enter>"){
      _root.mc_test.gotoAndStop(2);
     }

Text Fades With Enter But Not With CTRL-Enter
I have followed steps I've found in tutorials, but my TEXT does not fade when I run the web-page version (CTRL-Enter) even though it does fade when I just hit Enter inside Flash. (I have converted the text to Symbol -- both graphic and movie clip)

Images fade fine in both.

Is this something simple I'm blind to?

Ctrl+Enter Instead Of Enter In TextArea
Hi,

I'm creating a Flash instant messaging application (through XMPP protocol) and run into a problem. It isn't that important but I was quite upset that I wasn't able to solve it and I want to know if their is a solution =D

I have a TextArea chat input and a button to send the text, the TextArea is multiline and so captures the Enter key to jump one line... What I need is to send the message with the Enter key and jump with a Ctrl+Enter combination... My ideas were to disable the bubbling of the Enter key, trap it, and then manually assign the Ctrl+Enter combination to jumping the line in TextArea but couldn't find how to do all this...

I have to programm this application in AS2 but will be glad if you have an AS3 solution as well (to use later, learn and help others reading this thread

thnx,
Philip Seyfi, fs-studio.eu

Why Won't Key.ENTER Not Detect The Enter Key?
the subject says it all really... how do you detect the <enter> key with clip events? The ASCII code for Enter is 13 and i've tried it using key.getCode and Key.ENTER, both unsuccessful. I'm using a laptop (not that it should make a difference right?).

Does anyone know?

Keypress F5, F6, Etc
How can I get the keypress event of F5, F6, etc... I know I can't do it directly with flash, but maybe Javascript... kinda lost here...

On KeyPress Help
Anyone know how I can have Flash recognize the user pressing the F4 key for the on keyPress event?

Keypress
I'm making a personal "babybanger" game for my son, to teach him the meaning of letters, numbers and shapes...here goes:

I have movies (A-B) with each 4 frames containing different pictures which start with the current letter i.e B = Ball or Baby....., each frame has a stop action.

In my main scene I have a button with this script:


on (keyPress "b") {
_root.b.swapDepths(1);
tellTarget ("b") {
play();
}
}

So when he hits the "b" key it will play the next frame of the B movie.

The problem being that the B movie keeps playing through all the frames as long as he holds down the key, I just want it to play one frame every time he hits the "b" key.....I could really use an action with :
on (keyRelease "b") instead but can't seem to find out how.

KeyPress Help Please
I am creating a piano swf and upion the press of a key I want the button the the piano look like it is in its down state. I have placed the movieclip and given it the instance name "KeyPress1" on the stage the gave it an alpha value of "0" and then placed the following script on it.

on(keyPress "q") {
KeyPress1._alpha = 100
}

And that works except that when I release he key "q" I want the movieclip instance to change back to a "0" value and therefore not be visible and furthermore I want to make sure that while the key "q" is being pressed that the alpha value stays at "100"

How can I accomplish this? Somebody please help

Thanks in advance,
Josu

Keypress
how do i detect keypress of numbers like 3. I want to put on a frame with a stop action , a movie clip turns invisible, and a action where when you press 3, that movie clip turns visible again.
thanks.

On Keypress....
Hi all, I'm new at the flashkit-forums.

I've surfed around flashkit a lot to have a look at some sources and I learned a lot of them.

I'm certainly not a flash-expert, I'm just in a learning fase. I think it is a great programming language for web applications.

I made my first game (well actually my second, but the first one isn't really worth mentionning), and I have a little problem with it. I added it to the movies--> games -section of flashkit (although it didn't get approved yet (how long does that take normally?)).

It's a typing test game I made just to get a bit the hang of actionscripting. It tracks wich key is pressed and if it is the same key as the letter apearing on the screen then the score goes up.

No some people told me that a good adition would be that the score goes down when someone presses a wrong key. I just don't see how to implement that.

Here is how I made it: I have 26 frames and in each frame there's a letter I converted to a button. That button tracks if the key is pressed of the letter wich appears on the screen. If randomly goes to another frame (with another letter)... There's a timer included wich ends the game after 30 seconds.

Here is the code I used for tracking the key:


Code:
on (keyPress "a"){
_root.score++;
gotoAndPlay(random(26)+2);
}
I tried adding the following to let the score goes down when a wrong button is pressed but it doesn't work off course:


Code:
on (keyPress !"a"){
_root.score++;
}
Anybody has any idea on how I can implement such thing?

Thanks in advance,

greets Rob

(I attached the source-code of my game)

Keypress Help
Ok im doing a project that it set up like a video game, and want to make it two players... I have all the coding for the question generator done, but how can i go about using key strokes for contestants to "buzz in" on my game? And to also keep a tally of thier score.

Thanks any help would be appreciated!

KeyPress
I would like that this function would also be executed when i press a Key, how can i do this?

Thanks for any help.

JGraca

a1.onPress = function() {
mov1(a1, 1);
gotoAndPlay(17);
};

Keypress
can someone help me with this, just tell me what to put inside the condition

if ('Alt + Shift is pressed'){
...
}

thanks

MaX_BoY

On KeyPress In An Exe?
I'm trying to have an invisible button in a flash projecter take you back to a scene on keyPress.....its not working....does it not work in an exe?

also, is it possible to use the F1 key?

any help appreciated...

Keypress Help
Here is what I want,

I want my movie to play till the end, then stop. After it stops, I want to be able to press enter, which, in turn, would send it to the next scene. I tried the following, but to no avail. Any help would be GREATLY appreciated.

--------------
stop();
on (keyPress "<Enter>") {
gotoAndPlay(Slide2, frame 1);
}

--------------

Slide2 = Scene 2

Also, I did name my frame instance on Scene 2 "frame 1". So that is not the problem. Thanks in advance

On Keypress Help
what is the code word for if they keypress one of the numbers at the top of the keyboard.

Thanks

On (keypress)
Hello,

I have tried to implement on (keypress) and it just has not worked I have a button on the main timeline with the following code...

code:
on (release, keyPress "<Enter>") {
resultSet = "Loading...";
loadVariablesNum(varPath + "/asp/stu_login.asp", 0, "POST");

}
on (release, keyPress "<Enter>") {
gotoAndPlay(148);
}


When I go to test it pressing the enter key does not advance the movie.

Keypress Help
Ok, does anyone know why this doesn't work?:


Code:
_root.currentwep = "Handgun";

//make weapons changeable
if (Key.isDown(Key.SPACE)){
_root.currentwep = "Shotgun";
}


I don't understand why it wont work when in previous games ive made it has worked. Anyway, thx.

On(keypress...
Is it possible to use other then the predefined keys for this command? For instance Command I. If not is there a work around?

Thanks in advance for any help

Keypress Help
hey, i know that you can use the keypress with up,down,left,right and some other buttons,
but what is the script for normal letters, e.g. a, s, d, w

any help would be good, thanks

jason

Keypress
could anyone help me, basicaly im using this script to make a car go forward when you press the UP button.

onClipEvent (enterFrame) {
if (Key.isDown(Key.UP)) {
speed += 1;
}

the problem is that i would like to change it so that you press the W button instead.

can anyone help

jaosn

KeyPress
I have this code on a button in a project:

on (rollOver) {
containerA.unloadMovie();
}
on (release, keyPress "<Right>") {
trace("The Right Arrow key was pressed");
clearInterval(timer);
goToAndPlay("81start");
containerA.attachMovie("PlayStatSymbol", "PlayStatSymbolA",1);
script50.stop("50.mp3");
}

The "keyPress" part does not work. So I took this code and put it into small file (attached) and it works fine. Any idea why it won't work in my other file?

KeyPress
What is wrong with this keyPress command?

Code:
def.onEnterFrame = function(){
x4 = this._x
y4 = this._y
y5 = y4
x5 = x4
x5 += 46
y5 += 40
y4 -= 40
if ((((guy._x > x4) && (((guy._y > y4)) && ((guy._x < x5))) && (guy._y < y5)))) {
if (keyPress "1") {
def.play();
}
}
};

dont mind the part in bold its a substitute for a hitTest command.

On Keypress...
Hi,
I tried to make a page with a very little flash movie, height=1 width=1
I wanted to make it possible to press a key on a page and there will be an other page loaded. So people will be be quicker on browser through the website.

But it doesn't work, because you have to select the movie first (almost impossible when the movie is 1 by 1 px) before you can press a key. Is there a way to avoid this? I really don't want to make a movie wich you first have to select before you can use the shortkeys



the page is located here:
http://bcounter2.techroll.nl/

The flash movie will only appear when you are logged on:
username: Kaffa
password: qwerty
its located under the image with the text "jouw profiel" above it.

on the button in the movie I have:

Code:
on (keyPress "b"){
getURL("index.php?p=bewerk_profiel", "_parent")
}
on (keyPress "p"){
getURL("index.php?user=" + user, "_parent")
}
on (keyPress "u"){
getURL("index.php?p=upgrade_profiel", "_parent")
}
on (keyPress "c"){
getURL("index.php?p=casino", "_parent")
}
on (keyPress "s"){
getURL("__________allpages/shoutbox/_shoutbox_add.php?user=" + user, "shoutbox")
}
on (keyPress "r"){
getURL("JavaScript:radio_stream(220,305)")
}
on (keyPress "l"){
getURL("index.php?action=log-out&redirect=1", "_parent")
}

Copyright © 2005-08 www.BigResource.com, All rights reserved