This content has been marked as final. Show 4 replies
"jkpritchard" <firstname.lastname@example.org> wrote in message
> I'm trying to create a little browser application that will allow me to
> one of my symbols and add it to the screen. The class associated with the
> component is in the local namespace (xmlns:local-"*"). I can add the
> through mxml with no problem, but when I try to add it through
> the compiler says that the class is not defined when I use
> getClassDefinitionByName(className) as Class.
> Why is it that I can use <local:className> to add it but I can't use
> var:symbolName:className = new className()?
then press and hold the control key and press the space bar. If there is
more than one class that shows up, use the mouse to select your class, then
press enter. You will find that this will make the proper import for you.
However, if the class is at the root of your src folder, it shouldn't need
to be imported, in which case I'm not sure.
>>The class associated with the component is in the local namespace (xmlns:local-"*").
What class do you mean here?
Be careful not to confuse XML namespace with Package namespace. the Namespace class and the double colon syntax are for XML namspace only.
Import, package declaration and xmlns are all package namespace oriented.
I assume this is a typo: xmlns:local-"*").
Also be aware that when using getClassDefinitionByName, you must have a hard reference to that class declared somewhere in your app, or the class will not get linked in by the compiler. A dummmy variable is often used.
Finally, I don't use a prefix for local classes, just xmlns="*". Perhaps doing so makes you explicitly use local like this?
var symbolName:className = new local.className()
Truly just guessing on this one.
Thanks for the help. I think I did exactly what Tracy was talking about and thought that the xml namespace and the package namespace were the same thing.
I had my packaged code outside the src folder (in lib), so none of it could be located (which I know now could have worked if i set the reference correctly in the project).
Everything has been moved to the src folder (including the package structure), and everything is working fine now.
After using Flex Builder for only a couple of weeks, I have to say I love the IDE. Code completion for custom classes is such a great thing that the Flash IDE never could do.
Thanks very much to everyone who responded.