Reputation: 1182
I have star.fxg file and i want create SpriteVisualElement class from String "star". I'm trying like this:
var classRef:Class = getDefinitionByName("star") as Class;
myStar = new ClassFactory(classRef).newInstance() as SpriteVisualElement;
but Flex say that Variable star is not defined.
But if i try:
myStar = new star() as SpriteVisualElement;
all working fine.
How to get instance of SpriteVisualElement from String name of fxg?
Upvotes: 0
Views: 109
Reputation: 39408
The answer is to use the fully qualified class name. Instead of star
use com.myPackage.mySubPackage.star
Upvotes: 1