I cannot predict at compile-time what the name (or properties) of the class 
will be.  I need to CREATE the class at runtime, AND add the properties to it.  
It seems, so far, that this is not possible.

However, what I'm doing sounds very similar to your project.  It's not so much 
the sheer number of tables (although a few dozen) but the fact that the 
application allows the creation of new tables (so I need a new class) and 
columns (so the properties might change).

I can easily have my app write new destinations to the config file for any new 
table created.  I can even write the necessary CFCs to disk based upon schema 
changes within the app.  But I cannot find a way to get the classes I need.

All tables share the same foreign key column name, which is helpful.  My idea 
is this...set up one class that has two properties - the foreign key and a 
second column.  I would have one destination for each table, but all 
destinations will point to the same class.  When my CFCs pull data, I will have 
them return the primary key along with all other data encoded (XML or 
something) into the second property.  Then on the client side I can manage it 
by filling an ArrayCollection, then having a function that parses the actual 
columns and rows (from the second property) into a second ArrayCollection that 
my datagrid is actually bound to.  Creates/updates would go in the reverse 
direction - placed into the second ArrayCollection and then processed up to the 
two-property format for the first one, at which point LCDS will take over.

As I think through it, this should work.  Thoughts?

--- In flexcoders@yahoogroups.com, "wrhinfl" <wrhi...@...> wrote:
>
> Ok, I think the way your question is worded can cause problems with the 
> answer you get.
> 
> If your real question was "Can a class be modified during runtime and how?"  
> Would this be the same question you are asking?
> 
> I searched the ASDocs and found Dynamic Class, which allows you to add 
> variables and functions to an instance of a class.  I created a simple 
> application and uses one AS class twice, creating different variables and 
> functions in the two instances.
> 
> The project I am working on is trying to do something very similar where I 
> don't want hundreds of classes to match the hundreds of tables (and would 
> require hundreds of java classes on the server).  
> 
> And your question made me do some searching, so let me know if this question 
> and answer are closer to what you are trying to accomplish in your project 
> and I can share my simple code (two files with 70 lines of code, no comments).
> 
> --- In flexcoders@yahoogroups.com, "postwick" <paul@> wrote:
> >
> > I want to store descriptions of classes in an external file (such as XML) 
> > or database, and use them in my Flex application such that I can add, 
> > remove, or change the classes in the external file with recompling the Flex 
> > application.
> > 
> > Is there any way to do this?  In a nutshell, is there a way to create a 
> > class through an Actionscript function, with a for loop where the 
> > information that is looped over contains the definitions of the classes 
> > loaded from an external source?
> >
>


Reply via email to