Solved

How to Send a 'KEYWORD' from Flash to a PHP search query?

Posted on 2009-07-08
47
325 Views
Last Modified: 2015-01-05
Helllo,
I have a full flash website with a section that loads data in from mySQL/PHP.

It loads the data into flash by default automatically descending by the ID of each entry in the database.

HOWever, i would like to add a search box in flash, where i can enter a 'keyword' in a input text field and send a 'keyword' to search for.

So far I have the Flash stage structured like this..
=================================
input text field == variable name of 'keyword'
button == instance name of 'ButSearch'

--------------------------------------------------------
Now what i need is the ActionScript to send the 'keyword' to the folllowing PHP script....
---------------------------------------------------
i have attached to PHP script that is currently loading the data into flash, as i described above.

------------- What must i add/modify in this PHP script to accept the keyword i am sending from flash ... and then create the search query relevant to the keyword?


Any help is greatly apprecitated!

cheers




<?php

// include the Database classes

require_once('classes/database_php4.php');
 

// escape quotes and apostrophes if magic_quotes_gpc off

if (!get_magic_quotes_gpc()) {

  foreach($_POST as $key=>$value) {

    $temp = addslashes($value);

    $_POST[$key] = $temp;

    }

  }

//

  if ($_POST['action'] == 'loadLatestStories') {

  

//THE CODE I HAVE FOR THE KEYWORD SEARCH ...BUT IS NOT WORKING..

//$kw = trim($_POST['keyword']);

   //$sql = "SELECT * FROM cmsnewsv2 WHERE story_title = '$kw'";

	//echo getStoryList($sql);

 // }

	
 

  // code for retrieving full list

  $sql = 'SELECT * FROM cmsnewsv2 ORDER BY story_ID desc LIMIT 0,100';

  	echo getStoryList($sql);

  }
 

// get list of stories

function getStoryList($sql) {

$db = new Database('XXXXXXXXXXXXt',XXXXXXXXXX','XXXXXXXXX','XXXXXXXXXXX');

  $result = $db->query($sql);

  $numrows = $result->num_rows;

  $storylist = "total=$numrows";

    $counter = 0;

  while ($row = $result->fetch_assoc()) {

  	//$row['story_date'] = date('l jS');

    $storylist .= '&story_ID'.$counter.'='.$row['story_ID'];

    $storylist .= '&story_title'.$counter.'='.urlencode($row['story_title']);

    $storylist .= '&story_body'.$counter.'='.urlencode($row['story_body']);

	

	$storylist .= '&story_details'.$counter.'='.urlencode($row['story_details']);

    $storylist .= '&story_postedby'.$counter.'='.urlencode($row['story_postedby']);

    $storylist .= '&story_photo'.$counter.'='.urlencode($row['story_photo']);

    $storylist .= '&story_date'.$counter.'='.urlencode($row['story_date']);

    $storylist .= '&story_link'.$counter.'='.urlencode($row['story_link']);

	$storylist .= '&story_price'.$counter.'='.urlencode($row['story_price']);

	$storylist .= '&story_specs'.$counter.'='.urlencode($row['story_specs']);

	$storylist .= '&story_specs2'.$counter.'='.urlencode($row['story_specs2']);

	$storylist .= '&story_city'.$counter.'='.urlencode($row['story_city']);

	$storylist .= '&story_highway'.$counter.'='.urlencode($row['story_highway']);

	

    $counter++;

    }

  $db->close();

  return $storylist;

}

?>

Open in new window

0
Comment
Question by:sam928
  • 24
  • 15
  • 8
47 Comments
 
LVL 39

Expert Comment

by:blue-genie
Comment Utility
since you're using variables in textfields you must be using AS2.
 so use LoadVars

here's some examples from sephiroth

http://www.sephiroth.it/tutorials/flashPHP/loadVars/
0
 
LVL 1

Expert Comment

by:Intersel
Comment Utility
Hello,

Have you try to test the php code, calling it directly from your internet browser ?
ps: by using the $_GET array instead of $_POST in your code, you can call it directly like
myphpcode.php?action=loadLatestStories&keyword=test

What are the errors displayed?

0
 

Author Comment

by:sam928
Comment Utility
Hello,

@Blue-genie... yes i am using as2, sorry for not disclosing that.

... i was using this actionscript to send the keyword.. but i dont know if it is working?

----------------------------------------------------------------------------------
on (release) {
   myData = new LoadVars();
   myData.keyword = keyword.text;

   myData.sendAndLoad("topstory.php", myData, 'POST');
}
--------------------------------------------------------------------------------------


=== I guess it should be working becuase it is the same basic code for a simple contact form... SO, now what i need is to figure out how to build this into the PHP search query.

Below in the snippent (the first segement commented out)  is the PHP code that I thought would make the Search function work ,, But it doesnt do anything....

The second segment is the default code for retrieving all data...:

// code for retrieving full list
  $sql = 'SELECT * FROM cmsnewsv2 ORDER BY story_ID desc LIMIT 0,100';
        echo getStoryList($sql);
  }

------------------------------------------------------------------------------------------

so what is going wrong with this following code? >>

//THE CODE I HAVE FOR THE KEYWORD SEARCH ...BUT IS NOT WORKING..
$kw = trim($_POST['keyword']);
   $sql = "SELECT * FROM cmsnewsv2 WHERE story_title = '$kw'";
        echo getStoryList($sql);
  }

========================================================================
@Intersel ... the entire code used with my file is using 'POST'.. so it would be hell changing all of it... but i have tried it with just the AS code for sending the keyword.. and tested it in the browser with the string you mentioned and it was just blank, (inside of the browser ,, not text, just white screen)



//THE CODE I HAVE FOR THE KEYWORD SEARCH ...BUT IS NOT WORKING..

//$kw = trim($_POST['keyword']);

   //$sql = "SELECT * FROM cmsnewsv2 WHERE story_title = '$kw'";

        //echo getStoryList($sql);

 // }

        

 

  // code for retrieving full list

  $sql = 'SELECT * FROM cmsnewsv2 ORDER BY story_ID desc LIMIT 0,100';

        echo getStoryList($sql);

  }

Open in new window

0
 
LVL 1

Expert Comment

by:Intersel
Comment Utility
Well, as the code sounds correct, the idea is to test the php code without interacting with AS, to know what's wrong with it...
I would suggest to simply do a search&replace on $_POST replaced with $_REQUEST... this way, your code will manage the "post"/"get" variables at the same time...
then you will be able to test your php code sending "get" variables from the url and then see directly if the  code is sending back correct answers or not...
If everything correct, then have a look on the AS calls...

Other thing, your query is perhaps returning nothing...?
a more larger search can be done with the wildcards '%' :
$sql = "SELECT * FROM cmsnewsv2 WHERE story_title = '%$kw%'";
0
 

Author Comment

by:sam928
Comment Utility
@Intersel.

i have replaced all $_POST with $_REQUEST... and then i ran it on the browser.. and it returns this exactly >>
-----------------------------------------
total=0
------------------------------------------
and i also added the wildcards..and the same result in the browser..no matter what keyword i entered in the url.

so if it wasnt connecting to the database then it would give us an error message?


0
 
LVL 1

Expert Comment

by:Intersel
Comment Utility
So everything sounds to run fine... but no data.
Is there something in your DB?
Is story_title containing data to find?
etc...

You can do your testing through phpmyadmin for instance and its SQL Query field.
0
 
LVL 39

Expert Comment

by:blue-genie
Comment Utility
your php is fine
your flash

your textfield has a instance name and a variable name you said it has variable  keyword
you must make the instance name keyword in order to access the .text property in  keyword.text;
0
 

Author Comment

by:sam928
Comment Utility
@  Intersel.. yes, there are 10 entries and all story_title field's contain data..  

When i run the 'default' qeury-------------------------- >>

 $sql = 'SELECT * FROM cmsnewsv2 ORDER BY story_ID desc LIMIT 0,100';
        echo getStoryList($sql);
  }

---------all of the data is loaded into flash..  and there is no problem at all.
but this search query code is returning the Total=0 .

is there another search query we can try to test?  

---------------------------------------------------------------------------------------------

@blue genie..   ok i have added the instance name to the text field > 'keyword'  and the variable name is the same > 'keyword'

and the AS script on the button is:
-------------------------------------------
on (release) {
   myData = new LoadVars();
   myData.keyword = keyword;

   myData.sendAndLoad("topstory.php", myData, 'POST');
}

----------------------------------------
when i test it in flash,, it gives this error message inside of the text field:
_level0.instance1.keyword
---------------------------------------------

what did i do wrong? !!
0
 
LVL 1

Expert Comment

by:Intersel
Comment Utility
could you test your sql query SELECT * FROM cmsnewsv2 WHERE story_title = akeyword
in phpmyadmin and see what results you've got...
0
 

Author Comment

by:sam928
Comment Utility
ok . here may be the problem... so i entered this in the 'Run SQL Query' box..:

SELECT * FROM `cmsnewsv2` WHERE story_title = test
-------------------------------------------------------------------------------------

 And it gave this error message:


     SQL query:  
     SELECT  *
FROM  `cmsnewsv2`
WHERE story_title = test
LIMIT 0 , 30  

     MySQL said:    #1054 - Unknown column 'test' in 'where clause'

----------------------------------------------------------------------------------------
the data i have in a few entries of story_title contain the keyword 'test' and i also tried other words that are within the story_title.
All gave the same error message.

the data is there..so maybe there is some type of function that is not enable in the mySQL that is not allowing a search?




0
 

Author Comment

by:sam928
Comment Utility
I have figured out why mySQL gave the error message of:
    MySQL said:    #1054 - Unknown column 'test' in 'where clause'  
when i typed in :
SELECT * FROM `cmsnewsv2` WHERE story_title = test
-------------------
it was becuase i did not have quotes around the keyyword i wanted to search:
it should be like this:
SELECT * FROM `cmsnewsv2` WHERE story_title = 'test'
------------------------------------------------------------------
I have also modified the PHP script with the help of Ray Paseur from Experts Exchange.
the PHP script now looks like this: (in snippet)
------------------------------------------------------------------
@ blue-genie
so now i am still having problems with the flash side sending the keyword to this PHP script.
can you please tell me what i need to change on the stage and with the AS?
======
i have the text field with the variable name of 'keyword'
and the submit button with AS inside of it:

on (release) {
   myData = new LoadVars();
   myData.keyword = keyword.text;
   myData.sendAndLoad("scripts/topstory.php", myData, 'POST');
}
================================
I am assuming that something is still not right.. what do i have to change to send the 'keyword' to the PHP script as it is?
i'm confused alot!! ;)
 

<?php

// include the Database classes

require_once('classes/database_php4.php');
 

// TRY THIS KIND OF THING TO ESCAPE THE POST DATA

foreach ($_POST as $key => $value)

{

// NEVER REFER TO $_POST AGAIN - WE HAVE A CLEAN ARRAY

   $clean_post[$key] = mysql_real_escape_string(stripslashes($value));

}

 

// TRY THIS FOR THE QUERY

if ($clean_post['action'] == 'loadLatestStories') 

{

// SET UP A MATCH STRING

   $kw  = '%' . $clean_post["keyword"] . '%';

   $sql = "SELECT * FROM cmsnewsv2 WHERE story_title LIKE \"$kw\"";

   echo getStoryList($sql);

}

// get list of stories

