I’m trying to get a key (in this case the Enter key) to run a function already assigned to a button. What I’m trying to achieve here is to get both methods to do the same task either you press the button in the movieclip with the mouse or you press Enter.
Here is the code for the button:
search_fields.search_btn.onRelease = function(){
if (search_fields.query_txt.text.length < 3){
results_txt.text = "Please use a search term with 3 or more characters.";
return (0);
}
var searchElements = ElementsToSearch();
var nodesWithQuery = SearchXML(
posts_xml.firstChild.childNodes,
search_fields.query_txt.text,
searchElements
);
if (nodesWithQuery.length){
DisplayNodes(
nodesWithQuery,
results_txt
);
}else{
results_txt.text = "No results for "+search_fields.query_txt.text+".";
return (0);
}
HighlightOccurences(
search_fields.query_txt.text,
results_txt,
search_highlight
);
scrollbar.setScroll(0);
}
´
Now, how do I get the Enter key to do the same when pressed?
Help? Anyone? Pretty pleeeeeeeeeeeeeeeeeeeeeeease!!!
Thanks!!!