Link to home
Start Free TrialLog in
Avatar of Ten90Group
Ten90Group

asked on

On Key Press troubles

I need a function in ActionScript that will allow me to press enter and make an instance of an object visible. This will not be attached to a movie clip or a button instance, as Macromedia seems to require. How do I do this?
Avatar of Dushan Silva
Dushan Silva
Flag of Australia image

on(keyPress "<enter>"){
instance1.visible= true;
}


BR Dushan
Avatar of Ten90Group
Ten90Group

ASKER

That returns the following error upon debugging:


Mouse events are permitted only for button instances on(keyPress "<Enter>"){
Create a button. And put action script on it. Then hide it. (Alpha=0, or Visible=false..)

BR Dushan
This does not work. I hit enter, and nothing happens.
If this would work better for you, may I have your AIM or Yahoo screen name? I need this resolved ASAP for a client. Thanks.
OK, here is my issue now. It seems that this function works for every key EXCEPT enter. I have tried typing <Enter>, <enter>, and <ENTER> and none work. Is there maybe a disabled setting somewhere?
ASKER CERTIFIED SOLUTION
Avatar of oddhours
oddhours

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This does not work, oddhours. It is as if Flash does not like the enter key at all.
This did work for other keys, such as the LEFT key.
you can replace the code:
trace("ENTER key pressed");    

with whatever you like for example:

instanceNameToShow_mc._visible = true;
my messenger ID is same in my profile's email address. But now I'm in home. I will at office after one hour.

BR Dushan
OK, heres the deal.
I tried oddhours' method, and it did not work. I then started searching for settings which would enable the enter key. I found a setting in the Publish Preview window called Disable Keyboard Shortcuts, located under Control. When this option is checked, the Enter key works. Only problem is now how do I make sure that this setting is included in the Publish settings?
Woo hoo! Problem fixed! Thanks everyone for your help!
Congrats!