tags:

views:

151

answers:

1

Hi All

Searching the web there are hundreds of answers to why getDefinitionByName doesn't work - because the class definition that you are trying to get is not included in the swf.

This is not that problem.

My app is loading a swc at run time, unzipping it, reading the xml and displaying a list of classes that were in that swc. You can then select a class and it will be added to the stage.

When I load the swc and try to use getDefinitionByName I get the following trace:

getting class: com.company.assets:AppFooterShadow
error: Error #1065: Variable assets:AppFooterShadow is not defined.

The com.company is stripped off the beginning!

From code similar to this:

try
{
    trace( "getting class: " + definition );
    var currentClass : Class = getDefinitionByName( definition ) as Class;
}
catch( e : Error )
{
    trace( "error: " + e.message );
}

If I type a class name in a text input box and try to load that it works fine - with exactly the same string being passed to the function.

Anyone got any idea what is going on here? Seems very odd to me.

A: 

I can't believe how long I've been staring at this and not seeing what the problem was!

I had typed in this:

com.company.assets.AppFooterShadow

and this was in the list:

com.company.assets:AppFooterShadow

a colon instead of a full stop!

Ok I'll stop talking to myself - please ignore this!

Roaders
i've done that before, man
viatropos