Flash Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignFlash Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 18th, 2003, 01:18 PM
Den the Puzzled Den the Puzzled is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 25 Den the Puzzled User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy Flash as a database frontend

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

Reply With Quote
  #2  
Old March 25th, 2003, 05:29 PM
bret bret is offline
flash junkie
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: CO, USA
Posts: 172 bret User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 38 sec
Reputation Power: 6
Send a message via Yahoo to bret
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

Reply With Quote
  #3  
Old March 26th, 2003, 04:07 PM
Den the Puzzled Den the Puzzled is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 25 Den the Puzzled User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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!

Reply With Quote
  #4  
Old March 26th, 2003, 04:26 PM
bret bret is offline
flash junkie
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: CO, USA
Posts: 172 bret User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 38 sec
Reputation Power: 6
Send a message via Yahoo to bret
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

Reply With Quote
  #5  
Old March 26th, 2003, 04:33 PM
Den the Puzzled Den the Puzzled is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 25 Den the Puzzled User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #6  
Old March 26th, 2003, 04:40 PM
bret bret is offline
flash junkie
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: CO, USA
Posts: 172 bret User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 38 sec
Reputation Power: 6
Send a message via Yahoo to bret
by using setSelectedIndex, you can set the item during initialisation.. is that what you're looking for?

combo_instance_name.setSelectedIndex(0);

Reply With Quote
  #7  
Old March 26th, 2003, 04:46 PM
Den the Puzzled Den the Puzzled is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 25 Den the Puzzled User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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?

Reply With Quote
  #8  
Old March 26th, 2003, 05:06 PM
bret bret is offline
flash junkie
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: CO, USA
Posts: 172 bret User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 38 sec
Reputation Power: 6
Send a message via Yahoo to bret
prolly be easiest if you posted your actionscript?

Reply With Quote
  #9  
Old March 26th, 2003, 05:17 PM
Den the Puzzled Den the Puzzled is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 25 Den the Puzzled User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #10  
Old March 26th, 2003, 05:38 PM
bret bret is offline
flash junkie
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: CO, USA
Posts: 172 bret User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 38 sec
Reputation Power: 6
Send a message via Yahoo to bret
are you talking about the combo box in flash or a pull down in the HTML page?

Reply With Quote
  #11  
Old March 26th, 2003, 05:52 PM
Den the Puzzled Den the Puzzled is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 25 Den the Puzzled User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
combo box in flash

Reply With Quote
  #12  
Old March 26th, 2003, 06:00 PM
bret bret is offline
flash junkie
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: CO, USA
Posts: 172 bret User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 38 sec
Reputation Power: 6
Send a message via Yahoo to bret
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

Reply With Quote
  #13  
Old March 26th, 2003, 06:05 PM
Den the Puzzled Den the Puzzled is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 25 Den the Puzzled User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
thanks - i'll give it a shot

Reply With Quote
  #14  
Old March 27th, 2003, 08:46 AM
Den the Puzzled Den the Puzzled is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 25 Den the Puzzled User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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?

Reply With Quote
  #15  
Old March 27th, 2003, 09:51 AM
bret bret is offline
flash junkie
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: CO, USA
Posts: 172 bret User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 38 sec
Reputation Power: 6
Send a message via Yahoo to bret
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

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignFlash Help > Flash as a database frontend


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump