Link to home
Start Free TrialLog in
Avatar of gindala
gindala

asked on

Combo box populated by ASP, how?

I need to display a list of countries generated by an ASP file in a flash combo box. First of all, I'm having a hard time finding any information on how to access the combo box properties. Does anyone have any idea I will do this? If the user clicks on the country then it should send through a variable back to the ASP file that will display that countries' information. My biggest problem is how I will get the combo box to list the countries generated by the ASP and how I will embed the variables into each combo entry that will call the ASP when it's clicked. Thanks a lot!
Avatar of coopa
coopa

This is not a solution, but just may help.

As far as i know there is no method of getting information from an asp into flash... however it maybe possible by getting the asp to generate the <object> code and pass extra parameters into the movie.

I do know that the easiest way to get data into flash is via the load variables command.

Can you not get your asp to generate a text file with all of the options that will populate the combo box ?
obviously this will only work for single user systems, as the text file will be overwritten... okay bad idea...

Avatar of gindala

ASKER

no i can pull that data from an ASP file into a Flash document, and into text fields, but not into the combo box.
All you need to be able to do is populate an "array" of variables with your ASP data (easily done with Load Variables) and then create as many combo box items as there are "elements" of your "array."

Note the quotations: Arrays in Flash are really not arrays at all, but rather a variable-naming trick similar to real arrays. Let me know if you need an example.

-Dan
Avatar of gindala

ASKER

If you could give me a working example I would apprecaite it!
I'll work on one for you this morning (using a text file, not ASP... but it will still illustrate dynamic filling).

Here's what you need to know in the meantime.

First off, hypothetically, ASP has generated a string similar to this:

c1=Albania&c2=Argentina&c3=Bolivia&elements=3

You're going to load that into your Flash movie, so now you have three variables named c1, c2, and c3, and one variable telling you how many elements you have.

Now when you refer, call, or change these variables in a loop process, you refer to them like this:

Set Variable: "c" & numCounter = newValue

See? The c and the current loop number are concatenated to actually form the variable name. So, if you wanted to nullify all fields in an array called a(n) with 12 elements (the 12 is held in a value called elements) you would use tthis code snippet in your Flash Actions:

Set Variable: "numCount" = "0"
Loop While (numCount < elements)
      Set Variable: "a" & numCount = ""
      Set Variable: "numCount" = numCount + 1
End Loop

^ Pasted directly from the Actions window.

There is some working code to get you started. Now, a hint on the combo box while I'm working:

Hold a text field in a movie clip and duplicate it as necessary in another loop.

I hope this helps you some more!

-Dan
Avatar of gindala

ASKER

thanks! I eagerly await your next mail!
I think i have solved your prodlem.

To populate the combo box what you need to do is following.

Currently you must be having the text fields and the button that get the list in the same frame.

Now convert the text fields into a movie clip and give it an instance name of say text.

Then give ths action to the button that get the countries:

On (Release)
      Load Variables ("temp.txt", "text")
End On

Here you have targetted the movie clip text you just created and loaded a text file named temp.txt which presumably can be generated by an ASP script.

This way you can populate the combobox.
I think i have solved your prodlem.

To populate the combo box what you need to do is following.

Currently you must be having the text fields and the button that get the list in the same frame.

Now convert the text fields into a movie clip and give it an instance name of say text.

Then give ths action to the button that get the countries:

On (Release)
      Load Variables ("temp.txt", "text")
End On

Here you have targetted the movie clip text you just created and loaded a text file named temp.txt which presumably can be generated by an ASP script.

This way you can populate the combobox.
Avatar of gindala

ASKER

um that's an awfully broad description, you'll have to give me working code, because the problem lies to take the text from the text field and then populate it into a combobox and add links to the items listed.
I'll post an .fla for you today later in the day. Hope it will help you understand what i ment.
If you're wondering how to get ASP variables from the ASP script into Flash, write this in your ASP script:

<%@Language="VBScript"%>
<%
Dim var1
Dim var2

var1 = "Test variable 1"
var2 = "Ooga booga boogey"

response.write("var1=" & Server.URLEncode(var1) & "&var2=" & Server.URLEncode(var2))
%>

This returns a line like this to Flash:

var1=Test+variable+1&var2=Ooga+booga+boogey

After using the LoadVariables statement you will now have your Flash vars set to your ASP data.

-Dan
ASKER CERTIFIED SOLUTION
Avatar of SuperMario
SuperMario

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
Avatar of gindala

ASKER

Comment accepted as answer