On 12-apr-2006, at 12:57, Cedric Muller wrote:

new _global[myStr]

Ok, finally I sorted it out. It's really twisted.

Firts of all, the best manner to access the needed class is indeed by "property literal" (the fact that the class is just a property of it's parent namespace), so that is the most neat solution IMO:

var bananaType:String = "green";
var inst:Banana  = new org.monkeys.bananas[bananaType]();

What turned out to _really_ be the problem is the following. Looks like the Flash compiler actually _omits_ the classes that I reference using import if they are not literally called upon in code (which is ridiculous). I have the following in my class:

import com.julik.star.stack.layout.Layout;
import com.julik.stack.layout.Horizontal;
import com.julik.stack.layout.Vertical;
import com.julik.stack.layout.Burst;

class com.julik.star.Stack extends com.julik.star.Widget {
        // bla bla
        function Stack() {
layout = new com.julik.star.stack.layout.Horizontal; // this class DOES get imported and is visible in _globals
        }
}

The problem is - I got to have "new someClass" somewhere in my code for the other "layouts" to appear under _globals, after which I can properly instantiate them.

I wonder if it's a bug or just one of those places where "It's gonna be worse than Java" is showing :-)
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to