function getStoryList($sql) {

$db = new Database('db70xxxx,'dbxxxx','xxxx','xxx');

  $result = $db->query($sql);

  $numrows = $result->num_rows;

  $storylist = "total=$numrows";

    $counter = 0;

  while ($row = $result->fetch_assoc()) {

  	//$row['story_date'] = date('l jS');

    $storylist .= '&story_ID'.$counter.'='.$row['story_ID'];

    $storylist .= '&story_title'.$counter.'='.urlencode($row['story_title']);

    $storylist .= '&story_body'.$counter.'='.urlencode($row['story_body']);

	

	$storylist .= '&story_details'.$counter.'='.urlencode($row['story_details']);

    $storylist .= '&story_postedby'.$counter.'='.urlencode($row['story_postedby']);

    $storylist .= '&story_photo'.$counter.'='.urlencode($row['story_photo']);

    $storylist .= '&story_date'.$counter.'='.urlencode($row['story_date']);

    $storylist .= '&story_link'.$counter.'='.urlencode($row['story_link']);

	$storylist .= '&story_price'.$counter.'='.urlencode($row['story_price']);

	$storylist .= '&story_specs'.$counter.'='.urlencode($row['story_specs']);

	$storylist .= '&story_specs2'.$counter.'='.urlencode($row['story_specs2']);

	$storylist .= '&story_city'.$counter.'='.urlencode($row['story_city']);

	$storylist .= '&story_highway'.$counter.'='.urlencode($row['story_highway']);

	

    $counter++;

    }

  $db->close();

  return $storylist;

}

?>

Open in new window

0
 
LVL 39

Expert Comment

by:blue-genie
Comment Utility
as I said before you can't call the .text property of a textfield if you're using the variable option.
ie. you've put keywork in the variable box in the properties window.

either say

  myData.keyword = keyword; //trace to test

OR
give the textfield an INSTANCE NAME i.e. keyword_txt
then

  myData.keyword = keyword_txt.text;


0
 

Author Comment

by:sam928
Comment Utility
hello blue-genie,, yes thats what i was confused about. i see now..  

But is there a way to test this to see if PHP is receiving the keyword?  
something is not working.. probably the PHP because once i send the keyword from flash it should call the 'topstory.php' script and call the data from mySQL and load it into flash.. Right?

Does the search box movie clip have to be inside of the dynamic text field movie clip that loads the data (on the stage) ?   i dont see why it should.

Or does the revision of the PHP not allow the 'POST' method from Flash?


0
 

Author Comment

by:sam928
Comment Utility
@blue-genie.

attached is all of the actionscript for the dynamic text fields for all the data to load into.

------------
NOTE:  everything works fine when i use the PHP code to load ALL data back into flash.. no problems.. it is just something with this search box/function script.

Please help....!!!    

+++ LINE 5 of the actionscript below is where it requests the 'topstory.php' by default..   Should this not be there???
 because we are letting the other AS from the search box call that PHP?



function loadLatestStories():Void {

	k = 0;

	news_mc.news_mc.loaderr_mc._visible = true;

	dbQuery.action = "loadLatestStories";

	dbQuery.sendAndLoad(_global.phpDir+"topstory.php?ck="+new Date().getTime(),getStoryList);

}

function fullList(success:Boolean):Void {

	if (!success) {

		loadingMsg_txt.text = "Sorry, database unavailable";

	} else {

		processResults(getStoryList);

	}

}

function processResults(theTarget:LoadVars):Void {

	ticker_mc.ticker_mc.ticker_mc.gotoAndPlay(2);

	var total:Number = theTarget.total;

	if (theTarget.error != undefined) {

		loadingMsg_txt.text = theTarget.error;

		theTarget.error = undefined;

	} else if (total == 0) {

		loadingMsg_txt.text = "No records found";

	} else {

		stories.length = 0;

		for (var i:Number = 0; i<total; i++) {

			// create a new object for each database record

			stories[i] = new Object();

			// assign properties to object representing individual record

			stories[i].story_ID = theTarget["story_ID"+i];

			stories[i].story_title = theTarget["story_title"+i];

			stories[i].story_body = theTarget["story_body"+i];

			stories[i].story_city = theTarget["story_city"+i];

			stories[i].story_highway = theTarget["story_highway"+i];

			

			stories[i].story_details = theTarget["story_details"+i];

			stories[i].story_postedby = theTarget["story_postedby"+i];

			stories[i].story_photo = theTarget["story_photo"+i];

			stories[i].story_date = theTarget["story_date"+i];

			stories[i].story_link = theTarget["story_link"+i];

			stories[i].story_price = theTarget["story_price"+i];

			stories[i].story_specs = theTarget["story_specs"+i];

			stories[i].story_specs2 = theTarget["story_specs2"+i];

		}

	}

	getSal();

	populatestorybuttons();

	fadeinbuttonone();

}

//

//

function getSal() {

	sal = stories.length;

	trace("SAL = "+sal);

}

//

//

function populatestorybuttons() {

	if (sal>=(k+1)) {

		news_mc.news_mc.storybutton1_mc._visible = true;

		news_mc.news_mc.storybutton1_mc.button_mc.date_txt.htmlText = stories[0+k].story_date;

		news_mc.news_mc.storybutton1_mc.button_mc.title_txt.htmlText = stories[0+k].story_title;

		news_mc.news_mc.storybutton1_mc.button_mc.price_txt.htmlText = stories[0+k].story_price;

		news_mc.news_mc.storybutton1_mc.button_mc.details_txt.htmlText = stories[0+k].story_details;

		news_mc.news_mc.storybutton1_mc.button_mc.city_txt.htmlText = stories[0+k].story_city;

		news_mc.news_mc.storybutton1_mc.button_mc.highway_txt.htmlText = stories[0+k].story_highway;

		

		news_mc.news_mc.storybutton1_mc.button_mc.picholder_mc.pic_mc.loadMovie(_global.imageDir+stories[0+k].story_photo);

	} else {

		news_mc.news_mc.storybutton1_mc._visible = false;

		news_mc.news_mc.storybutton1_mc.button_mc.readmore_mc.enabled = false;

		//make buttons invisible here

	}

	if (sal>=(k+2)) {

		news_mc.news_mc.storybutton2_mc._visible = true;

		news_mc.news_mc.storybutton2_mc.button_mc.date_txt.htmlText = stories[1+k].story_date;

		news_mc.news_mc.storybutton2_mc.button_mc.title_txt.htmlText = stories[1+k].story_title;

		news_mc.news_mc.storybutton2_mc.button_mc.price_txt.htmlText = stories[1+k].story_price;

		news_mc.news_mc.storybutton2_mc.button_mc.details_txt.htmlText = stories[1+k].story_details;

		news_mc.news_mc.storybutton2_mc.button_mc.city_txt.htmlText = stories[1+k].story_city;

		news_mc.news_mc.storybutton2_mc.button_mc.highway_txt.htmlText = stories[1+k].story_highway;

		

		news_mc.news_mc.storybutton2_mc.button_mc.picholder_mc.pic_mc.loadMovie(_global.imageDir+stories[1+k].story_photo);

	} else {

		news_mc.news_mc.storybutton2_mc._visible = false;

		news_mc.news_mc.storybutton2_mc.button_mc.readmore_mc.enabled = false;

		//make buttons invisible here

	}

	if (sal>=(k+3)) {

		news_mc.news_mc.storybutton3_mc._visible = true;

		news_mc.news_mc.storybutton3_mc.button_mc.date_txt.htmlText = stories[2+k].story_date;

		news_mc.news_mc.storybutton3_mc.button_mc.title_txt.htmlText = stories[2+k].story_title;

		news_mc.news_mc.storybutton3_mc.button_mc.price_txt.htmlText = stories[2+k].story_price;

		news_mc.news_mc.storybutton3_mc.button_mc.details_txt.htmlText = stories[2+k].story_details;

		news_mc.news_mc.storybutton3_mc.button_mc.city_txt.htmlText = stories[2+k].story_city;

		news_mc.news_mc.storybutton3_mc.button_mc.highway_txt.htmlText = stories[2+k].story_highway;

		

		news_mc.news_mc.storybutton3_mc.button_mc.picholder_mc.pic_mc.loadMovie(_global.imageDir+stories[2+k].story_photo);

	} else {

		news_mc.news_mc.storybutton3_mc._visible = false;

		news_mc.news_mc.storybutton3_mc.button_mc.readmore_mc.enabled = false;

		//make buttons invisible here

	}

	if (sal>=(k+4)) {

		news_mc.news_mc.storybutton4_mc._visible = true;

		news_mc.news_mc.storybutton4_mc.button_mc.date_txt.htmlText = stories[3+k].story_date;

		news_mc.news_mc.storybutton4_mc.button_mc.title_txt.htmlText = stories[3+k].story_title;

		news_mc.news_mc.storybutton4_mc.button_mc.price_txt.htmlText = stories[3+k].story_price;

		news_mc.news_mc.storybutton4_mc.button_mc.details_txt.htmlText = stories[3+k].story_details;

		news_mc.news_mc.storybutton4_mc.button_mc.city_txt.htmlText = stories[3+k].story_city;

		news_mc.news_mc.storybutton4_mc.button_mc.highway_txt.htmlText = stories[3+k].story_highway;

		

		news_mc.news_mc.storybutton4_mc.button_mc.picholder_mc.pic_mc.loadMovie(_global.imageDir+stories[3+k].story_photo);

	} else {

		news_mc.news_mc.storybutton4_mc._visible = false;

		news_mc.news_mc.storybutton4_mc.button_mc.readmore_mc.enabled = false;

		//make buttons invisible here

	}

	

	if (sal>=(k+5)) {

		news_mc.news_mc.storybutton5_mc._visible = true;

		news_mc.news_mc.storybutton5_mc.button_mc.date_txt.htmlText = stories[4+k].story_date;

		news_mc.news_mc.storybutton5_mc.button_mc.title_txt.htmlText = stories[4+k].story_title;

		news_mc.news_mc.storybutton5_mc.button_mc.price_txt.htmlText = stories[4+k].story_price;

		news_mc.news_mc.storybutton5_mc.button_mc.details_txt.htmlText = stories[4+k].story_details;

		news_mc.news_mc.storybutton5_mc.button_mc.city_txt.htmlText = stories[4+k].story_city;

		news_mc.news_mc.storybutton5_mc.button_mc.highway_txt.htmlText = stories[4+k].story_highway;

		

		news_mc.news_mc.storybutton5_mc.button_mc.picholder_mc.pic_mc.loadMovie(_global.imageDir+stories[4+k].story_photo);

	} else {

		news_mc.news_mc.storybutton5_mc._visible = false;

		news_mc.news_mc.storybutton5_mc.button_mc.readmore_mc.enabled = false;

		//make buttons invisible here

	}

	

	if (sal>=(k+6)) {

		news_mc.news_mc.storybutton6_mc._visible = true;

		news_mc.news_mc.storybutton6_mc.button_mc.date_txt.htmlText = stories[5+k].story_date;

		news_mc.news_mc.storybutton6_mc.button_mc.title_txt.htmlText = stories[5+k].story_title;

		news_mc.news_mc.storybutton6_mc.button_mc.price_txt.htmlText = stories[5+k].story_price;

		news_mc.news_mc.storybutton6_mc.button_mc.details_txt.htmlText = stories[5+k].story_details;

		news_mc.news_mc.storybutton6_mc.button_mc.city_txt.htmlText = stories[5+k].story_city;

		news_mc.news_mc.storybutton6_mc.button_mc.highway_txt.htmlText = stories[5+k].story_highway;

		

		news_mc.news_mc.storybutton6_mc.button_mc.picholder_mc.pic_mc.loadMovie(_global.imageDir+stories[5+k].story_photo);

	} else {

		news_mc.news_mc.storybutton6_mc._visible = false;

		news_mc.news_mc.storybutton6_mc.button_mc.readmore_mc.enabled = false;

		//make buttons invisible here

	}

	

	if (sal>=(k+7)) {

		news_mc.news_mc.storybutton7_mc._visible = true;

		news_mc.news_mc.storybutton7_mc.button_mc.date_txt.htmlText = stories[6+k].story_date;

		news_mc.news_mc.storybutton7_mc.button_mc.title_txt.htmlText = stories[6+k].story_title;

		news_mc.news_mc.storybutton7_mc.button_mc.price_txt.htmlText = stories[6+k].story_price;

		news_mc.news_mc.storybutton7_mc.button_mc.details_txt.htmlText = stories[6+k].story_details;

		news_mc.news_mc.storybutton7_mc.button_mc.city_txt.htmlText = stories[6+k].story_city;

		news_mc.news_mc.storybutton7_mc.button_mc.highway_txt.htmlText = stories[6+k].story_highway;

		

		news_mc.news_mc.storybutton7_mc.button_mc.picholder_mc.pic_mc.loadMovie(_global.imageDir+stories[6+k].story_photo);

	} else {

		news_mc.news_mc.storybutton7_mc._visible = false;

		news_mc.news_mc.storybutton7_mc.button_mc.readmore_mc.enabled = false;

		//make buttons invisible here

	}

	

	if (sal>=(k+8)) {

		news_mc.news_mc.storybutton8_mc._visible = true;

		news_mc.news_mc.storybutton8_mc.button_mc.date_txt.htmlText = stories[7+k].story_date;

		news_mc.news_mc.storybutton8_mc.button_mc.title_txt.htmlText = stories[7+k].story_title;

		news_mc.news_mc.storybutton8_mc.button_mc.price_txt.htmlText = stories[7+k].story_price;

		news_mc.news_mc.storybutton8_mc.button_mc.details_txt.htmlText = stories[7+k].story_details;

		news_mc.news_mc.storybutton8_mc.button_mc.city_txt.htmlText = stories[7+k].story_city;

		news_mc.news_mc.storybutton8_mc.button_mc.highway_txt.htmlText = stories[7+k].story_highway;

		

		news_mc.news_mc.storybutton8_mc.button_mc.picholder_mc.pic_mc.loadMovie(_global.imageDir+stories[7+k].story_photo);

	} else {

		news_mc.news_mc.storybutton8_mc._visible = false;

		news_mc.news_mc.storybutton8_mc.button_mc.readmore_mc.enabled = false;

		//make buttons invisible here

	}

	

	if (sal>=(k+9)) {

		news_mc.news_mc.storybutton9_mc._visible = true;

		news_mc.news_mc.storybutton9_mc.button_mc.date_txt.htmlText = stories[8+k].story_date;

		news_mc.news_mc.storybutton9_mc.button_mc.title_txt.htmlText = stories[8+k].story_title;

		news_mc.news_mc.storybutton9_mc.button_mc.price_txt.htmlText = stories[8+k].story_price;

		news_mc.news_mc.storybutton9_mc.button_mc.details_txt.htmlText = stories[8+k].story_details;

		news_mc.news_mc.storybutton9_mc.button_mc.city_txt.htmlText = stories[8+k].story_city;

		news_mc.news_mc.storybutton9_mc.button_mc.highway_txt.htmlText = stories[8+k].story_highway;

		

		news_mc.news_mc.storybutton9_mc.button_mc.picholder_mc.pic_mc.loadMovie(_global.imageDir+stories[8+k].story_photo);

	} else {

		news_mc.news_mc.storybutton9_mc._visible = false;

		news_mc.news_mc.storybutton9_mc.button_mc.readmore_mc.enabled = false;

		//make buttons invisible here

	}

	

	if (sal>=(k+10)) {

		news_mc.news_mc.storybutton10_mc._visible = true;

		news_mc.news_mc.storybutton10_mc.button_mc.date_txt.htmlText = stories[9+k].story_date;

		news_mc.news_mc.storybutton10_mc.button_mc.title_txt.htmlText = stories[9+k].story_title;

		news_mc.news_mc.storybutton10_mc.button_mc.price_txt.htmlText = stories[9+k].story_price;

		news_mc.news_mc.storybutton10_mc.button_mc.details_txt.htmlText = stories[9+k].story_details;

		news_mc.news_mc.storybutton10_mc.button_mc.city_txt.htmlText = stories[9+k].story_city;

		news_mc.news_mc.storybutton10_mc.button_mc.highway_txt.htmlText = stories[9+k].story_highway;

		

		news_mc.news_mc.storybutton10_mc.button_mc.picholder_mc.pic_mc.loadMovie(_global.imageDir+stories[9+k].story_photo);

		_global.endnews = false;

	} else {

		news_mc.news_mc.storybutton10_mc._visible = false;

		news_mc.news_mc.storybutton10_mc.button_mc.readmore_mc.enabled = false;

		_global.endnews = true;

		//make buttons invisible here

	}

	if(_global.endnews == true) {

			ticker_mc.ticker_mc.ticker_mc.info_mc.info_txt.text = "Posts "+(k+1)+" - "+ sal +" of "+ sal;

		} else {

			ticker_mc.ticker_mc.ticker_mc.info_mc.info_txt.text = "Posts "+(k+1)+" - "+(k+10)+" of "+ sal;

		}

}

//

_global.endnews = false;

//

//

//

_global.loggedin = false;

//

//

//

//

news_mc.news_mc.info_mc.post_mc._visible = false;

news_mc.news_mc.info_mc.new_mc._visible = false;

news_mc.news_mc.info_mc.logout_mc._visible = false;

news_mc.news_mc.info_mc.delete_mc._visible = false;

news_mc.news_mc.info_mc.update_mc._visible = false;

function loadcontent(storynumber) {

	if (_global.loggedin == true) {

		news_mc.news_mc.main_mc.gotoAndStop(2);

		news_mc.news_mc.main_mc.change_mc._visible = true;

		news_mc.news_mc.info_mc.delete_mc._visible = true;

		news_mc.news_mc.info_mc.update_mc._visible = true;

		_global.storytodeditordel = stories[storynumber+k].story_ID;

		trace("STORY_ID= " + _global.storytodeditordel);

		news_mc.news_mc.main_mc.date_txt.text = stories[storynumber+k].story_date;

		news_mc.news_mc.main_mc.title_txt.text = stories[storynumber+k].story_title;

		news_mc.news_mc.main_mc.details_txt.text = stories[storynumber+k].story_details;

		news_mc.news_mc.main_mc.price_txt.text = stories[storynumber+k].story_price;

		news_mc.news_mc.main_mc.specs_txt.text = stories[storynumber+k].story_specs;

		news_mc.news_mc.main_mc.specs2_txt.text = stories[storynumber+k].story_specs2;

		news_mc.news_mc.main_mc.city_txt.text = stories[storynumber+k].story_city;

		news_mc.news_mc.main_mc.highway_txt.text = stories[storynumber+k].story_highway;

		

		news_mc.news_mc.main_mc.author_txt.text = stories[storynumber+k].story_postedby;

		news_mc.news_mc.main_mc.story_txt.text = stories[storynumber+k].story_body;

		

		news_mc.news_mc.main_mc.pic_mc.loadMovie(_global.imageDir+stories[storynumber+k].story_photo);

		_global.urllink = stories[storynumber+k].story_link;

		news_mc.news_mc.main_mc.url_txt.text = _global.urllink;

		news_mc.news_mc.main_mc.link_mc._visible = true;

		news_mc.news_mc.main_mc.back_mc._visible = true;

		news_mc.news_mc.main_mc.browse_mc._visible = false;

		news_mc.news_mc.main_mc.upload_mc._visible = false;

		news_mc.news_mc.info_mc.post_mc._visible = false;

		ticker_mc.ticker_mc.ticker_mc.info_mc.info_txt.text = "Viewing Post "+(storynumber+k+1)+ " of "+ sal;

	} else {

		news_mc.news_mc.main_mc.gotoAndStop(1);

		news_mc.news_mc.main_mc.change_mc._visible = false;

		news_mc.news_mc.info_mc.delete_mc._visible = false;

		news_mc.news_mc.info_mc.update_mc._visible = false;

		_global.storytoeditordel = stories[storynumber+k].story_ID;

		news_mc.news_mc.main_mc.date_txt.htmlText = stories[storynumber+k].story_date;

		news_mc.news_mc.main_mc.title_txt.htmlText = stories[storynumber+k].story_title;

		news_mc.news_mc.main_mc.details_txt.htmlText = stories[storynumber+k].story_details;

		news_mc.news_mc.main_mc.price_txt.htmlText = stories[storynumber+k].story_price;

		news_mc.news_mc.main_mc.specs_txt.htmlText = stories[storynumber+k].story_specs;

		news_mc.news_mc.main_mc.specs2_txt.htmlText = stories[storynumber+k].story_specs2;

		news_mc.news_mc.main_mc.city_txt.htmlText = stories[storynumber+k].story_city;

		news_mc.news_mc.main_mc.highway_txt.htmlText = stories[storynumber+k].story_highway;

		

		news_mc.news_mc.main_mc.author_txt.htmlText = stories[storynumber+k].story_postedby;

		

		news_mc.news_mc.main_mc.story_txt.htmlText = stories[storynumber+k].story_body+"<br><br>";

		news_mc.news_mc.main_mc.pic_mc.loadMovie(_global.imageDir+stories[storynumber+k].story_photo);

		_global.urllink = stories[storynumber+k].story_link;

		news_mc.news_mc.main_mc.link_mc._visible = true;

		news_mc.news_mc.main_mc.back_mc._visible = true;

		news_mc.news_mc.main_mc.browse_mc._visible = false;

		news_mc.news_mc.main_mc.upload_mc._visible = false;

		news_mc.news_mc.info_mc.post_mc._visible = false;

		ticker_mc.ticker_mc.ticker_mc.info_mc.info_txt.text = "Viewing Post "+(storynumber+k+1) +" of "+ sal;

	}

}

var storyloaded:Number = new Number();

news_mc.news_mc.storybutton1_mc.button_mc.readmore_mc.onRelease = function() {

	_global.viewing = true

	disablebuttons();

	_global.actionis = "more";

	fadeoutbuttonone();

	storyloaded = (k+0);

	loadcontent(0);

	getURL("javascript:resetScroller()");

};

news_mc.news_mc.storybutton2_mc.button_mc.readmore_mc.onRelease = function() {

	_global.viewing = true

	disablebuttons();

	_global.actionis = "more";

	fadeoutbuttonone();

	storyloaded = (k+1);

	loadcontent(1);

	getURL("javascript:resetScroller()");

};

news_mc.news_mc.storybutton3_mc.button_mc.readmore_mc.onRelease = function() {

	_global.viewing = true

	disablebuttons();

	_global.actionis = "more";

	fadeoutbuttonone();

	storyloaded = (k+2);

	loadcontent(2);

	getURL("javascript:resetScroller()");

};

news_mc.news_mc.storybutton4_mc.button_mc.readmore_mc.onRelease = function() {

	_global.viewing = true

	disablebuttons();

	_global.actionis = "more";

	fadeoutbuttonone();

	storyloaded = (k+3);

	loadcontent(3);

	getURL("javascript:resetScroller()");

};
 

news_mc.news_mc.storybutton5_mc.button_mc.readmore_mc.onRelease = function() {

	_global.viewing = true

	disablebuttons();

	_global.actionis = "more";

	fadeoutbuttonone();

	storyloaded = (k+4);

	loadcontent(4);

	getURL("javascript:resetScroller()");

};
 
 

news_mc.news_mc.storybutton6_mc.button_mc.readmore_mc.onRelease = function() {

	_global.viewing = true

	disablebuttons();

	_global.actionis = "more";

	fadeoutbuttonone();

	storyloaded = (k+5);

	loadcontent(5);

	getURL("javascript:resetScroller()");

};
 
 

news_mc.news_mc.storybutton7_mc.button_mc.readmore_mc.onRelease = function() {

	_global.viewing = true

	disablebuttons();

	_global.actionis = "more";

	fadeoutbuttonone();

	storyloaded = (k+6);

	loadcontent(6);

	getURL("javascript:resetScroller()");

};
 

news_mc.news_mc.storybutton8_mc.button_mc.readmore_mc.onRelease = function() {

	_global.viewing = true

	disablebuttons();

	_global.actionis = "more";

	fadeoutbuttonone();

	storyloaded = (k+7);

	loadcontent(7);

	getURL("javascript:resetScroller()");

};
 

news_mc.news_mc.storybutton9_mc.button_mc.readmore_mc.onRelease = function() {

	_global.viewing = true

	disablebuttons();

	_global.actionis = "more";

	fadeoutbuttonone();

	storyloaded = (k+8);

	loadcontent(8);

	getURL("javascript:resetScroller()");

}

	

news_mc.news_mc.storybutton10_mc.button_mc.readmore_mc.onRelease = function() {

	_global.viewing = true

	disablebuttons();

	_global.actionis = "more";

	fadeoutbuttonone();

	storyloaded = (k+9);

	loadcontent(9);

	getURL("javascript:resetScroller()");

};

//

//

// next buttons

function nextback() {

	disBakBtn();

	disNxtBtn();

}

function disBakBtn() {

	if (k<=9) {

		news_mc.news_mc.info_mc.prev_mc._visible = false;

		news_mc.news_mc.info_mc.prev_mc.enabled = false;

	}

	if (k>=10) {

		news_mc.news_mc.info_mc.prev_mc._visible = true;

		news_mc.news_mc.info_mc.prev_mc.enabled = true;

	}

}

function disNxtBtn() {

	if ((k+10)>=sal) {

		news_mc.news_mc.info_mc.next_mc._visible = false;

		news_mc.news_mc.info_mc.next_mc.enabled = false;

	}

	if ((k+11)<=(sal)) {

		news_mc.news_mc.info_mc.next_mc._visible = true;

		news_mc.news_mc.info_mc.next_mc.enabled = true;

	}

}

news_mc.news_mc.info_mc.next_mc.onRelease = function() {

	disablebuttons();

	_global.actionis = "next";

	fadeoutbuttonone();

	getURL("javascript:resetScroller()");

};

news_mc.news_mc.info_mc.prev_mc.onRelease = function() {

	disablebuttons();

	_global.actionis = "prev";

	fadeoutbuttonone();

	getURL("javascript:resetScroller()");

};

// read more buttons

// fades

news_mc.news_mc.storybutton1_mc._alpha = 0;

news_mc.news_mc.storybutton2_mc._alpha = 0;

news_mc.news_mc.storybutton3_mc._alpha = 0;

news_mc.news_mc.storybutton4_mc._alpha = 0;

news_mc.news_mc.storybutton5_mc._alpha = 0;

news_mc.news_mc.storybutton6_mc._alpha = 0;

news_mc.news_mc.storybutton7_mc._alpha = 0;

news_mc.news_mc.storybutton8_mc._alpha = 0;

news_mc.news_mc.storybutton9_mc._alpha = 0;

news_mc.news_mc.storybutton10_mc._alpha = 0;

function fadeinbuttonone() {

	news_mc.news_mc.loaderr_mc._visible = false;

	news_mc.news_mc.storybutton1_mc.onEnterFrame = function() {

		disablebuttons();

		if (news_mc.news_mc.storybutton1_mc._alpha<=99) {

			news_mc.news_mc.storybutton1_mc._alpha += 20;

			if (news_mc.news_mc.storybutton1_mc._alpha>=30) {

				fadeinbuttontwo();

			}

		} else {

			news_mc.news_mc.storybutton1_mc._alpha = 100;

			delete news_mc.news_mc.storybutton1_mc.onEnterFrame;

		}

	};

}

function fadeinbuttontwo() {

	news_mc.news_mc.storybutton2_mc.onEnterFrame = function() {

		disablebuttons();

		if (news_mc.news_mc.storybutton2_mc._alpha<=99) {

			news_mc.news_mc.storybutton2_mc._alpha += 20;

			if (news_mc.news_mc.storybutton2_mc._alpha>=30) {

				fadeinbuttonthree();

			}

		} else {

			news_mc.news_mc.storybutton2_mc._alpha = 100;

			delete news_mc.news_mc.storybutton2_mc.onEnterFrame;

		}

	};

}

function fadeinbuttonthree() {

	news_mc.news_mc.storybutton3_mc.onEnterFrame = function() {

		disablebuttons();

		if (news_mc.news_mc.storybutton3_mc._alpha<=99) {

			news_mc.news_mc.storybutton3_mc._alpha += 20;

			if (news_mc.news_mc.storybutton3_mc._alpha>=30) {

				fadeinbuttonfour();

			}

		} else {

			news_mc.news_mc.storybutton3_mc._alpha = 100;

			delete news_mc.news_mc.storybutton3_mc.onEnterFrame;

		}

	};

}

function fadeinbuttonfour() {

	news_mc.news_mc.storybutton4_mc.onEnterFrame = function() {

		disablebuttons();

		if (news_mc.news_mc.storybutton4_mc._alpha<=99) {

			news_mc.news_mc.storybutton4_mc._alpha += 20;

			if (news_mc.news_mc.storybutton4_mc._alpha>=30) {

				fadeinbuttonfive();

			}

		} else {

			news_mc.news_mc.storybutton4_mc._alpha = 100;

			delete news_mc.news_mc.storybutton4_mc.onEnterFrame;

		}

	};

}
 

function fadeinbuttonfive() {

	news_mc.news_mc.storybutton5_mc.onEnterFrame = function() {

		disablebuttons();

		if (news_mc.news_mc.storybutton5_mc._alpha<=99) {

			news_mc.news_mc.storybutton5_mc._alpha += 20;

			if (news_mc.news_mc.storybutton5_mc._alpha>=30) {

				fadeinbuttonsix();

			}

		} else {

			news_mc.news_mc.storybutton5_mc._alpha = 100;

			delete news_mc.news_mc.storybutton5_mc.onEnterFrame;

		}

	};

}
 
 

function fadeinbuttonsix() {

	news_mc.news_mc.storybutton6_mc.onEnterFrame = function() {

		disablebuttons();

		if (news_mc.news_mc.storybutton6_mc._alpha<=99) {

			news_mc.news_mc.storybutton6_mc._alpha += 20;

			if (news_mc.news_mc.storybutton6_mc._alpha>=30) {

				fadeinbuttonseven();

			}

		} else {

			news_mc.news_mc.storybutton6_mc._alpha = 100;

			delete news_mc.news_mc.storybutton6_mc.onEnterFrame;

		}

	};

}
 

function fadeinbuttonseven() {

	news_mc.news_mc.storybutton7_mc.onEnterFrame = function() {

		disablebuttons();

		if (news_mc.news_mc.storybutton7_mc._alpha<=99) {

			news_mc.news_mc.storybutton7_mc._alpha += 20;

			if (news_mc.news_mc.storybutton7_mc._alpha>=30) {

				fadeinbuttoneight();

			}

		} else {

			news_mc.news_mc.storybutton7_mc._alpha = 100;

			delete news_mc.news_mc.storybutton7_mc.onEnterFrame;

		}

	};

}
 

function fadeinbuttoneight() {

	news_mc.news_mc.storybutton8_mc.onEnterFrame = function() {

		disablebuttons();

		if (news_mc.news_mc.storybutton8_mc._alpha<=99) {

			news_mc.news_mc.storybutton8_mc._alpha += 20;

			if (news_mc.news_mc.storybutton8_mc._alpha>=30) {

				fadeinbuttonnine();

			}

		} else {

			news_mc.news_mc.storybutton8_mc._alpha = 100;

			delete news_mc.news_mc.storybutton8_mc.onEnterFrame;

		}

	};

}
 

function fadeinbuttonnine() {

	news_mc.news_mc.storybutton9_mc.onEnterFrame = function() {

		disablebuttons();

		if (news_mc.news_mc.storybutton9_mc._alpha<=99) {

			news_mc.news_mc.storybutton9_mc._alpha += 20;

			if (news_mc.news_mc.storybutton9_mc._alpha>=30) {

				fadeinbuttonten();

			}

		} else {

			news_mc.news_mc.storybutton9_mc._alpha = 100;

			delete news_mc.news_mc.storybutton9_mc.onEnterFrame;

		}

	};

}
 

function fadeinbuttonten() {

	news_mc.news_mc.storybutton10_mc.onEnterFrame = function() {

		disablebuttons();

		if (news_mc.news_mc.storybutton10_mc._alpha<=99) {

			news_mc.news_mc.storybutton10_mc._alpha += 20;

		} else {

			news_mc.news_mc.storybutton10_mc._alpha = 100;

			delete news_mc.news_mc.storybutton10_mc.onEnterFrame;

			enablebuttons();

			nextback();

		}

	};

}

function fadeoutbuttonone() {

	news_mc.news_mc.storybutton1_mc.onEnterFrame = function() {

		disablebuttons();

		if (news_mc.news_mc.storybutton1_mc._alpha>=1) {

			news_mc.news_mc.storybutton1_mc._alpha -= 20;

			if (news_mc.news_mc.storybutton1_mc._alpha<=60) {

				fadeoutbuttontwo();

			}

		} else {

			news_mc.news_mc.storybutton1_mc._alpha = 0;

			delete news_mc.news_mc.storybutton1_mc.onEnterFrame;

		}

	};

}

function fadeoutbuttontwo() {

	news_mc.news_mc.storybutton2_mc.onEnterFrame = function() {

		disablebuttons();

		if (news_mc.news_mc.storybutton2_mc._alpha>=1) {

			news_mc.news_mc.storybutton2_mc._alpha -= 20;

			if (news_mc.news_mc.storybutton2_mc._alpha<=60) {

				fadeoutbuttonthree();

			}

		} else {

			news_mc.news_mc.storybutton2_mc._alpha = 0;

			delete news_mc.news_mc.storybutton2_mc.onEnterFrame;

		}

	};

}

function fadeoutbuttonthree() {

	news_mc.news_mc.storybutton3_mc.onEnterFrame = function() {

		disablebuttons();

		if (news_mc.news_mc.storybutton3_mc._alpha>=1) {

			news_mc.news_mc.storybutton3_mc._alpha -= 20;

			if (news_mc.news_mc.storybutton3_mc._alpha<=60) {

				fadeoutbuttonfour();

			}

		} else {

			news_mc.news_mc.storybutton3_mc._alpha = 0;

			delete news_mc.news_mc.storybutton3_mc.onEnterFrame;

		}

	};

}

function fadeoutbuttonfour() {

	news_mc.news_mc.storybutton4_mc.onEnterFrame = function() {

		disablebuttons();

		if (news_mc.news_mc.storybutton4_mc._alpha>=1) {

			news_mc.news_mc.storybutton4_mc._alpha -= 20;

			if (news_mc.news_mc.storybutton4_mc._alpha<=60) {

				fadeoutbuttonfive();

			}

		} else {

			news_mc.news_mc.storybutton4_mc._alpha = 0;

			delete news_mc.news_mc.storybutton4_mc.onEnterFrame;

		}

	};

}
 

function fadeoutbuttonfive() {

	news_mc.news_mc.storybutton5_mc.onEnterFrame = function() {

		disablebuttons();

		if (news_mc.news_mc.storybutton5_mc._alpha>=1) {

			news_mc.news_mc.storybutton5_mc._alpha -= 20;

			if (news_mc.news_mc.storybutton5_mc._alpha<=60) {

				fadeoutbuttonsix();

			}

		} else {

			news_mc.news_mc.storybutton5_mc._alpha = 0;

			delete news_mc.news_mc.storybutton5_mc.onEnterFrame;

		}

	};

}
 

function fadeoutbuttonsix() {

	news_mc.news_mc.storybutton6_mc.onEnterFrame = function() {

		disablebuttons();

		if (news_mc.news_mc.storybutton6_mc._alpha>=1) {

			news_mc.news_mc.storybutton6_mc._alpha -= 20;

			if (news_mc.news_mc.storybutton6_mc._alpha<=60) {

				fadeoutbuttonseven();

			}

		} else {

			news_mc.news_mc.storybutton6_mc._alpha = 0;

			delete news_mc.news_mc.storybutton6_mc.onEnterFrame;

		}

	};

}
 
 

function fadeoutbuttonseven() {

	news_mc.news_mc.storybutton7_mc.onEnterFrame = function() {

		disablebuttons();

		if (news_mc.news_mc.storybutton7_mc._alpha>=1) {

			news_mc.news_mc.storybutton7_mc._alpha -= 20;

			if (news_mc.news_mc.storybutton7_mc._alpha<=60) {

				fadeoutbuttoneight();

			}

		} else {

			news_mc.news_mc.storybutton7_mc._alpha = 0;

			delete news_mc.news_mc.storybutton7_mc.onEnterFrame;

		}

	};

}
 

function fadeoutbuttoneight() {

	news_mc.news_mc.storybutton8_mc.onEnterFrame = function() {

		disablebuttons();

		if (news_mc.news_mc.storybutton8_mc._alpha>=1) {

			news_mc.news_mc.storybutton8_mc._alpha -= 20;

			if (news_mc.news_mc.storybutton8_mc._alpha<=60) {

				fadeoutbuttonnine();

			}

		} else {

			news_mc.news_mc.storybutton8_mc._alpha = 0;

			delete news_mc.news_mc.storybutton8_mc.onEnterFrame;

		}

	};

}
 

function fadeoutbuttonnine() {

	news_mc.news_mc.storybutton9_mc.onEnterFrame = function() {

		disablebuttons();

		if (news_mc.news_mc.storybutton9_mc._alpha>=1) {

			news_mc.news_mc.storybutton9_mc._alpha -= 20;

			if (news_mc.news_mc.storybutton9_mc._alpha<=60) {

				fadeoutbuttonten();

			}

		} else {

			news_mc.news_mc.storybutton9_mc._alpha = 0;

			delete news_mc.news_mc.storybutton9_mc.onEnterFrame;

		}

	};

}
 

function fadeoutbuttonten() {

	news_mc.news_mc.storybutton10_mc.onEnterFrame = function() {

		disablebuttons();

		if (news_mc.news_mc.storybutton10_mc._alpha>=1) {

			news_mc.news_mc.storybutton10_mc._alpha -= 20;

		} else {

			news_mc.news_mc.storybutton10_mc._alpha = 0;

			delete news_mc.news_mc.storybutton10_mc.onEnterFrame;

			dowhatsneeded();

		}

	};

}

news_mc.news_mc.info_mc.next_mc._visible = false;

news_mc.news_mc.info_mc.prev_mc._visible = false;

function dowhatsneeded() {

	if (_global.actionis == "next") {

		news_mc.news_mc.info_mc.next_mc._visible = false;

		news_mc.news_mc.info_mc.prev_mc._visible = false;

		k += 10;

		populatestorybuttons();

		nextback();

		fadeinbuttonone();

		if(_global.endnews == true) {

			ticker_mc.ticker_mc.ticker_mc.info_mc.info_txt.text = "Posts "+(k+1)+" - "+ sal +" of "+ sal;

		} else {

			ticker_mc.ticker_mc.ticker_mc.info_mc.info_txt.text = "Posts "+(k+1)+" - "+(k+10)+" of "+ sal;

		}

	}

	if (_global.actionis == "prev") {

		news_mc.news_mc.info_mc.next_mc._visible = false;

		news_mc.news_mc.info_mc.prev_mc._visible = false;

		k -= 10;

		populatestorybuttons();

		nextback();

		fadeinbuttonone();

		if(_global.endnews == true) {

			ticker_mc.ticker_mc.ticker_mc.info_mc.info_txt.text = "Posts "+(k+1)+" - "+ sal +" of "+ sal;

		} else {

			ticker_mc.ticker_mc.ticker_mc.info_mc.info_txt.text = "Posts "+(k+1)+" - "+(k+10)+" of "+ sal;

		}

	}

	if (_global.actionis == "more") {

		fadeinmain();

	}

}

function fadeinmain() {

	news_mc.news_mc.main_mc._visible = true;

	news_mc.news_mc.info_mc.next_mc._visible = false;

	news_mc.news_mc.info_mc.prev_mc._visible = false;

	news_mc.news_mc.main_mc.onEnterFrame = function() {

		if (news_mc.news_mc.main_mc._alpha<=99) {

			news_mc.news_mc.main_mc._alpha += 20;

		} else {

			news_mc.news_mc.main_mc._alpha = 100;

			delete news_mc.news_mc.main_mc.onEnterFrame;

		}

	};

}

function fadeoutmain() {

	news_mc.news_mc.main_mc.onEnterFrame = function() {

		if (news_mc.news_mc.main_mc._alpha>=1) {

			news_mc.news_mc.main_mc._alpha -= 20;

		} else {

			news_mc.news_mc.main_mc._alpha = 0;

			news_mc.news_mc.main_mc._visible = false;

			fadeinbuttonone();

			nextback();

			delete news_mc.news_mc.main_mc.onEnterFrame;

		}

	};

}

_global.viewing = false;

news_mc.news_mc.main_mc.back_mc.onRelease = function() {

	if(_global.endnews == true) {

			ticker_mc.ticker_mc.ticker_mc.info_mc.info_txt.text = "Posts "+(k+1)+" - "+ sal +" of "+ sal;

		} else {

			ticker_mc.ticker_mc.ticker_mc.info_mc.info_txt.text = "Posts "+(k+1)+" - "+(k+10)+" of "+ sal;

		}

	_global.viewing = false;

	fadeoutmain();

	news_mc.news_mc.info_mc.post_mc._visible = false;

	news_mc.news_mc.info_mc.delete_mc._visible = false;

	news_mc.news_mc.info_mc.update_mc._visible = false;

	news_mc.news_mc.main_mc.browse_mc._visible = false;

	news_mc.news_mc.main_mc.pic_mc._visible = true;

	news_mc.news_mc.main_mc.loader_mc._visible = true;

	news_mc.news_mc.main_mc.note_mc._visible = false;

};
 

news_mc.news_mc.main_mc._visible = false;

news_mc.news_mc.main_mc._alpha = 0;

var dbQuery:LoadVars = new LoadVars();

var getStoryList:LoadVars = new LoadVars();

// assign onLoad handlers for LoadVars

getStoryList.onLoad = fullList;

var stories:Array = new Array();

// Event to trigger Php load data

var k:Number = 0;

// story array length

var sal:Number = 0;

// for story ID output

var storyIdVar:Number = 0;

// for story score output

loadLatestStories();

Open in new window

0
 
LVL 1

Expert Comment

by:Intersel
Comment Utility
The correct SQL query is
SELECT * FROM `cmsnewsv2` WHERE story_title = "test"

Sorry I forgot to put the " around the keyword. the " tells that it is a string (and not a column name)

0
 
LVL 39

Expert Comment

by:blue-genie
Comment Utility
to test the php run the php in your browser and use a query

liek blahblah/blah.php?variablename=whatever

check your sql with intersel's answer and tell us what happens then.
0
 

Author Comment

by:sam928
Comment Utility

++when i run the search in the mySQL directly, it works fine and returns the data relevant to the keyword i have entered.
=========================================


I have tried all of these following in the browser and here is what i get.
========================================


http://previewsample.com/cmsnews/scripts/topstory.php?action=loadLatestStories&keyword='test'

http://previewsample.com/cmsnews/scripts/topstory.php?action=loadLatestStories&keyword=test
========
RESULT   total=0
========


http://previewsample.com/cmsnews/scripts/topstory.php?keyword=test

http://previewsample.com/cmsnews/scripts/topstory.php?keyword='test'
=========
RESULT -- BLANK PAGE IN THE BROWSER.
=========

still the same result.
But the search in mySQL directly works fine, as mentioned above.

so something must be wrong in the PHP i am assuming?
0
 

Author Comment

by:sam928
Comment Utility
attacehd below is the 'current' PHP i have installed.


<?php

// include the Database classes

require_once('classes/database_php4.php');
 
 

// include the Database classes

require_once('classes/database_php4.php');

 

/* TRY THIS KIND OF THING TO ESCAPE THE POST DATA

foreach ($_REQUEST as $key => $value)

{

// NEVER REFER TO $_REQUEST AGAIN - WE HAVE A CLEAN ARRAY

   $clean_post[$key] = mysql_real_escape_string(stripslashes($value));

}

 

// TRY THIS FOR THE QUERY

if ($clean_post['action'] == 'loadLatestStories') 

{

// SET UP A MATCH STRING

   $kw  = '%' . $clean_post["keyword"] . '%';

   $sql = "SELECT * FROM cmsnewsv2 WHERE story_title LIKE \"$kw\"";

   echo getStoryList($sql);

}
 

*/

 //escape quotes and apostrophes if magic_quotes_gpc off

if (!get_magic_quotes_gpc()) {

  foreach($_REQUEST as $key=>$value) {

    $temp = addslashes($value);

    $_REQUEST[$key] = $temp;

    }

  }
 

  if ($_REQUEST['action'] == 'loadLatestStories') {

  

//THE CODE I HAVE FOR THE KEYWORD SEARCH ...BUT IS NOT WORKING..

$kw = trim($_REQUEST['keyword']);

   $sql = "SELECT * FROM cmsnewsv2 WHERE story_title = '%$kw$'";

	echo getStoryList($sql);

  }
 

	
 

   //code for retrieving full list

  //$sql = 'SELECT * FROM cmsnewsv2 ORDER BY story_ID desc LIMIT 0,100';

  	//echo getStoryList($sql);

  //}
 

// get list of stories

function getStoryList($sql) {

$db = new Database('dxxt','xx','xx','xx');

  $result = $db->query($sql);

  $numrows = $result->num_rows;

  $storylist = "total=$numrows";

    $counter = 0;

  while ($row = $result->fetch_assoc()) {

  	//$row['story_date'] = date('l jS');

    $storylist .= '&story_ID'.$counter.'='.$row['story_ID'];

    $storylist .= '&story_title'.$counter.'='.urlencode($row['story_title']);

    $storylist .= '&story_body'.$counter.'='.urlencode($row['story_body']);

	

	$storylist .= '&story_details'.$counter.'='.urlencode($row['story_details']);

    $storylist .= '&story_postedby'.$counter.'='.urlencode($row['story_postedby']);

    $storylist .= '&story_photo'.$counter.'='.urlencode($row['story_photo']);

    $storylist .= '&story_date'.$counter.'='.urlencode($row['story_date']);

    $storylist .= '&story_link'.$counter.'='.urlencode($row['story_link']);

	$storylist .= '&story_price'.$counter.'='.urlencode($row['story_price']);

	$storylist .= '&story_specs'.$counter.'='.urlencode($row['story_specs']);

	$storylist .= '&story_specs2'.$counter.'='.urlencode($row['story_specs2']);

	$storylist .= '&story_city'.$counter.'='.urlencode($row['story_city']);

	$storylist .= '&story_highway'.$counter.'='.urlencode($row['story_highway']);

	

    $counter++;

    }

  $db->close();

  return $storylist;

}

?>

Open in new window

0
 
LVL 39

Expert Comment

by:blue-genie
Comment Utility
i'm going to leave you in the hands of the php people now.
good luck.
0
 
LVL 1

Expert Comment

by:Intersel
Comment Utility
Could you try to put the exact query you put in phpmyadmin in line 21?
or better in line 52?
$db->query('SELECT * FROM `cmsnewsv2` WHERE story_title = "test"');

Just to see if it sends back the correct answer or not...

Then if it's ok, could you add an echo behind line 21 in order to verify if everything correct in the query:

   $kw  = '%' . $clean_post["keyword"] . '%';
   $sql = "SELECT * FROM cmsnewsv2 WHERE story_title LIKE \"$kw\"";
echo $sql;
   echo getStoryList($sql);

and then fix what's wrong...
0
 

Author Comment

by:sam928
Comment Utility
Hello Intersel

YES! that was the magic code..

and that worked...and now the current PHP script that is working is in the snippet below.


Please click on the links below and you will see that the 2nd link works in the browser when testing.
===============================

http://previewsample.com/cmsnews/scripts/topstory.php?action=loadLatestStories&keyword='test'
======================================
http://previewsample.com/cmsnews/scripts/topstory.php?action=loadLatestStories&keyword=test

-------------------------------------------------------------------
so now this takes care of the PHP part,, but i am still not able to send the keyword from flash..  it does not work and does not return any data into flash.

;(
So does this mean that something is wrong on the flash side?



<?php

// include the Database classes

require_once('classes/database_php4.php');

 

 

// include the Database classes

require_once('classes/database_php4.php');

 
 

 //escape quotes and apostrophes if magic_quotes_gpc off

if (!get_magic_quotes_gpc()) {

  foreach($_REQUEST as $key=>$value) {

    $temp = addslashes($value);

    $_REQUEST[$key] = $temp;

    }

  }

 

  if ($_REQUEST['action'] == 'loadLatestStories') {

  

//THE CODE I HAVE FOR THE KEYWORD SEARCH ...BUT IS NOT WORKING..

$kw = trim($_REQUEST['keyword']);

   //$sql = 'SELECT * FROM `cmsnewsv2` WHERE story_title = ""';

   

   $sql = "SELECT * FROM cmsnewsv2 WHERE story_title LIKE \"%$kw%\"";

echo $sql;

   echo getStoryList($sql);

          

 

  }

 

	

 

   //code for retrieving full list

  //$sql = 'SELECT * FROM cmsnewsv2 ORDER BY story_ID desc LIMIT 0,100';

  	//echo getStoryList($sql);

  //}
 

// get list of stories

function getStoryList($sql) {

$db = new Database('db704.perfora.net','dbo277201649','Ycd2sZaR','db277201649');

  $result = $db->query($sql);

  

  $numrows = $result->num_rows;

  $storylist = "total=$numrows";

    $counter = 0;

  while ($row = $result->fetch_assoc()) {

  	//$row['story_date'] = date('l jS');

    $storylist .= '&story_ID'.$counter.'='.$row['story_ID'];

    $storylist .= '&story_title'.$counter.'='.urlencode($row['story_title']);

    $storylist .= '&story_body'.$counter.'='.urlencode($row['story_body']);

	

	$storylist .= '&story_details'.$counter.'='.urlencode($row['story_details']);

    $storylist .= '&story_postedby'.$counter.'='.urlencode($row['story_postedby']);

    $storylist .= '&story_photo'.$counter.'='.urlencode($row['story_photo']);

    $storylist .= '&story_date'.$counter.'='.urlencode($row['story_date']);

    $storylist .= '&story_link'.$counter.'='.urlencode($row['story_link']);

	$storylist .= '&story_price'.$counter.'='.urlencode($row['story_price']);

	$storylist .= '&story_specs'.$counter.'='.urlencode($row['story_specs']);

	$storylist .= '&story_specs2'.$counter.'='.urlencode($row['story_specs2']);

	$storylist .= '&story_city'.$counter.'='.urlencode($row['story_city']);

	$storylist .= '&story_highway'.$counter.'='.urlencode($row['story_highway']);

	

    $counter++;

    }

  $db->close();

  return $storylist;

}

?>

Open in new window

0
 

Author Comment

by:sam928
Comment Utility
Also, i need ALL of the data to load by default.. (the same way it was before any of this search function stuff..)

So how would i integrate that into this search function?  (LINE 33 is that code for retrieving full list)




0
 
LVL 39

Expert Comment

by:blue-genie
Comment Utility
dude upload your flash file (change .fla to .txt)
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

Author Comment

by:sam928
Comment Utility
hi blue genie ;)

i attached the following:

Navigation File.fla -- the main file...all other pages i load in dynamically.
home.fla --
-----------------------------

i have the search box on the Naviagation File...

the home.fla is where all data is loaded into.. please see 'news button + initial load action' in the timeline on scene 1... that is where all actionscript is for loading in the data.

-----------------------------
soo, i think that i need the search box and the code to be in the actionscript where all the loading code is? -- on the home.fla?


home.txt
Navigation-File.txt
0
 

Author Comment

by:sam928
Comment Utility
@blue-genie,

were you able to download the .fla's?

;)
0
 
