PDA

View Full Version : Google search inside flash



Hackit
04-18-2010, 03:33 PM
Hi all,

Can someone please tell me what I'm doing wrong, I have a google search box inside my flash file and the return value is always ( undefined ).

Here is my code for the button;
---------------------------------------------------
on (release) {
getURL("http://www.google.com/search?q=" + _root.strSearch, "_blank");
trace(_root.strSearch);
}
on(rollOver){
gotoAndPlay("s1");
}
on(releaseOutside, rollOut){
h=1;
}
------------------------------------------------------



here is the code for the search box;
------------------------------------------------------
var fields_descriptions = Array("", Array("t1", "keyword", "- enter Search word -"));


function reset_txt(name, name2, value) {
path = eval(_target);
path[name2] = value;

this[name].onSetFocus = function() {
path = eval(_target);
if (path[name2] == value) {
path[name2] = "";
}
};

this[name].onKillFocus = function() {
path = eval(_target);
if (path[name2] == "") {
path[name2] = value;
}
};
}

for (i=1; i<=fields_descriptions.length; i++) {
reset_txt("t"+i,fields_descriptions[i][1],fields_descriptions[i][2]);
}
-------------------------------------------------------------

Hope someone can help me sort this out.

here is the link to the working site http://www.hackitz.ca

kev

Hackit
04-18-2010, 09:03 PM
Hi again,
I have tried changing my root varibles as this must have been an issue.

ex;
on (release) {
getURL("http://www.google.com/search?q=" + _root.strsearch, "_blank");
trace(_root.strsearch);
}

to on (release) {
getURL("http://www.google.com/search?q=" + _root.keyword, "_blank");
trace(_root.keyword);
}

as keyword is the variable name of my search box. But I still get an undefined search result from google.

I must be missing something very small.:(