Link to home
Start Free TrialLog in
Avatar of zahimezher
zahimezher

asked on

flash drop down menu

I have a website with a cms
In the CMS i can create types( a, b, c)
these types are saved on sql and information can be inserted in each.
a(1, 2, 3)
b(1, 2, 3)
c(1, 2, 3)

in my flash header i have a drop down menu thats supposed to read these types that were created in sql through the cms
I cant creat the drop down menu in advance because my client might add a new type and it has to appear in the menu along side the others that were created so far

n e one?
Avatar of moagrius
moagrius
Flag of United States of America image

you'll probably want to use PHP to grab the contents of the SQL table, then echo or print that out as XML, then load that into Flash using a URLLoader object, then dynamically populate your dropdown.

e.g.,

// php file
<?php
// connect to your server, pick the database
$xml = "<?xml version='1.0' ?>";
$result = mysql_query("select * from table");
while($row = mysql_fetch_assoc($result)){
  $xml .= "<somenode>" . $row["someprop"] . "</somenode>";
  // etc..
}

// actionscript
var loader:URLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, onLoaded);
loader.load(new URLRequest("that-php-file.php"));
function onLoaded(event:Event):void{
  var xml:XML = new XML(event.target.data);
  foreach(var node:XML in xml){
    // do stuff...
  }
}
Avatar of zahimezher
zahimezher

ASKER

do u have an example file or a link to a tutorial or something.
I have no idea how this works and cant make anything of what ...
thanx alot though. sry!
ASKER CERTIFIED SOLUTION
Avatar of moagrius
moagrius
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
;) thanx for the help