LVL 39

Expert Comment

by:blue-genie
Comment Utility
firstly that link you say works why does that return your select statement ? php?
where are you calling the file to load the keyword search to return the data to flash? i need some explanation on what is going on with your fille.

i want to know where you call the php file where and how you handle the result and  where it's being displayed.

blu
0
 

Author Comment

by:sam928
Comment Utility
@blue genie

1)the link that works returns the 'select statement' because in the PHP we added an echo.... I have removed it.. and here is what it looks like now:

http://previewsample.com/cmsnews/scripts/topstory.php?action=loadLatestStories&keyword=test
-------------------------------------------------------------------------------------

Please look at this link:

http;//www.previewsample.com/auto

---here is what the file looks like when i use the default  to return ALL data back into flash.
The search box that i have made is on the top right and it has the AS code that you gave me.

What i am looking to do is have the ALL data load by default ,,, BUT, then when a keyword is entered it should load only the data that is relevant to the keyword..

So far.. we know the PHP script is working.. AND  the code you gave me is inside of the search box button.

The AS code that loads the data into flash is located on the MAIN TIMELINE.. >> under "LOADING ACTIONS'

Please view this..and you will see that all the actionscript is there ...and also the call to the PHP script that loads the data is there.. which is on LINE 39.  (inside of "LOADING ACTIONS"  on the main timeline)

