|
So after having a few months’ experience developing
Flash apps in Flash 8, I’m trying to get into using the Eclipse setup you
guys are all about because I frankly just need a better IDE, including the
patches applied to the core and mx classes. But it’s beginning to seem like developing with FAMES requires
huge major changes to how I set up my movies, and I’m still really not
getting it. I need some help. I’m trying to make a little test/demo of a class that
exports a DataGrid’s contents to a file. I’ll describe my
approach and you can tell me where I’ve gone wrong. I started out with an .fla on which I placed two v2
components, a DataGrid called “exportMe” and a Button called “whenImClicked”.
I then converted these into a MovieClip symbol, gave it a linkage ID, and made
sure that this new symbol was on the stage, then published to a .swf. I created a class, DataGridCSVExportTest.as. The “bind”
variable and the “main” function are things I never used before, but
I picked up from some video tutorial I saw recently where you make an
onEnterFrame() that makes a label count to 100, etc. I found that if I
didn’t include the static main() method, or if I left it non-static,
Flashout would give me an error that “no main entry point found.” import com.t8.utilities.DataGridCSVExport; import mx.core.UIObject; import mx.controls.DataGrid; import mx.controls.Button; class com.t8.test.DataGridCSVExportTest extends UIObject { private
static var bind = Object.registerClass("com.t8.test.DataGridCSVExportTest",
DataGridCSVExportTest); public
static function main() { Flashout.init(); trace(Flashout.DEBUG
+ "main"); } var
exportMe:DataGrid; var
withThisData:Array; var
whenImClicked:Button; public
function DataGridCSVExportTest() { trace(Flashout.DEBUG
+ "constructor"); withThisData
= []; } public
function onLoad() { trace(Flashout.DEBUG
+ "onLoad"); exportMe.columnNames
= ["username", "groupname", "edited",
"time", "ip", "notes"]; makeData(); populateDG(); setupButton(); } private
function makeData() { withThisData.push({username:
"chuck",
groupname: "coolguys",
edited: "thingamajig_txt",
time: "June 19 1995",
ip: "192.168.133.12",
notes: "I corrected some spelling."}); //
other test data items here, cut out for brevity } private
function populateDG() { exportMe.dataProvider
= withThisData; } private
function setupButton() { whenImClicked.addEventListener("click",
this); } private
function click(evt:Object) { if
(evt.target == whenImClicked) { trace("yeah
you clicked the button."); //
TODO: the export stuff, once I get the interface to work at all } } } After getting a couple other little bugs worked out, I got
this to compile. However, the first time, the only thing that appeared in
the SWF preview was the button’s label, and in a funky old font besides. I compiled it again with the –keep tag on, re-published
the swf, and that time the DataGrid and Button drew. But now none of the
code runs, except the main() function… and it runs over and over and
over, as if it were an onEnterFrame(). The trace of “main”
appears in the logger in a sort of infinite loop. I’m thinking that if I can’t make FAMES do
anything but infinite loops, it’s not going to do me much good ;) The other trace methods never appear. I tried removing
the trace from main() and now the logger just stays blank. onLoad() never
executes. Even the class constructor never executes. What am I missing here?
| ||||
_______________________________________________ osflash mailing list [email protected] http://osflash.org/mailman/listinfo/osflash_osflash.org
