all groups > flash actionscript > august 2007 >
You're in the

flash actionscript

group:

2 action button


2 action button D3rutat
8/31/2007 5:27:30 PM
flash actionscript: Hi guys. I need some help with this code:

if (search.text != "" )
{
on (release, keyPress "<Enter>")
{
getURL("http://google.com/search", "_blank", "GET");
search.text = "";
search.setFocus(null);
}

}
else getURL("http://www.google.com");

I have a text input and i want the search button to act in two different ways.
I want it to search the string on google, and i want to open a
webpage(google.com for example) if the text input is empty (kinda like a
home/search button combo)
Currently i get an error saying Statement must appear within on handler
Source: if(search.text != "")

What's the correct code?

Thanks in advance :)
Re: 2 action button kglad
8/31/2007 6:23:42 PM
try:



on (release, keyPress "<Enter>")
{
if (search.text != "" )
{
getURL("http://google.com/search", "_blank", "GET");
search.text = "";
search.setFocus(null);
} else {
getURL("http://www.google.com");
}
}
Re: 2 action button D3rutat
8/31/2007 6:28:06 PM
Re: 2 action button kglad
8/31/2007 6:37:18 PM
AddThis Social Bookmark Button