Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Flash / Data Integration / July 2008



Tip: Looking for answers? Try searching our database.

ASP and FLASH INtegration

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
berti_2001 - 18 Jul 2008 09:30 GMT
Hi Guys and Gals,

Im having a bit of trouble integrating dynamic variables pulled from a databse
using an ASP script with a flash movie.

Background:

I need to send variables stored in a ms sql db to a flash movie to display
several values.

The dyanmic element comes in because i am using an ID to select the values
from the db e.g id1 = joe bloggs id2 = paul smith

etc

When i am hardcoding the id in the asp script the variables are sent to the
flash movie no probs and they display correctly.

I am also printing the asp code on the page and that all displaying fine.

HOWEVER, the issue arises when i make the asp code dynamic and by that i mean
I am using request.querystring to pull the id

from the URL - The print out of the asp code is still displaying the correct
variables, BUT they are not being passed to the

flash movie at all - the placeholder is blank there isn't event an error!!.

Couple of things to note ?

- if you change the id bit of the url in the dynamic script to the printed asp
code changes
- THE FLASH MOVIE IS IDENTIAL in both scenarios
- all variable names have remained the same
- it is NOT a location of file issue as we have tested the dynamic code files
In another folder and no joy
- we are not using any other file includes or asp code in any of the page ?
all other code has been stripped out

THE ISSUE WE HAVE IS THAT THE PRINTED VARIABLES ARE NOT BEING PASSED TO THE
FLASH MOBIE in scenario 2 where the asp code is

looking for the participant id dynamically (i.e from the URL)

Really could do with some help here!!!

Berti_2001
Noelbaland - 19 Jul 2008 04:11 GMT
Hello,

I don't know ASP but I do know PHP.  The concept for printing variables to
send to Flash is the same in any language.  So the idea is to send back to
Flash a string of variables with values that are separated by ampersands and
contain no line breaks.
In PHP, a typical query/result routine would look like this.

// After a successful connection to the server and database
$sql = "SELECT id FROM tableName";
$query = mysql_query($sql) or die(mysql_error());
$i = 1;
while($row = mysql_fetch_row($query)){
echo "id". $id . "=". $row[0] ."&"; // echo is used more often than print
$i++;
}
// Displays id1=Joe Bloggs&id2=Paul Smith&id3=Mary Lamb...etc

Is this how you're printing out your results from your query? If so, then good
thats what it's supposed to look like.

So then in Flash (using Actionscript 2.0), you would load the data using the
LoadVars object.

var lv:LoadVars = new LoadVars();
lv.load("myASP.asp");
lv.onLoad = function(success:Boolean)
{
if(success){
trace(this.loaded) // displays the data string above
} else {
trace("Error");
}
};

Do you have a similar routine in your Flash movie?  If so, then thats good
because LoadVars is the preferred method to load dynamic data into Flash.
 
There is another method to load dynamic data called loadVariables.
e.g. loadVariables("myASP.asp", this));

This does the same thing but doesn't give you much control over the data it's
loading.  If you are using this method then I suggest you switch to the
LoadVars object as it has methods that allow you to test if data has loaded
properly or not.  Also by creating an instance of the LoadVars object you can
access your data easily by using dot notation.  Using the LV object in the
script above you can get the value for id1 like this

lv.id1 // displays Joe Bloggs

If you're publishing and testing your files locally(thru IIS) then when your
SWF window appears go to Debug>List Variables and see if any data is loaded
into Flash.

Thats about all I know.  I hope something in here helps you?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.