-------------------------
i have attached the 'home.fla' file... this is the latest with reference to what i wrote above.
---------------------------------
does this make sense now?  ;)


home.txt
0
 

Author Comment

by:sam928
Comment Utility
please disregard the home.txt above... the current one is attached here..

thanks ))

home.txt
0
 
LVL 39

Expert Comment

by:blue-genie
Comment Utility
that file is making my CS4 crash.

okay step back i'm gettign confused now. you just want to display the results returned from the php right?
so what's the problem you're having exactly now at  this point?

you need to have 2 different items that will return all the data and return data based on keyword.'
so you need to load the php file that will return based on keyword.
then get the data based on what you're echoing in the php,
what i would suggest is get the php to return the stuff in xml format then it's easier for flash to go through it and loop to display the items.

p.s test the file you're loading? see if it's making your system crash.
0
 

Author Comment

by:sam928
Comment Utility
yes you are correct, i need to have 2 different items... one that will return ALL data, (i already have this working so there is no problem with this)

2) i need to have the data returned to flash relevant to the keyword entered.... and we already have the PHP script that does that.. THE ONLY THING i need is to have the SEND AND LOAD function work with the flash so that it will connect with the PHP.

The ActionScript i have below is what i have that loads the data into flash... BUT,, i just need to integrate the Keyword SendAndLoad function with it.


