|
|||
|
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 |
|
|||
|
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);
|
|
|||
|
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.
|
|
|||
|
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(); |
|
|||
|
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);
}
|
|
|||
|
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. |
|
|||
|
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? |
|
|||
|
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(); |
![]() |
Was this information helpful? Yes No
| Thread Tools | |
| Display Modes | |
|
|