View Full Version : Search the site
emiller
08-06-2007, 05:09 PM
So I'm really new to actionscript but not so new to flash.
What I'm trying to do is search my site through a swf file. I have an amazing search script in PHP, but I'm not sure how to link the two. Any suggestions would be greatly appreciated.
EriK
Its pretty easy to link up with the PHP script usingLoadVars class in AS 2.0. Im just getting into the AS 3 way of doing it the URLLoader class.
AS 2:
look up: Using the LoadVars class
in the Flash Help Menu. It tells you how to send and load. You will probably be accessing a function from PHP.
evride
08-07-2007, 08:05 AM
create a button with and instance name of search and an input textbox with a var of search_string (it would be in the properties panel.
search.onRelease = function(){
var search_site:LoadVars = new LoadVars();
search_site.words = search_string;
search_site.onLoad = function(success){
if(success){
trace(search_site.res);
}
}
search_site.sendAndLoad("script.php", search_site, "POST");
search_string = $_POST['words'];
//notice that the posted var was the one attached to search_site loadvar in flash
//now to send vars to flash all you have to do is print
//make sure there is only one print statement
print"&res=Im sending data back to flash. it will be attached to search_site loadvar and have the name i defined here which is res";
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.