|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I have programmed an ASP based database that has a MS SQL Server 7 backend. It was developed in Dreamweaver MX.
Now, i want to add flash based forms to it, so basically i need to kow how to grab data from a stored procedure/SQL statement and populate the form. I think once the form is populated, i can just post to my 'processing page' as i would normally do in ASP, right? Any help would be erm.. helpful? Thanks in advance |
|
#2
|
|||
|
|||
|
if you want to load anything in to Flash, all you need to do is format the variables in a "&variable=value&" format (minus the quotes)... so if you .asp page writes just a bunch of varible=value strings, Flash can take those values and do whatever you want them them using loadVariables or a LoadVars Object... what exactly do you want to do?
cheers, bret |
|
#3
|
|||
|
|||
|
flash heaache
I've worked out everything except the combo box. I can put my data into the combo box (as far as populating the options for selection), and i can select one of the options and forward that variable to the next page.
Where i am having trouble is trying to automatically select one of the combo box options based on a value in my table. i.e. i have a pulldown with agent names. The agents are actually stored by agent number. I have an existing record that has an agent number in it. I need the combo box to display that agent name as the selected option. The agents numbers do not run in order. confused? I am! |
|
#4
|
|||
|
|||
|
from the sounds of it, it seems like you want to be able to dynimcally set the options of the combo box? you can use the setDataProvider function to set the elements according to an array.
labels = ["these","are","labels"]; combobox_instance_name.setDataProvider(labels); if you need to set data as well as labels, you'll need to make your array elements objects. Check out the actionscript reference (in flash) for more on how to easily do this... if this isn't what you're talking about, then i'm obviously confused ![]() bret |
|
#5
|
|||
|
|||
|
its the next step...
i have my pulldown with all my agent names in it, and when you select a name, it sends the number to the next page.
That much is fine. The problem is with displaying a record that has already been entered. I want to give the user the ability to change the agent via the pulldown, but i want it to be initially selected with the current record. |
|
#6
|
|||
|
|||
|
by using setSelectedIndex, you can set the item during initialisation.. is that what you're looking for?
combo_instance_name.setSelectedIndex(0); |
|
#7
|
|||
|
|||
|
I think this is what i was looking for.. I was messing around with it earlier, but is there a awy for me (in flash) to calculate which index number im looking for? eg. i want to select the index number that matches agent 'john smith', because its his agent number (1234) that is in my database table. I was really hoping to avoid having to do some long winded count in my ASP page.
Another thing i was messing around with, but couldnt get to fly, was having a counter in the loop that puts the data into the pulldown and somehow grab the counter when the agent number matches my record and then use something like combo_instance_name.setSelectedIndex(counter); Any ideas? |
|
#8
|
|||
|
|||
|
prolly be easiest if you posted your actionscript?
|
|
#9
|
|||
|
|||
|
frame 1 code
loadVariablesNum("viewleadf.asp", 0); this gets the existing record based on a session variable the code below is how i populate my pulldown. onClipEvent (load) { this.loadvariables("flashagenttable.asp"); } onClipEvent (data) { aLables = AgentName.split(","); aData = AgentID.Split(","); ilist = new array(); for (k=0; k<aLables.length; k++) { myitem = new object(); myitem.label = alables[k]; myitem.data = aData[k]; ilist[k] = myitem; } this.SetDataProvider(ilist); } Now, i need to 'pre-select' the record in the pulldown when the agent number= the agent number on the page with the data. |
|
#10
|
|||
|
|||
|
are you talking about the combo box in flash or a pull down in the HTML page?
|
|
#11
|
|||
|
|||
|
combo box in flash
|
|
#12
|
|||
|
|||
|
heheh all right.. sorry about the confusion... so i'm not sure where your agent number variable is coming from, but going on your looping method, here's whati would do:
onClipEvent (load) { this.loadvariables("flashagenttable.asp"); } onClipEvent (data) { aLables = AgentName.split(","); aData = AgentID.Split(","); ilist = new array(); for (k=0; k<aLables.length; k++) { myitem = new object(); myitem.label = alables[k]; myitem.data = aData[k]; ilist[k] = myitem; if(i==agentNumber) counter = i; } this.setDataProvider(ilist); this.setSelectedIndex(counter); } so, just set a variable to your current agentNumber and your loop will look for that value and set the counter variable equal to the in increment (which should equal your current array index) then it will select whatever that value is. is that right? bret |
|
#13
|
|||
|
|||
|
thanks - i'll give it a shot
|
|
#14
|
|||
|
|||
|
Ok. my code now reads
onClipEvent (load) { this.loadvariables("flashagenttable.asp"); } onClipEvent (data) { aLables = AgentName.split(","); aData = AgentID.Split(","); ilist = new array(); for (k=0; k<aLables.length; k++) { myitem = new object(); myitem.label = alables[k]; myitem.data = aData[k]; ilist[k] = myitem; if (i == CurrentAgentNumber) { counter = i; } } this.setDataProvider(ilist); this.setSelectedIndex(counter); } Now remember that i've been using flash for less than a week! I dont think the variable 'CurrentAgentNumber' is being evaluated in the code. I have the variable showing up in a text box, so i know its being read into flash. Now, CurrentAgentNumber is how the variable is defined on my ASP page. is it ok to use it in actionscript, or do i have to do something else to it first? |
|
#15
|
|||
|
|||
|
just make sure that the CurrentUserAgent variable is pathed correctly. Does it get loaded in in your loadVariablesNum() statement? or in the this.loadVariables() statement? If it's the former, then you need to path to the _level0 or _root timeline to get to that variable. Don't forget one of the best ways to trouble shoot is to use the trace action. In your onClipEvent(data){...} function, try putting the following lines:
trace("the variable is on the movieclip: " + this.CurrentUserAgent); trace("the variable is on the _level0 or _root:" + _level0.CurrentUserAgent); that will tell you where the path the the variable is. If it's in either of the timelines, you'll see the value of CurrentUserAgent in the output box, if it's not there, it will still display the trace, but the CurrentUserAgent will return undefined. cheers, bret |
![]() |
| Viewing: Dev Shed Forums > Web Design > Flash Help > Flash as a database frontend |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|