[quoted text, click to view] >>Maybe write an asp.net web page to generate data in xml formate and let
>>flash read it?
That is one way. You could also have the asp page just return the data to
flash directly, sidestepping xml. Have a look at the LoadVars class,
specifically it's sendAndLoad method which has an example of sending data to
a cold fusion script, but it's no different for ASP or PHP.
Say you wanted to get the water levels for some date range. In Flash write a
function like so:
var allWater:Array = new Array();
function getWaterLevels(fromDate:String, toDate:String){
var recv = new LoadVars();
var snd = new LoadVars();
recv.onLoad = function(success) {
if(success){
allWater = [];
var ind = 1;
while(this["id" + ind]){
var curWater = [];
curWater.push(this["id" + ind]);
curWater.push(this["date" + ind]);
curWater.push(this["level" + ind]);
allWater.push(curWater);
ind++;
}
}
}
snd.start_date = fromDate;
snd.end_date = toDate;
snd.sendAndLoad("
http://domain.com/scripts/getwater.php", newsR);
}
I use PHP so you'll have to adapt, but you'd do something like so:
<?PHP
$connection = mysql_connect("localhost", "dbuser", "dbpassword");
mysql_select_db("databaseName", $connection);
$sql = "SELECT id,thedate,level FROM watertable WHERE thedate BETWEEN
'$_POST[start_date]' AND '$_POST[end_date]'";
$result = mysql_query($sql, $connection);
$rString = "";
$row = mysql_fetch_array($result);
$ind = 1;
while ($row){
$rString .= "&id$ind=".$row["id"];
$rString .= "&date$ind=".$row["thedate"];
$rString .= "&level$ind=".$row["level"];
$row = mysql_fetch_array($result);
$ind++;
}
exit($rString);
?>
Hopefully, that'll get you going. It's untested, but I modified some known
working code to give you an example you could relate to.
So, you have the data in Flash now, how to animate it... You can use Flash's
drawing API to create vector shapes on the fly. You could simply move a
shape up and down according to the data, etc...a few ways you could approach
this.
--
Dave -
Head Developer
www.blurredistinction.com Adobe Community Expert
http://www.adobe.com/communities/experts/