mysql - How write the values from the database into an array in Flash Builder 4 -
i want display multiple images , when rollover above must tooltips (names). same names in database mysql. naturally, tooltips displayed without delay, preferably put names database array , manipulate them. tell me please wrong?
php class connect database:
public function getdatamean($id,$dir_id) { $mysql = mysql_connect(database_server, database_username, database_password); mysql_query("set names 'utf8';"); mysql_query("set character set 'utf8';"); mysql_query("set session collation_connection = 'utf8_general_ci';"); mysql_select_db(database_name); $query = "select name files id='".$id."' , dir_id='".$dir_id."'"; $result = mysql_query($query); return $result; }
fb4 code:
public var names:array = new array(); public var textname:string; protected function decks_clickhandler(event:mouseevent):void { arrayofnumber = new array(); generatearray(mincount,maxcount); randomize(arrayofnumber); var dir_id:int = 7; card1.source = "http://***/gallery/7/"+string(arrayofnumber[0])+".jpg"; card2.source = "http://***/gallery/7/"+string(arrayofnumber[1])+".jpg"; card3.source = "http://***/gallery/7/"+string(arrayofnumber[2])+".jpg"; (var i:int=0; i<4; i++){ getdatameanresult.token = authors.getdatamean(arrayofnumber[i], dir_id); names[i] = getdatameanresult.lastresult[0].name; } } ]]> </fx:script>
it's bit hard see code. understood; have cards in id each, , want grab matching data array when ever user interacts card? - correct?
if case want use associative array instead. in as3 use instance of oject class associative array (yes seem bit wierd). maybe should rewrite code declaring names object instead of array.
with being said can see 1 other problem code, write names[i] = ...
, have not declared size of array (or maybe generatearray
function does?). try using names.push(getdatameanresult.lastresult[0].name)
instead.
Comments
Post a Comment