Language: ChineseGermanSpanishFrenchDutchItalianRussian
123 Flash Chat Forums

Go Back   TOPCMM Community > SWFKit > SWFKit Support

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-09-2009, 01:57 PM
Junior Member
 
Join Date: Feb 2009
Posts: 3
Default My SQL database data retreiving problem

HI,

I am having a problem with using My SQL database with SWFkit pro.

(01) I'm using swfkit with flash cs3, and I have attached swfkit project to my FLa project. Nothing wrong in it. database connection is ok too.. I can insert data into database as well. but it is possible to retrieve data from database as mentioned bellow?


var rs = new ActiveXObject("ADODB.Recordset");
rs.Open("SELECT MAX(playerID) FROM playerinfo", conn, 1, 2);
rs.moveFirst();

playerIDtext.text=rs.Fields(0).Value;



Note : in here what I'm trying to expect is to display the maxium value of playerID column in the playerinfo database.

this seems to be not working. Please help me on identifying the problem.



(02) If this is not the right method in "retrieving" data, what is the best method to retrive database data using swfkit inside flash?
Reply With Quote
  #2 (permalink)  
Old 02-10-2009, 08:07 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default

The "Fields" property of the rs object is another activex object, so you cannot use the syntax rs.fields(0) as in ffishscript. Please try the following code
Code:
playerIDtext.text = rs.Fields.item(0).Value;
ADO is the best method to access databases in swfkit. If you still have problem, please feel free to let us know.
Reply With Quote
  #3 (permalink)  
Old 02-14-2009, 04:11 PM
Junior Member
 
Join Date: Feb 2009
Posts: 3
Default

hi,
Thank you for your reply. I fixed the problem using scripting in SWF pro in itself. Now it is working.

(1) any how I tried your method as well. it is not working properly. Cannot figure out why is that.

(2) I have the database connetion, data retrieving in FFish scripts. All are working well. I am passing retrieved values to flash using the code :

FlashPlayer.setVariable("_root.win1.text" , ball1Count.toString());

this works fine.

But the problem is when I want to set variable value in action script, it is not working.




//---Action Script Code---//

var test;

FSCommand("FFish_Run", "database");

FSCommand("FFish_Run", "count");

...
...


// FFish script ------------//

FlashPlayer.setVariable("_root.test" , "100");

But the variable "test" is always 'undefined' .

Please help me with this issue.

Thank you.
Reply With Quote
  #4 (permalink)  
Old 02-16-2009, 07:37 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default

The reason is that the fscommands are asynchronous. The fscommands just tell the flash player that a command needs to be executed. The flash player just puts these commands into something like a queue, and goes to the next line of your actionscript. It only begins to execute the commands when it has finished all the actionscript code.

If you want to avoid this problem, please use the wrapper class of swfkit instead.



Code:
import SWFKit.*;
Global.invoke("database");
Reply With Quote
  #5 (permalink)  
Old 02-23-2009, 02:34 PM
Junior Member
 
Join Date: Feb 2009
Posts: 3
Default

Thank you very much for your help and support. SwfKit product is GREAT.
Reply With Quote
Reply

Was this information helpful?    Yes No



Tags
database, my sql

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 05:36 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.