function loadLatestStories():Void {
    k = 0;
    news_mc.news_mc.loaderr_mc._visible = true;
    dbQuery.action = "loadLatestStories";
    dbQuery.sendAndLoad(_global.phpDir+"topstory.php?ck="+new Date().getTime(),getStoryList);
}
====================================================
ABOVE IS THE WHAT CALLS THE PHP SCRIPT THAT LOADS 'ALL' DATA INTO FLASH...
=====================================================================



WHAT I NEED IS TO KNOW IS HOW TO CHANGE THE FOLLOWING CODE(this is the code that you came up with so far) SO THAT IT CORRELATES WITH THE SEND AND LOAD FUNCTION WITH THE KEYWORD SEARCH.

 myData = new LoadVars();
   myData.keyword = keyword_txt.text;
 

   myData.sendAndLoad("scripts/topstory.php", myData, 'POST');
}
==================================================

no sure why your cs4 is crashing.. and sorry i cannot use xml... the entire structure is already complete as far as the actionscript that loads all of the data in...
\



0
 

Author Comment

by:sam928
Comment Utility
again here is the PHP script.. >> the working PHP script that has the search query..   i need to connect to this from the AS.

<?php

// include the Database classes

require_once('classes/database_php4.php');

 

 

// include the Database classes

require_once('classes/database_php4.php');

 
 

 //escape quotes and apostrophes if magic_quotes_gpc off

if (!get_magic_quotes_gpc()) {

  foreach($_REQUEST as $key=>$value) {

    $temp = addslashes($value);

    $_REQUEST[$key] = $temp;

    }

  }

 

  if ($_REQUEST['action'] == 'loadLatestStories') {

  

//THE CODE I HAVE FOR THE KEYWORD SEARCH THAT I NEED TO CONNECT WITH THE SEND AND LOAD ACTIONSCRIPT..

$kw = trim($_REQUEST['keyword']); 

   $sql = "SELECT * FROM cmsnewsv2 WHERE story_title LIKE \"%$kw%\"";

//echo $sql;

   echo getStoryList($sql);

  }

 

	

 
 
 

// get list of stories

function getStoryList($sql) {

$db = new Database('db704.perfora.net','dbo277201649','Ycd2sZaR','db277201649');

  $result = $db->query($sql);

  

  $numrows = $result->num_rows;

  $storylist = "total=$numrows";

    $counter = 0;

  while ($row = $result->fetch_assoc()) {

  	//$row['story_date'] = date('l jS');

    $storylist .= '&story_ID'.$counter.'='.$row['story_ID'];

    $storylist .= '&story_title'.$counter.'='.urlencode($row['story_title']);

    $storylist .= '&story_body'.$counter.'='.urlencode($row['story_body']);

	

	$storylist .= '&story_details'.$counter.'='.urlencode($row['story_details']);

    $storylist .= '&story_postedby'.$counter.'='.urlencode($row['story_postedby']);

    $storylist .= '&story_photo'.$counter.'='.urlencode($row['story_photo']);

    $storylist .= '&story_date'.$counter.'='.urlencode($row['story_date']);

    $storylist .= '&story_link'.$counter.'='.urlencode($row['story_link']);

	$storylist .= '&story_price'.$counter.'='.urlencode($row['story_price']);

	$storylist .= '&story_specs'.$counter.'='.urlencode($row['story_specs']);

	$storylist .= '&story_specs2'.$counter.'='.urlencode($row['story_specs2']);

	$storylist .= '&story_city'.$counter.'='.urlencode($row['story_city']);

	$storylist .= '&story_highway'.$counter.'='.urlencode($row['story_highway']);

	

    $counter++;

    }

  $db->close();

  return $storylist;

}

?>

Open in new window

0
 

Author Comment

by:sam928
Comment Utility
====  NEW UPDATE =====

OK, i have done some things here that i think is moving towards the right direction.. please correct me if i'm wrong...

ActionScript:
---------------------------------

submit.onPress = function(){
        myData.keyword = keyword.text
       
        myData.sendAndLoad("scripts/searchtopstory.php", myData, "POST")
        function loadLatestStories():Void {
            k = 0;
    //news_mc.news_mc.loaderr_mc._visible = true;
    myData.action = "loadLatestStories";
    }
    }

   

}

var myData:LoadVars = new LoadVars();

myData.onLoad = fullList;

function fullList(success:Boolean):Void {
    if (!success) {
        loadingMsg_txt.text = "Sorry, database unavailable";
    } else {
        processResults(myData);
    }
}
function processResults(theTarget:LoadVars):Void {
   
..... CONTINUATION OF ACTIONSCRIPT NOT IMPORTANT....
---------------------------------------------------------------------------------------------------------

AND HERE IS THE PHP SCRIPT BELOW...

when i enter a word in the search box nothing happens.... not even activity on the status bar in the browser...






<?php

// include the Database classes

require_once('classes/database_php4.php');

 

 

// include the Database classes

require_once('classes/database_php4.php');

 
 

 //escape quotes and apostrophes if magic_quotes_gpc off

if (!get_magic_quotes_gpc()) {

  foreach($_POST as $key=>$value) {

    $temp = addslashes($value);

    $_POST[$key] = $temp;

    }

  }

 

  if ($_POST['action'] == 'loadLatestStories') {

  

//THE CODE I HAVE FOR THE KEYWORD SEARCH THAT I NEED TO CONNECT WITH THE SEND AND LOAD ACTIONSCRIPT..

$kw = trim($_POST['keyword']); 

   $sql = "SELECT * FROM cmsnewsv2 WHERE story_title LIKE \"%$kw%\"";

//echo $sql;

   echo myData($sql);

  }

 

	

 
 
 

// get list of stories

function myData($sql) {

$db = new Database('XXXX');

  $result = $db->query($sql);

  

  $numrows = $result->num_rows;

  $storylist = "total=$numrows";

    $counter = 0;

  while ($row = $result->fetch_assoc()) {

  	//$row['story_date'] = date('l jS');

    $storylist .= '&story_ID'.$counter.'='.$row['story_ID'];

    $storylist .= '&story_title'.$counter.'='.urlencode($row['story_title']);

    $storylist .= '&story_body'.$counter.'='.urlencode($row['story_body']);

	

	$storylist .= '&story_details'.$counter.'='.urlencode($row['story_details']);

    $storylist .= '&story_postedby'.$counter.'='.urlencode($row['story_postedby']);

    $storylist .= '&story_photo'.$counter.'='.urlencode($row['story_photo']);

    $storylist .= '&story_date'.$counter.'='.urlencode($row['story_date']);

    $storylist .= '&story_link'.$counter.'='.urlencode($row['story_link']);

	$storylist .= '&story_price'.$counter.'='.urlencode($row['story_price']);

	$storylist .= '&story_specs'.$counter.'='.urlencode($row['story_specs']);

	$storylist .= '&story_specs2'.$counter.'='.urlencode($row['story_specs2']);

	$storylist .= '&story_city'.$counter.'='.urlencode($row['story_city']);

	$storylist .= '&story_highway'.$counter.'='.urlencode($row['story_highway']);

	

    $counter++;

    }

  $db->close();

  return $storylist;

}

?>

Open in new window

0
 
LVL 39

Expert Comment

by:blue-genie
Comment Utility
you connect to the php that returns all the data and that works.

so you call the php which the keywork exactly the same as the other one.
i don't understand what you're struggling with.
0
 

Author Comment

by:sam928
Comment Utility
the flash is not working.. something is wrong with the actionscript.  

the whole objective from the start is to have the ability to run a search from flash and return the results in flash.
the code you have given me is not working.  it is not working with the stucture of all the other actionscript.

what i'm struggling with is understanding why you cant understand this.  if you dont want to help me then you should have not responded back the first time.

Every comment that you have made was 'i dont understand what your struggling with.. , or "i dont understand what is wrong" or "i dont understand what is not working"

This is exactly why i opened a new question because you were obviosly were not able to figure this out.. It has to be the most simplest thing for somebody that is an expert at actionscript.. this is why i am a member on this site.. to get assistance but you dont even give that..

I have explained what i need in every possible format and uploaded every file associated with this and still you dont understand what i'm struggling with. ARE YOU SERIOUS?


0
 
LVL 39

Expert Comment

by:blue-genie
Comment Utility
yes i am serious. If I didn't want to help I wouldn't waste my time on this site. I can only help if I understand the problem. You said  the php works fine. you are able to return all the data with the first php file.
so then you want them to enter a keyword you send that back to the php file and it displays the results.

so first of all check that your submit is being triggered with a trace.


but i'm guessing it's not pertinant to your problem since you're not getting a response from the php.

as i said previously "i need some explanation on what is going on with your fille."
when i run your file - nothing happens. I see that call to home.swf is loaded but there's nothing on the stage. I can't run the file to try and follow your sequence of events to try and debug.

since your php is based on this condition
$_POST['action']

i'd check that the value is received and also echo back an error message if its not so that you can debug.
0
 
LVL 39

Expert Comment

by:blue-genie
Comment Utility
ignore > but i'm guessing it's not pertinant to your problem since you're not getting a response from the php.
0
 
LVL 39

Expert Comment

by:blue-genie
Comment Utility
in your navigation file there a box there with search vehicles and go button. is that where this search is supposed to happen? it's off the stage and doens't do anything at runtime curently.
0
 

Author Comment

by:sam928
Comment Utility
please disregard the navigation file... i moved the 'search vehicles box' onto the 'home.swf' .. since this is where all the other actionscript is.  .. (you can find the updated 'home.swf' above , 9 comments prior ...)

I do not know how to add a trace to the submit button,, i will try to figure it out and let you know what happens.
0
 
LVL 1

Expert Comment

by:Intersel
Comment Utility
Well... Actually everything should run fine by just adding from the initial code :
function loadLatestStories():Void {
   k = 0;
   news_mc.news_mc.loaderr_mc._visible = true;
   dbQuery.action = "loadLatestStories";
   dbQuery.sendAndLoad(_global.phpDir+"topstory.php?keyword="+keyword.text+"&ck="+new Date().getTime(),getStoryList);
}

The idea is to call the php file the same way you did from the browser...

I'm not an AS expert but for the tests I would suggest the following things (Blue-genie, confirm them or not ):

As it is a call to a php file, you need to call your AS (SWF) from the server with a client browser like IE. Is it the case? or are you calling it from the adobe environment? As far as I know, the CS won't call the php file from the php server... and then the containt would be rubbish php code things...

In order to do some testing in the CS environment and get some traces, you can create a TXT file (let's call it searchtopstory.txt) containing some testing results simulating a call to the php file.
and then replacing
myData.sendAndLoad("scripts/searchtopstory.php", myData, "POST")
with
myData.sendAndLoad("scripts/searchtopstory.txt", myData, "POST")
for the time of the tests on the AS side...

you can have some trace with the "print" function.
I would change your code this way:

var myData:LoadVars = new LoadVars();
myData.onLoad = fullList;

k = 0;// usefull?
//news_mc.news_mc.loaderr_mc._visible = true;

myData.action = "loadLatestStories";

submit.onPress = function()
{
       myData.keyword = keyword.text;
       print "myData.keyword = "+  myData.keyword ;// print some trace on the CS console
       //myData.sendAndLoad("scripts/searchtopstory.php", myData, "POST");
       myData.sendAndLoad("scripts/searchtopstory.txt", myData, "POST");//use a txt file for the tests
}

function fullList(success:Boolean):Void
{
   if (!success)
  {
       loadingMsg_txt.text = "Sorry, database unavailable";
   }
   else
  {
      print("great, we get some results back... "+myData);
       processResults(myData);
   }
}





 
0
 
LVL 39

Expert Comment

by:blue-genie
Comment Utility
Ok i was not aware you're thrown out the navigation file, thought you just updated the home file.

your Go button is not working because you have a button embedded in a button.

I'd recommend the following.
1. use the HitState of the button to put the "active" area of your button instead of creating another button.
2. take the code off the button. give your search movie an instance name and give the button an instance name.
3. put the code on the timeline

I've tested this locally on my own db and php and it works.
searchBox.searchBtn.onRelease = function() {

	var searchTerm = searchBox.keyword_txt.text;

	trace("search for "+ searchTerm);

	doKeywordSearch(searchTerm);

}
 
 

function doKeywordSearch(str:String):Void {

	var kwVars:LoadVars = new LoadVars();

	kwVars.searchTerm = str;

	kwVars.action = "loadLatestStories";

	

	kwVars.sendAndLoad("search.php", kwVars ,"POST");

	kwVars.onLoad = function(success) {

		display.text = "got data "

	}

	

}

Open in new window

0
 

Author Comment

by:sam928
Comment Utility
@Intersel;

thank you for that info.. i have tested but recieve these compliler errors:

1)-------------------------------------------------------------------
Syntax error.
print "myData.keyword = "+myData.keyword ;// print some trace on the CS console

2)--------------------------------------------------------------------------
Wrong number of parameters; print requires exactly 2.
print("great, we get some results back... "+myData);
------------------------------------------------------------------------------

