PDA

View Full Version : [AS3] an interactive cd rom using xls file


salah
06-10-2009, 10:10 AM
Hello

I want creating an interactiv cd rom using xls file, is it possinble to read data on an swf animation from an excel file? if the answer is yes can you tell me how can i do that, please?
Thank for reading my message

northcode
06-11-2009, 09:09 PM
If you use SWF Studio (http://www.northcode.com/swfstudio.php) to build the EXE for your CD then you can make use of our ADO plugin to read XLS files like this...


ssCore.init();

ssDefaults.synchronousCommands = true;

function showResult(f, r)
{
ssDebug.trace(f + ": " + r.success);

if (r.success)
{
if (r.result != undefined)
ssDebug.trace("result: " + r.result);
}
else
{
ssDebug.trace("error: " + r.Error.code + ":" + r.Error.description);
ssDebug.trace("adoError: " + r.adoError);
}

ssDebug.trace("");
}

s = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source="+ssGlobals.ssStartDir+"\\test.xls; Extended Properties=\"Excel 8.0;HDR=No\"";

r = ssCore.ADO.setConnectString({connectString: s});
showResult("ADO.setConnectString", r);

r = ssCore.ADO.setSQL({sql: "SELECT * FROM [sheet1$]"});
showResult("ADO.setSQL", r);

r = ssCore.ADO.setRowFormat({format:"DLM"})
showResult("ADO.setRowFormat", r);

r = ssCore.ADO.open();
showResult("ADO.open", r);

r = ssCore.ADO.moveFirst({});
showResult("ADO.moveFirst:", r);

if (r.success)
{
results.text = r.result;
}
I've attached an example. You'll need to download SWF Studio to try this (there's a FREE trial version). The ZIP file contains an SPX file (SWF Studio self-extracting project) which contains the source FLA and an example XLS file. Just install SWF Studio and then double click on the SPX file to open the project, press the Build button and you can test the new EXE that reads the XLS file.