Language: ChineseGermanSpanishFrenchDutchItalianRussian
123 Flash Chat Forums

Go Back   TOPCMM Community > SWFKit > SWFKit Support

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-06-2007, 03:44 PM
Junior Member
 
Join Date: Jun 2005
Posts: 22
Default Simple ADO (?) question

I've tried several examples for communicating with a db (access).
so far, i managed to load data from access into a Flash dropdown,
which is great.

I am familiar with mysql and .php, but the ADO commands are quite strange to me.

For instance, i would like to load all rows into a var.

function updateForm()
{

var names = record.Fields(1).Value.toString();
for (i = 0; i < 2; i ++){
record.MoveNext();
names += "||" + record.Fields(1).Value.toString();
}
FlashPlayer.tekst = names;
FlashPlayer.updateData(false);
}

I know this is wrong:
for (i = 0; i < 2; i ++){

thought it must be:
while (!record.eof){

But that isn't working..

Anyone? And does anyone know of a good place to learn this?
apart from : http://www.w3schools.com/ado
Reply With Quote
  #2 (permalink)  
Old 02-07-2007, 02:01 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:Simple ADO (?) question

The following code should work:

Code:
var names = record.Fields(1).Value.toString();
record.MoveNext();
while (!record.eof)
{
    names += "||" + record.Fields(1).Value.toString();
    record.MoveNext();
} 
trace("names:",names);
Reply With Quote
  #3 (permalink)  
Old 02-07-2007, 02:04 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:Simple ADO (?) question

Please try to google tutorials by using keywords "ado tutorial", and you will find a lot of them. If you have any problem, please send email to us(support(at)swfkit.com), or post your problem at here. We are glad to help you.
Reply With Quote
  #4 (permalink)  
Old 02-08-2007, 11:59 AM
Junior Member
 
Join Date: Jun 2005
Posts: 22
Default Re:Simple ADO (?) question


Thanks for your support!

The problem was: this piece of code was outside the function:

var record = new ActiveXObject("ADODB.Recordset");
//record.CursorLocation = 3;
record.Open("Select * from clients", conn, 1, 2);
record.MoveFirst();

Reply With Quote
  #5 (permalink)  
Old 02-09-2007, 11:55 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:Simple ADO (?) question

Code:
function updateForm()
{
record.MoveFirst();    
var names = record.Fields(1).Value.toString();
record.MoveNext();
while (!record.eof)
{
names += "||" + record.Fields(1).Value.toString();
record.MoveNext();
} 
trace("names:",names);
FlashPlayer.tekst = names;
FlashPlayer.updateData(false);
}
Reply With Quote
  #6 (permalink)  
Old 02-12-2007, 01:31 PM
Junior Member
 
Join Date: Jun 2005
Posts: 22
Default Re:Simple ADO (?) question


One more thing regarding this: i am having trouble getting the value passed from swfkit into a combobox.

My output from swfkit is:
FlashPlayer.ClientCode = record.Fields(1).Value.toString();

Which fills the dynamic textbox called: ClientCode
So far so good, in Flash i do this:

Dropdown.addItem(ClientCode, ClientCode);

But no value appears in the dropdown. I've tested the code with a
prefilled dynamic field, it works fine, but when the variable is passed from swfkit, nothing... I've tried all options, not using toString, using eval() etc.
Reply With Quote
  #7 (permalink)  
Old 02-12-2007, 05:44 PM
Junior Member
 
Join Date: Jun 2005
Posts: 22
Default Re:Simple ADO (?) question



i found it out myself, it apparently takes 2 frames before it's loaded
into a dropdown. Normally i can just put everything on one frame.

Is this a relay because of swfkit-->flash communication?
Or am i doing something wrong?
Reply With Quote
  #8 (permalink)  
Old 02-16-2007, 11:38 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:Simple ADO (?) question

Yes, the fscommands will be called asynchorously. And usually, the fscommands will be called after the action script code in the same frame has been called.

If you are using flash 8, you can avoid this problem by using the externalinterface object of action script. First, you define a method in actionscript, and then export it

function myMethod()
{
Dropdown.addItem(ClientCode, ClientCode);
}
ExternalInterface.addCallback("myMethod", null, myMethod);

In ffish script you can call the actionscript method in the following way

// first register the actionscript method
Application.registerASMethods("myMethod");
...
// then call it
FlashPlayer.ClientCode = record.Fields(1).Value.toString();
myMethod();
Reply With Quote
Reply

Was this information helpful?    Yes No



Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 04:05 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.