i'm not sure how to fix that.
0
 
LVL 1

Accepted Solution

by:
Intersel earned 250 total points
Comment Utility
oups...
I should be very tired when I write the post !

It is not print but "trace", and it needs some '()'... so, the code should be written as following

....
trace("myData.keyword = "+  myData.keyword);// print some trace on the CS console
...

and

....
trace("great, we get some results back... "+myData);
....
0
 

Author Comment

by:sam928
Comment Utility
@blue-genie

yes,, your code worked.. i followed your directions and ran the test.. > i entered a keyword and it returned 'got data'

http://www.previewsample.com/auto

===========================
but how do i tie this in with the PHP to return the real results in the current structure of everything?

===============================
here is what the file looks like when it returns all data

http://www.previewsample.com/autoall
======================================


0
 
LVL 39

Expert Comment

by:blue-genie
Comment Utility
ok your php will return the result in some variable format.
i.e. echo $resultStr

then where you got the trace got data you say kwVars.resultStr;
then depending on the format you return it, xml or string you can then split the string or access the result to display as required.
0
 

Author Comment

by:sam928
Comment Utility
@Intersel..

sorry I am not getting anything with your code.. ;(         it did correct the compiler errors though.. but it is not returning results or anything else

@blue genie
the original format that returns ALL the data is a string correct?  

well whatever it is called (sorry i am not good with the correct term and vocabulary)

In the original actionscript (that returns ALL the data) the format was already there for splitting the strings of data.....so.... all we should have to do is add your code that your just gave me and add it into the original actionscript... (changing some variables and instance names and such)  correct?   that way the search data will populate into the existing dynamic fields and movie clips.. Correct?

But what do i delete from the Original actionscript and where do i replace it with the 'Search Code' that you have???

I have attached all of the Original ActionScript below and also the NEW code is there... so the only thing left to do here is combine the two.. Right?      but how?  you have change all the variables and instance names.. i have tried everything that i know and nothing is working.

so please show me how to combine the two codes (yours and the original code) to make it work.



//---------------------------------------------------------------------------------

//YOUR CODE FOR THE SEARCH
 

searchBox.searchBtn.onRelease = function() {

	var searchTerm = searchBox.keyword_txt.text;

	trace("search for "+ searchTerm);

	doKeywordSearch(searchTerm);

}

 

 

function doKeywordSearch(str:String):Void {

	var kwVars:LoadVars = new LoadVars();

	kwVars.searchTerm = str;

	kwVars.action = "loadLatestStories";

	

	kwVars.sendAndLoad("search.php", kwVars ,"POST");

	kwVars.onLoad = function(success) {

		display.text = "got data "

	}

	

}
 

//-----------------------------------------------------------------------------------------------

//ORIGINAL CODE THAT LOADS EVERYTHING
 

function loadLatestStories():Void {

	k = 0;

	news_mc.news_mc.loaderr_mc._visible = true;

	myData.action = "loadLatestStories";

	

	myData.sendAndLoad("scripts/topstory.php", myData, "POST");

}

function fullList(success:Boolean):Void {

	if (!success) {

		loadingMsg_txt.text = "Sorry, database unavailable";

	} else {

		processResults(myData);

	}

}

function processResults(theTarget:LoadVars):Void {

	ticker_mc.ticker_mc.ticker_mc.gotoAndPlay(2);

	var total:Number = theTarget.total;

	if (theTarget.error != undefined) {

		loadingMsg_txt.text = theTarget.error;

		theTarget.error = undefined;

	} else if (total == 0) {

		loadingMsg_txt.text = "No records found";

	} else {

		stories.length = 0;

		for (var i:Number = 0; i<total; i++) {

			// create a new object for each database record

			stories[i] = new Object();

			// assign properties to object representing individual record

			stories[i].story_ID = theTarget["story_ID"+i];

			stories[i].story_title = theTarget["story_title"+i];

			stories[i].story_body = theTarget["story_body"+i];

			stories[i].story_city = theTarget["story_city"+i];

			stories[i].story_highway = theTarget["story_highway"+i];

			

			stories[i].story_details = theTarget["story_details"+i];

			stories[i].story_postedby = theTarget["story_postedby"+i];

			stories[i].story_photo = theTarget["story_photo"+i];

			stories[i].story_date = theTarget["story_date"+i];

			stories[i].story_link = theTarget["story_link"+i];

			stories[i].story_price = theTarget["story_price"+i];

			stories[i].story_specs = theTarget["story_specs"+i];

			stories[i].story_specs2 = theTarget["story_specs2"+i];

		}

	}

	getSal();

	populatestorybuttons();

	fadeinbuttonone();

}

//

//

function getSal() {

	sal = stories.length;

	trace("SAL = "+sal);

}

//

//

function populatestorybuttons() {

	if (sal>=(k+1)) {

		news_mc.news_mc.storybutton1_mc._visible = true;

		news_mc.news_mc.storybutton1_mc.button_mc.date_txt.htmlText = stories[0+k].story_date;

		news_mc.news_mc.storybutton1_mc.button_mc.title_txt.htmlText = stories[0+k].story_title;

		news_mc.news_mc.storybutton1_mc.button_mc.price_txt.htmlText = stories[0+k].story_price;

		news_mc.news_mc.storybutton1_mc.button_mc.details_txt.htmlText = stories[0+k].story_details;

		news_mc.news_mc.storybutton1_mc.button_mc.city_txt.htmlText = stories[0+k].story_city;

		news_mc.news_mc.storybutton1_mc.button_mc.highway_txt.htmlText = stories[0+k].story_highway;

		

		news_mc.news_mc.storybutton1_mc.button_mc.picholder_mc.pic_mc.loadMovie(_global.imageDir+stories[0+k].story_photo);

	} else {

		news_mc.news_mc.storybutton1_mc._visible = false;

		news_mc.news_mc.storybutton1_mc.button_mc.readmore_mc.enabled = false;

		//make buttons invisible here

	}

	if (sal>=(k+2)) {

		news_mc.news_mc.storybutton2_mc._visible = true;

		news_mc.news_mc.storybutton2_mc.button_mc.date_txt.htmlText = stories[1+k].story_date;

		news_mc.news_mc.storybutton2_mc.button_mc.title_txt.htmlText = stories[1+k].story_title;

		news_mc.news_mc.storybutton2_mc.button_mc.price_txt.htmlText = stories[1+k].story_price;

		news_mc.news_mc.storybutton2_mc.button_mc.details_txt.htmlText = stories[1+k].story_details;

		news_mc.news_mc.storybutton2_mc.button_mc.city_txt.htmlText = stories[1+k].story_city;

		news_mc.news_mc.storybutton2_mc.button_mc.highway_txt.htmlText = stories[1+k].story_highway;

		

		news_mc.news_mc.storybutton2_mc.button_mc.picholder_mc.pic_mc.loadMovie(_global.imageDir+stories[1+k].story_photo);

	} else {

		news_mc.news_mc.storybutton2_mc._visible = false;

		news_mc.news_mc.storybutton2_mc.button_mc.readmore_mc.enabled = false;

		//make buttons invisible here

	}

	if (sal>=(k+3)) {

		news_mc.news_mc.storybutton3_mc._visible = true;

		news_mc.news_mc.storybutton3_mc.button_mc.date_txt.htmlText = stories[2+k].story_date;

		news_mc.news_mc.storybutton3_mc.button_mc.title_txt.htmlText = stories[2+k].story_title;

		news_mc.news_mc.storybutton3_mc.button_mc.price_txt.htmlText = stories[2+k].story_price;

		news_mc.news_mc.storybutton3_mc.button_mc.details_txt.htmlText = stories[2+k].story_details;

		news_mc.news_mc.storybutton3_mc.button_mc.city_txt.htmlText = stories[2+k].story_city;

		news_mc.news_mc.storybutton3_mc.button_mc.highway_txt.htmlText = stories[2+k].story_highway;

		

		news_mc.news_mc.storybutton3_mc.button_mc.picholder_mc.pic_mc.loadMovie(_global.imageDir+stories[2+k].story_photo);

	} else {

		news_mc.news_mc.storybutton3_mc._visible = false;

		news_mc.news_mc.storybutton3_mc.button_mc.readmore_mc.enabled = false;

		//make buttons invisible here

	}

	if (sal>=(k+4)) {

		news_mc.news_mc.storybutton4_mc._visible = true;

		news_mc.news_mc.storybutton4_mc.button_mc.date_txt.htmlText = stories[3+k].story_date;

		news_mc.news_mc.storybutton4_mc.button_mc.title_txt.htmlText = stories[3+k].story_title;

		news_mc.news_mc.storybutton4_mc.button_mc.price_txt.htmlText = stories[3+k].story_price;

		news_mc.news_mc.storybutton4_mc.button_mc.details_txt.htmlText = stories[3+k].story_details;

		news_mc.news_mc.storybutton4_mc.button_mc.city_txt.htmlText = stories[3+k].story_city;

		news_mc.news_mc.storybutton4_mc.button_mc.highway_txt.htmlText = stories[3+k].story_highway;

		

		news_mc.news_mc.storybutton4_mc.button_mc.picholder_mc.pic_mc.loadMovie(_global.imageDir+stories[3+k].story_photo);

	} else {

		news_mc.news_mc.storybutton4_mc._visible = false;

		news_mc.news_mc.storybutton4_mc.button_mc.readmore_mc.enabled = false;

		//make buttons invisible here

	}

	

	if (sal>=(k+5)) {

		news_mc.news_mc.storybutton5_mc._visible = true;

		news_mc.news_mc.storybutton5_mc.button_mc.date_txt.htmlText = stories[4+k].story_date;

		news_mc.news_mc.storybutton5_mc.button_mc.title_txt.htmlText = stories[4+k].story_title;

		news_mc.news_mc.storybutton5_mc.button_mc.price_txt.htmlText = stories[4+k].story_price;

		news_mc.news_mc.storybutton5_mc.button_mc.details_txt.htmlText = stories[4+k].story_details;

		news_mc.news_mc.storybutton5_mc.button_mc.city_txt.htmlText = stories[4+k].story_city;

		news_mc.news_mc.storybutton5_mc.button_mc.highway_txt.htmlText = stories[4+k].story_highway;

		

		news_mc.news_mc.storybutton5_mc.button_mc.picholder_mc.pic_mc.loadMovie(_global.imageDir+stories[4+k].story_photo);

	} else {

		news_mc.news_mc.storybutton5_mc._visible = false;

		news_mc.news_mc.storybutton5_mc.button_mc.readmore_mc.enabled = false;

		//make buttons invisible here

	}

	

	if (sal>=(k+6)) {

		news_mc.news_mc.storybutton6_mc._visible = true;

		news_mc.news_mc.storybutton6_mc.button_mc.date_txt.htmlText = stories[5+k].story_date;

		news_mc.news_mc.storybutton6_mc.button_mc.title_txt.htmlText = stories[5+k].story_title;

		news_mc.news_mc.storybutton6_mc.button_mc.price_txt.htmlText = stories[5+k].story_price;

		news_mc.news_mc.storybutton6_mc.button_mc.details_txt.htmlText = stories[5+k].story_details;

		news_mc.news_mc.storybutton6_mc.button_mc.city_txt.htmlText = stories[5+k].story_city;

		news_mc.news_mc.storybutton6_mc.button_mc.highway_txt.htmlText = stories[5+k].story_highway;

		

		news_mc.news_mc.storybutton6_mc.button_mc.picholder_mc.pic_mc.loadMovie(_global.imageDir+stories[5+k].story_photo);

	} else {

		news_mc.news_mc.storybutton6_mc._visible = false;

		news_mc.news_mc.storybutton6_mc.button_mc.readmore_mc.enabled = false;

		//make buttons invisible here

	}

	

	if (sal>=(k+7)) {

		news_mc.news_mc.storybutton7_mc._visible = true;

		news_mc.news_mc.storybutton7_mc.button_mc.date_txt.htmlText = stories[6+k].story_date;

		news_mc.news_mc.storybutton7_mc.button_mc.title_txt.htmlText = stories[6+k].story_title;

		news_mc.news_mc.storybutton7_mc.button_mc.price_txt.htmlText = stories[6+k].story_price;

		news_mc.news_mc.storybutton7_mc.button_mc.details_txt.htmlText = stories[6+k].story_details;

		news_mc.news_mc.storybutton7_mc.button_mc.city_txt.htmlText = stories[6+k].story_city;

		news_mc.news_mc.storybutton7_mc.button_mc.highway_txt.htmlText = stories[6+k].story_highway;

		

		news_mc.news_mc.storybutton7_mc.button_mc.picholder_mc.pic_mc.loadMovie(_global.imageDir+stories[6+k].story_photo);

	} else {

		news_mc.news_mc.storybutton7_mc._visible = false;

		news_mc.news_mc.storybutton7_mc.button_mc.readmore_mc.enabled = false;

		//make buttons invisible here

	}

	

	if (sal>=(k+8)) {

		news_mc.news_mc.storybutton8_mc._visible = true;

		news_mc.news_mc.storybutton8_mc.button_mc.date_txt.htmlText = stories[7+k].story_date;

		news_mc.news_mc.storybutton8_mc.button_mc.title_txt.htmlText = stories[7+k].story_title;

		news_mc.news_mc.storybutton8_mc.button_mc.price_txt.htmlText = stories[7+k].story_price;

		news_mc.news_mc.storybutton8_mc.button_mc.details_txt.htmlText = stories[7+k].story_details;

		news_mc.news_mc.storybutton8_mc.button_mc.city_txt.htmlText = stories[7+k].story_city;

		news_mc.news_mc.storybutton8_mc.button_mc.highway_txt.htmlText = stories[7+k].story_highway;

		

		news_mc.news_mc.storybutton8_mc.button_mc.picholder_mc.pic_mc.loadMovie(_global.imageDir+stories[7+k].story_photo);

	} else {

		news_mc.news_mc.storybutton8_mc._visible = false;

		news_mc.news_mc.storybutton8_mc.button_mc.readmore_mc.enabled = false;

		//make buttons invisible here

	}

	

	if (sal>=(k+9)) {

		news_mc.news_mc.storybutton9_mc._visible = true;

		news_mc.news_mc.storybutton9_mc.button_mc.date_txt.htmlText = stories[8+k].story_date;

		news_mc.news_mc.storybutton9_mc.button_mc.title_txt.htmlText = stories[8+k].story_title;

		news_mc.news_mc.storybutton9_mc.button_mc.price_txt.htmlText = stories[8+k].story_price;

		news_mc.news_mc.storybutton9_mc.button_mc.details_txt.htmlText = stories[8+k].story_details;

		news_mc.news_mc.storybutton9_mc.button_mc.city_txt.htmlText = stories[8+k].story_city;

		news_mc.news_mc.storybutton9_mc.button_mc.highway_txt.htmlText = stories[8+k].story_highway;

		

		news_mc.news_mc.storybutton9_mc.button_mc.picholder_mc.pic_mc.loadMovie(_global.imageDir+stories[8+k].story_photo);

	} else {

		news_mc.news_mc.storybutton9_mc._visible = false;

		news_mc.news_mc.storybutton9_mc.button_mc.readmore_mc.enabled = false;

		//make buttons invisible here

	}

	

	if (sal>=(k+10)) {

		news_mc.news_mc.storybutton10_mc._visible = true;

		news_mc.news_mc.storybutton10_mc.button_mc.date_txt.htmlText = stories[9+k].story_date;

		news_mc.news_mc.storybutton10_mc.button_mc.title_txt.htmlText = stories[9+k].story_title;

		news_mc.news_mc.storybutton10_mc.button_mc.price_txt.htmlText = stories[9+k].story_price;

		news_mc.news_mc.storybutton10_mc.button_mc.details_txt.htmlText = stories[9+k].story_details;

		news_mc.news_mc.storybutton10_mc.button_mc.city_txt.htmlText = stories[9+k].story_city;

		news_mc.news_mc.storybutton10_mc.button_mc.highway_txt.htmlText = stories[9+k].story_highway;

		

		news_mc.news_mc.storybutton10_mc.button_mc.picholder_mc.pic_mc.loadMovie(_global.imageDir+stories[9+k].story_photo);

		_global.endnews = false;

	} else {

		news_mc.news_mc.storybutton10_mc._visible = false;

		news_mc.news_mc.storybutton10_mc.button_mc.readmore_mc.enabled = false;

		_global.endnews = true;

		//make buttons invisible here

	}

	if(_global.endnews == true) {

			ticker_mc.ticker_mc.ticker_mc.info_mc.info_txt.text = "Posts "+(k+1)+" - "+ sal +" of "+ sal;

		} else {

			ticker_mc.ticker_mc.ticker_mc.info_mc.info_txt.text = "Posts "+(k+1)+" - "+(k+10)+" of "+ sal;

		}

}

//

_global.endnews = false;

//

//

//

_global.loggedin = false;

//

//

//

//

news_mc.news_mc.info_mc.post_mc._visible = false;

news_mc.news_mc.info_mc.new_mc._visible = false;

news_mc.news_mc.info_mc.logout_mc._visible = false;

news_mc.news_mc.info_mc.delete_mc._visible = false;

news_mc.news_mc.info_mc.update_mc._visible = false;

function loadcontent(storynumber) {

	if (_global.loggedin == true) {

		news_mc.news_mc.main_mc.gotoAndStop(2);

		news_mc.news_mc.main_mc.change_mc._visible = true;

		news_mc.news_mc.info_mc.delete_mc._visible = true;

		news_mc.news_mc.info_mc.update_mc._visible = true;

		_global.storytodeditordel = stories[storynumber+k].story_ID;

		trace("STORY_ID= " + _global.storytodeditordel);

		news_mc.news_mc.main_mc.date_txt.text = stories[storynumber+k].story_date;

		news_mc.news_mc.main_mc.title_txt.text = stories[storynumber+k].story_title;

		news_mc.news_mc.main_mc.details_txt.text = stories[storynumber+k].story_details;

		news_mc.news_mc.main_mc.price_txt.text = stories[storynumber+k].story_price;

		news_mc.news_mc.main_mc.specs_txt.text = stories[storynumber+k].story_specs;

		news_mc.news_mc.main_mc.specs2_txt.text = stories[storynumber+k].story_specs2;

		news_mc.news_mc.main_mc.city_txt.text = stories[storynumber+k].story_city;

		news_mc.news_mc.main_mc.highway_txt.text = stories[storynumber+k].story_highway;

		

		news_mc.news_mc.main_mc.author_txt.text = stories[storynumber+k].story_postedby;

		news_mc.news_mc.main_mc.story_txt.text = stories[storynumber+k].story_body;

		

		news_mc.news_mc.main_mc.pic_mc.loadMovie(_global.imageDir+stories[storynumber+k].story_photo);

		_global.urllink = stories[storynumber+k].story_link;

		news_mc.news_mc.main_mc.url_txt.text = _global.urllink;

		news_mc.news_mc.main_mc.link_mc._visible = true;

		news_mc.news_mc.main_mc.back_mc._visible = true;

		news_mc.news_mc.main_mc.browse_mc._visible = false;

		news_mc.news_mc.main_mc.upload_mc._visible = false;

		news_mc.news_mc.info_mc.post_mc._visible = false;

		ticker_mc.ticker_mc.ticker_mc.info_mc.info_txt.text = "Viewing Post "+(storynumber+k+1)+ " of "+ sal;

	} else {

		news_mc.news_mc.main_mc.gotoAndStop(1);

		news_mc.news_mc.main_mc.change_mc._visible = false;

		news_mc.news_mc.info_mc.delete_mc._visible = false;

		news_mc.news_mc.info_mc.update_mc._visible = false;

		_global.storytoeditordel = stories[storynumber+k].story_ID;

		news_mc.news_mc.main_mc.date_txt.htmlText = stories[storynumber+k].story_date;

		news_mc.news_mc.main_mc.title_txt.htmlText = stories[storynumber+k].story_title;

		news_mc.news_mc.main_mc.details_txt.htmlText = stories[storynumber+k].story_details;

		news_mc.news_mc.main_mc.price_txt.htmlText = stories[storynumber+k].story_price;

		news_mc.news_mc.main_mc.specs_txt.htmlText = stories[storynumber+k].story_specs;

		news_mc.news_mc.main_mc.specs2_txt.htmlText = stories[storynumber+k].story_specs2;

		news_mc.news_mc.main_mc.city_txt.htmlText = stories[storynumber+k].story_city;

		news_mc.news_mc.main_mc.highway_txt.htmlText = stories[storynumber+k].story_highway;

		

		news_mc.news_mc.main_mc.author_txt.htmlText = stories[storynumber+k].story_postedby;

		

		news_mc.news_mc.main_mc.story_txt.htmlText = stories[storynumber+k].story_body+"<br><br>";

		news_mc.news_mc.main_mc.pic_mc.loadMovie(_global.imageDir+stories[storynumber+k].story_photo);

		_global.urllink = stories[storynumber+k].story_link;

		news_mc.news_mc.main_mc.link_mc._visible = true;

		news_mc.news_mc.main_mc.back_mc._visible = true;

		news_mc.news_mc.main_mc.browse_mc._visible = false;

		news_mc.news_mc.main_mc.upload_mc._visible = false;

		news_mc.news_mc.info_mc.post_mc._visible = false;

		ticker_mc.ticker_mc.ticker_mc.info_mc.info_txt.text = "Viewing Post "+(storynumber+k+1) +" of "+ sal;

	}

}

var storyloaded:Number = new Number();

news_mc.news_mc.storybutton1_mc.button_mc.readmore_mc.onRelease = function() {

	_global.viewing = true

	disablebuttons();

	_global.actionis = "more";

	fadeoutbuttonone();

	storyloaded = (k+0);

	loadcontent(0);

	getURL("javascript:resetScroller()");

};

news_mc.news_mc.storybutton2_mc.button_mc.readmore_mc.onRelease = function() {

	_global.viewing = true

	disablebuttons();

	_global.actionis = "more";

	fadeoutbuttonone();

	storyloaded = (k+1);

	loadcontent(1);

	getURL("javascript:resetScroller()");

};

news_mc.news_mc.storybutton3_mc.button_mc.readmore_mc.onRelease = function() {

	_global.viewing = true

	disablebuttons();

	_global.actionis = "more";

	fadeoutbuttonone();

	storyloaded = (k+2);

	loadcontent(2);

	getURL("javascript:resetScroller()");

};

news_mc.news_mc.storybutton4_mc.button_mc.readmore_mc.onRelease = function() {

	_global.viewing = true

	disablebuttons();

	_global.actionis = "more";

	fadeoutbuttonone();

	storyloaded = (k+3);

	loadcontent(3);

	getURL("javascript:resetScroller()");

};
 

news_mc.news_mc.storybutton5_mc.button_mc.readmore_mc.onRelease = function() {

	_global.viewing = true

	disablebuttons();

	_global.actionis = "more";

	fadeoutbuttonone();

	storyloaded = (k+4);

	loadcontent(4);

	getURL("javascript:resetScroller()");

};
 
 

news_mc.news_mc.storybutton6_mc.button_mc.readmore_mc.onRelease = function() {

	_global.viewing = true

	disablebuttons();

	_global.actionis = "more";

	fadeoutbuttonone();

	storyloaded = (k+5);

	loadcontent(5);

	getURL("javascript:resetScroller()");

};
 
 

news_mc.news_mc.storybutton7_mc.button_mc.readmore_mc.onRelease = function() {

	_global.viewing = true

	disablebuttons();

	_global.actionis = "more";

	fadeoutbuttonone();

	storyloaded = (k+6);

	loadcontent(6);

	getURL("javascript:resetScroller()");

};
 

news_mc.news_mc.storybutton8_mc.button_mc.readmore_mc.onRelease = function() {

	_global.viewing = true

	disablebuttons();

	_global.actionis = "more";

	fadeoutbuttonone();

	storyloaded = (k+7);

	loadcontent(7);

	getURL("javascript:resetScroller()");

};
 

news_mc.news_mc.storybutton9_mc.button_mc.readmore_mc.onRelease = function() {

	_global.viewing = true

	disablebuttons();

	_global.actionis = "more";

	fadeoutbuttonone();

	storyloaded = (k+8);

	loadcontent(8);

	getURL("javascript:resetScroller()");

}

	

news_mc.news_mc.storybutton10_mc.button_mc.readmore_mc.onRelease = function() {

	_global.viewing = true

	disablebuttons();

	_global.actionis = "more";

	fadeoutbuttonone();

	storyloaded = (k+9);

	loadcontent(9);

	getURL("javascript:resetScroller()");

};

//

//

// next buttons

function nextback() {

	disBakBtn();

	disNxtBtn();

}

function disBakBtn() {

	if (k<=9) {

		news_mc.news_mc.info_mc.prev_mc._visible = false;

		news_mc.news_mc.info_mc.prev_mc.enabled = false;

	}

	if (k>=10) {

		news_mc.news_mc.info_mc.prev_mc._visible = true;

		news_mc.news_mc.info_mc.prev_mc.enabled = true;

	}

}

function disNxtBtn() {

	if ((k+10)>=sal) {

		news_mc.news_mc.info_mc.next_mc._visible = false;

		news_mc.news_mc.info_mc.next_mc.enabled = false;

	}

	if ((k+11)<=(sal)) {

		news_mc.news_mc.info_mc.next_mc._visible = true;

		news_mc.news_mc.info_mc.next_mc.enabled = true;

	}

}

news_mc.news_mc.info_mc.next_mc.onRelease = function() {

	disablebuttons();

	_global.actionis = "next";

	fadeoutbuttonone();

	getURL("javascript:resetScroller()");

};

news_mc.news_mc.info_mc.prev_mc.onRelease = function() {

	disablebuttons();

	_global.actionis = "prev";

	fadeoutbuttonone();

	getURL("javascript:resetScroller()");

};

// read more buttons

// fades

news_mc.news_mc.storybutton1_mc._alpha = 0;

news_mc.news_mc.storybutton2_mc._alpha = 0;

news_mc.news_mc.storybutton3_mc._alpha = 0;

news_mc.news_mc.storybutton4_mc._alpha = 0;

news_mc.news_mc.storybutton5_mc._alpha = 0;

news_mc.news_mc.storybutton6_mc._alpha = 0;

news_mc.news_mc.storybutton7_mc._alpha = 0;

news_mc.news_mc.storybutton8_mc._alpha = 0;

news_mc.news_mc.storybutton9_mc._alpha = 0;

news_mc.news_mc.storybutton10_mc._alpha = 0;

function fadeinbuttonone() {

	news_mc.news_mc.loaderr_mc._visible = false;

	news_mc.news_mc.storybutton1_mc.onEnterFrame = function() {

		disablebuttons();

		if (news_mc.news_mc.storybutton1_mc._alpha<=99) {

			news_mc.news_mc.storybutton1_mc._alpha += 20;

			if (news_mc.news_mc.storybutton1_mc._alpha>=30) {

				fadeinbuttontwo();

			}

		} else {

			news_mc.news_mc.storybutton1_mc._alpha = 100;

			delete news_mc.news_mc.storybutton1_mc.onEnterFrame;

		}

	};

}

function fadeinbuttontwo() {

	news_mc.news_mc.storybutton2_mc.onEnterFrame = function() {

		disablebuttons();

		if (news_mc.news_mc.storybutton2_mc._alpha<=99) {

			news_mc.news_mc.storybutton2_mc._alpha += 20;

			if (news_mc.news_mc.storybutton2_mc._alpha>=30) {

				fadeinbuttonthree();

			}

		} else {

			news_mc.news_mc.storybutton2_mc._alpha = 100;

			delete news_mc.news_mc.storybutton2_mc.onEnterFrame;

		}

	};

}

function fadeinbuttonthree() {

	news_mc.news_mc.storybutton3_mc.onEnterFrame = function() {

		disablebuttons();

		if (news_mc.news_mc.storybutton3_mc._alpha<=99) {

			news_mc.news_mc.storybutton3_mc._alpha += 20;

			if (news_mc.news_mc.storybutton3_mc._alpha>=30) {

				fadeinbuttonfour();

			}

		} else {

			news_mc.news_mc.storybutton3_mc._alpha = 100;

			delete news_mc.news_mc.storybutton3_mc.onEnterFrame;

		}

	};

}

function fadeinbuttonfour() {

	news_mc.news_mc.storybutton4_mc.onEnterFrame = function() {

		disablebuttons();

		if (news_mc.news_mc.storybutton4_mc._alpha<=99) {

			news_mc.news_mc.storybutton4_mc._alpha += 20;

			if (news_mc.news_mc.storybutton4_mc._alpha>=30) {

				fadeinbuttonfive();

			}

		} else {

			news_mc.news_mc.storybutton4_mc._alpha = 100;

			delete news_mc.news_mc.storybutton4_mc.onEnterFrame;

		}

	};

}
 

function fadeinbuttonfive() {

	news_mc.news_mc.storybutton5_mc.onEnterFrame = function() {

		disablebuttons();

		if (news_mc.news_mc.storybutton5_mc._alpha<=99) {

			news_mc.news_mc.storybutton5_mc._alpha += 20;

			if (news_mc.news_mc.storybutton5_mc._alpha>=30) {

				fadeinbuttonsix();

			}

		} else {

			news_mc.news_mc.storybutton5_mc._alpha = 100;

			delete news_mc.news_mc.storybutton5_mc.onEnterFrame;

		}

	};

}
 
 

function fadeinbuttonsix() {

	news_mc.news_mc.storybutton6_mc.onEnterFrame = function() {

		disablebuttons();

		if (news_mc.news_mc.storybutton6_mc._alpha<=99) {

			news_mc.news_mc.storybutton6_mc._alpha += 20;

			if (news_mc.news_mc.storybutton6_mc._alpha>=30) {

				fadeinbuttonseven();

			}

		} else {

			news_mc.news_mc.storybutton6_mc._alpha = 100;

			delete news_mc.news_mc.storybutton6_mc.onEnterFrame;

		}

	};

}
 

function fadeinbuttonseven() {

	news_mc.news_mc.storybutton7_mc.onEnterFrame = function() {

		disablebuttons();

		if (news_mc.news_mc.storybutton7_mc._alpha<=99) {

			news_mc.news_mc.storybutton7_mc._alpha += 20;

			if (news_mc.news_mc.storybutton7_mc._alpha>=30) {

				fadeinbuttoneight();

			}

		} else {

			news_mc.news_mc.storybutton7_mc._alpha = 100;

			delete news_mc.news_mc.storybutton7_mc.onEnterFrame;

		}

	};

}
 

function fadeinbuttoneight() {

	news_mc.news_mc.storybutton8_mc.onEnterFrame = function() {

		disablebuttons();

		if (news_mc.news_mc.storybutton8_mc._alpha<=99) {

			news_mc.news_mc.storybutton8_mc._alpha += 20;

			if (news_mc.news_mc.storybutton8_mc._alpha>=30) {

				fadeinbuttonnine();

			}

		} else {

			news_mc.news_mc.storybutton8_mc._alpha = 100;

			delete news_mc.news_mc.storybutton8_mc.onEnterFrame;

		}

	};

}
 

function fadeinbuttonnine() {

	news_mc.news_mc.storybutton9_mc.onEnterFrame = function() {

		disablebuttons();

		if (news_mc.news_mc.storybutton9_mc._alpha<=99) {

			news_mc.news_mc.storybutton9_mc._alpha += 20;

			if (news_mc.news_mc.storybutton9_mc._alpha>=30) {

				fadeinbuttonten();

			}

		} else {

			news_mc.news_mc.storybutton9_mc._alpha = 100;

			delete news_mc.news_mc.storybutton9_mc.onEnterFrame;

		}

	};

}
 

function fadeinbuttonten() {

	news_mc.news_mc.storybutton10_mc.onEnterFrame = function() {

		disablebuttons();

		if (news_mc.news_mc.storybutton10_mc._alpha<=99) {

			news_mc.news_mc.storybutton10_mc._alpha += 20;

		} else {

			news_mc.news_mc.storybutton10_mc._alpha = 100;

			delete news_mc.news_mc.storybutton10_mc.onEnterFrame;

			enablebuttons();

			nextback();

		}

	};

}

function fadeoutbuttonone() {

	news_mc.news_mc.storybutton1_mc.onEnterFrame = function() {

		disablebuttons();

		if (news_mc.news_mc.storybutton1_mc._alpha>=1) {

			news_mc.news_mc.storybutton1_mc._alpha -= 20;

			if (news_mc.news_mc.storybutton1_mc._alpha<=60) {

				fadeoutbuttontwo();

			}

		} else {

			news_mc.news_mc.storybutton1_mc._alpha = 0;

			delete news_mc.news_mc.storybutton1_mc.onEnterFrame;

		}

	};

}

function fadeoutbuttontwo() {

	news_mc.news_mc.storybutton2_mc.onEnterFrame = function() {

		disablebuttons();

		if (news_mc.news_mc.storybutton2_mc._alpha>=1) {

			news_mc.news_mc.storybutton2_mc._alpha -= 20;

			if (news_mc.news_mc.storybutton2_mc._alpha<=60) {

				fadeoutbuttonthree();

			}

		} else {

			news_mc.news_mc.storybutton2_mc._alpha = 0;

			delete news_mc.news_mc.storybutton2_mc.onEnterFrame;

		}

	};

}

function fadeoutbuttonthree() {

	news_mc.news_mc.storybutton3_mc.onEnterFrame = function() {

		disablebuttons();

		if (news_mc.news_mc.storybutton3_mc._alpha>=1) {

			news_mc.news_mc.storybutton3_mc._alpha -= 20;

			if (news_mc.news_mc.storybutton3_mc._alpha<=60) {

				fadeoutbuttonfour();

			}

		} else {

			news_mc.news_mc.storybutton3_mc._alpha = 0;

			delete news_mc.news_mc.storybutton3_mc.onEnterFrame;

		}

	};

}

function fadeoutbuttonfour() {

	news_mc.news_mc.storybutton4_mc.onEnterFrame = function() {

		disablebuttons();

		if (news_mc.news_mc.storybutton4_mc._alpha>=1) {

			news_mc.news_mc.storybutton4_mc._alpha -= 20;

			if (news_mc.news_mc.storybutton4_mc._alpha<=60) {

				fadeoutbuttonfive();

			}

		} else {

			news_mc.news_mc.storybutton4_mc._alpha = 0;

			delete news_mc.news_mc.storybutton4_mc.onEnterFrame;

		}

	};

}
 

function fadeoutbuttonfive() {

	news_mc.news_mc.storybutton5_mc.onEnterFrame = function() {

		disablebuttons();

		if (news_mc.news_mc.storybutton5_mc._alpha>=1) {

			news_mc.news_mc.storybutton5_mc._alpha -= 20;

			if (news_mc.news_mc.storybutton5_mc._alpha<=60) {

				fadeoutbuttonsix();

			}

		} else {

			news_mc.news_mc.storybutton5_mc._alpha = 0;

			delete news_mc.news_mc.storybutton5_mc.onEnterFrame;

		}

	};

}
 

function fadeoutbuttonsix() {

	news_mc.news_mc.storybutton6_mc.onEnterFrame = function() {

		disablebuttons();

		if (news_mc.news_mc.storybutton6_mc._alpha>=1) {

			news_mc.news_mc.storybutton6_mc._alpha -= 20;

			if (news_mc.news_mc.storybutton6_mc._alpha<=60) {

				fadeoutbuttonseven();

			}

		} else {

			news_mc.news_mc.storybutton6_mc._alpha = 0;

			delete news_mc.news_mc.storybutton6_mc.onEnterFrame;

		}

	};

}
 
 

function fadeoutbuttonseven() {

	news_mc.news_mc.storybutton7_mc.onEnterFrame = function() {

		disablebuttons();

		if (news_mc.news_mc.storybutton7_mc._alpha>=1) {

			news_mc.news_mc.storybutton7_mc._alpha -= 20;

			if (news_mc.news_mc.storybutton7_mc._alpha<=60) {

				fadeoutbuttoneight();

			}

		} else {

			news_mc.news_mc.storybutton7_mc._alpha = 0;

			delete news_mc.news_mc.storybutton7_mc.onEnterFrame;

		}

	};

}
 

function fadeoutbuttoneight() {

	news_mc.news_mc.storybutton8_mc.onEnterFrame = function() {

		disablebuttons();

		if (news_mc.news_mc.storybutton8_mc._alpha>=1) {

			news_mc.news_mc.storybutton8_mc._alpha -= 20;

			if (news_mc.news_mc.storybutton8_mc._alpha<=60) {

				fadeoutbuttonnine();

			}

		} else {

			news_mc.news_mc.storybutton8_mc._alpha = 0;

			delete news_mc.news_mc.storybutton8_mc.onEnterFrame;

		}

	};

}
 

function fadeoutbuttonnine() {

	news_mc.news_mc.storybutton9_mc.onEnterFrame = function() {

		disablebuttons();

		if (news_mc.news_mc.storybutton9_mc._alpha>=1) {

			news_mc.news_mc.storybutton9_mc._alpha -= 20;

			if (news_mc.news_mc.storybutton9_mc._alpha<=60) {

				fadeoutbuttonten();

			}

		} else {

			news_mc.news_mc.storybutton9_mc._alpha = 0;

			delete news_mc.news_mc.storybutton9_mc.onEnterFrame;

		}

	};

}
 

function fadeoutbuttonten() {

	news_mc.news_mc.storybutton10_mc.onEnterFrame = function() {

		disablebuttons();

		if (news_mc.news_mc.storybutton10_mc._alpha>=1) {

			news_mc.news_mc.storybutton10_mc._alpha -= 20;

		} else {

			news_mc.news_mc.storybutton10_mc._alpha = 0;

			delete news_mc.news_mc.storybutton10_mc.onEnterFrame;

			dowhatsneeded();

		}

	};

}

news_mc.news_mc.info_mc.next_mc._visible = false;

news_mc.news_mc.info_mc.prev_mc._visible = false;

function dowhatsneeded() {

	if (_global.actionis == "next") {

		news_mc.news_mc.info_mc.next_mc._visible = false;

		news_mc.news_mc.info_mc.prev_mc._visible = false;

		k += 10;

		populatestorybuttons();

		nextback();

		fadeinbuttonone();

		if(_global.endnews == true) {

			ticker_mc.ticker_mc.ticker_mc.info_mc.info_txt.text = "Posts "+(k+1)+" - "+ sal +" of "+ sal;

		} else {

			ticker_mc.ticker_mc.ticker_mc.info_mc.info_txt.text = "Posts "+(k+1)+" - "+(k+10)+" of "+ sal;

		}

	}

	if (_global.actionis == "prev") {

		news_mc.news_mc.info_mc.next_mc._visible = false;

		news_mc.news_mc.info_mc.prev_mc._visible = false;

		k -= 10;

		populatestorybuttons();

		nextback();

		fadeinbuttonone();

		if(_global.endnews == true) {

			ticker_mc.ticker_mc.ticker_mc.info_mc.info_txt.text = "Posts "+(k+1)+" - "+ sal +" of "+ sal;

		} else {

			ticker_mc.ticker_mc.ticker_mc.info_mc.info_txt.text = "Posts "+(k+1)+" - "+(k+10)+" of "+ sal;

		}

	}

	if (_global.actionis == "more") {

		fadeinmain();

	}

}

function fadeinmain() {

	news_mc.news_mc.main_mc._visible = true;

	news_mc.news_mc.info_mc.next_mc._visible = false;

	news_mc.news_mc.info_mc.prev_mc._visible = false;

	news_mc.news_mc.main_mc.onEnterFrame = function() {

		if (news_mc.news_mc.main_mc._alpha<=99) {

			news_mc.news_mc.main_mc._alpha += 20;

		} else {

			news_mc.news_mc.main_mc._alpha = 100;

			delete news_mc.news_mc.main_mc.onEnterFrame;

		}

	};

}

function fadeoutmain() {

	news_mc.news_mc.main_mc.onEnterFrame = function() {

		if (news_mc.news_mc.main_mc._alpha>=1) {

			news_mc.news_mc.main_mc._alpha -= 20;

		} else {

			news_mc.news_mc.main_mc._alpha = 0;

			news_mc.news_mc.main_mc._visible = false;

			fadeinbuttonone();

			nextback();

			delete news_mc.news_mc.main_mc.onEnterFrame;

		}

	};

}

_global.viewing = false;

news_mc.news_mc.main_mc.back_mc.onRelease = function() {

	if(_global.endnews == true) {

			ticker_mc.ticker_mc.ticker_mc.info_mc.info_txt.text = "Posts "+(k+1)+" - "+ sal +" of "+ sal;

		} else {

			ticker_mc.ticker_mc.ticker_mc.info_mc.info_txt.text = "Posts "+(k+1)+" - "+(k+10)+" of "+ sal;

		}

	_global.viewing = false;

	fadeoutmain();

	news_mc.news_mc.info_mc.post_mc._visible = false;

	news_mc.news_mc.info_mc.delete_mc._visible = false;

	news_mc.news_mc.info_mc.update_mc._visible = false;

	news_mc.news_mc.main_mc.browse_mc._visible = false;

	news_mc.news_mc.main_mc.pic_mc._visible = true;

	news_mc.news_mc.main_mc.loader_mc._visible = true;

	news_mc.news_mc.main_mc.note_mc._visible = false;

};
 

news_mc.news_mc.main_mc._visible = false;

news_mc.news_mc.main_mc._alpha = 0;

var myData:LoadVars = new LoadVars();
 

// assign onLoad handlers for LoadVars

myData.onLoad = fullList;

var stories:Array = new Array();

// Event to trigger Php load data

var k:Number = 0;

// story array length

var sal:Number = 0;

// for story ID output

var storyIdVar:Number = 0;

// for story score output

loadLatestStories();

Open in new window

0
 
LVL 39

Assisted Solution

by:blue-genie
blue-genie earned 250 total points
Comment Utility
it will return as as string from the php and you can do whatever you want with it from there.

quite simply which buttons calls the php to search once a keyword is entered is th is bit.

searchBox.searchBtn.onRelease = function() {
      var searchTerm = searchBox.keyword_txt.text;
      trace("search for "+ searchTerm);
      doKeywordSearch(searchTerm);
}

//this function must just be there.
//then where display.text is that's where you must add your code to spit the data.
//if the data is being returned as a variable i.e. $result access it with kwVars.result;
so String(kwVars.result);

or kwVars.result.toString();



function doKeywordSearch(str:String):Void {
      var kwVars:LoadVars = new LoadVars();
      kwVars.searchTerm = str;
      kwVars.action = "loadLatestStories";
      
      kwVars.sendAndLoad("search.php", kwVars ,"POST");
      kwVars.onLoad = function(success) {
            display.text = "got data "
      }
      
0
 

Author Closing Comment

by:sam928
Comment Utility
thank you for both of your help.

I have used a different script but the information was very useful for other things.

cheers!
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now