I'm trying to load dynamically Flex component at runtime
from just the component's name (String).
I succeed when I was using Flex2 Beta2 but this
does not work anymore with Beta3.
Here is the code I am using:
var urlRequest:
URLRequest = new URLRequest();
urlRequest.url = "";
urlRequest.url = "";
var context:
LoaderContext = new
LoaderContext();
context.applicationDomain = new ApplicationDomain(ApplicationDomain.currentDomain);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, handleLoadComplete);
loader.load(urlRequest, context);
context.applicationDomain = new ApplicationDomain(ApplicationDomain.currentDomain);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, handleLoadComplete);
loader.load(urlRequest, context);
Then in handleLoadComplete:
var viewClass: Class =
Class(loader.contentLoaderInfo.applicationDomain.getDefinition("mycomponent"));
view = new viewClass(); // <-- it fails here
view = new viewClass(); // <-- it fails here
The error I get:
InvalidSWFError: Error #2136: The SWF file
'http://localhost:8080/mysamples/core1.mxml.swf' contains invalid
data.
where core1.mxml.swf is the caller
application.
The Flex component mycomponent.mxml is just a VBox,
nothing else. When I try to access to the mycomponent.mxml.swf file Í'm
getting another error (I don't remember I got it with Flex2 Beta2):
TypeError: Error #1010: A term is undefined and has
no properties.
at mx.styles::StyleManager$/http://www.adobe.com/2006/flex/mx/internal::initProtoChainRoots()
at mycomponent/http://www.adobe.com/2006/flex/mx/internal::_mycomponent_StylesInit()
at mycomponent$iinit()
at mx.styles::StyleManager$/http://www.adobe.com/2006/flex/mx/internal::initProtoChainRoots()
at mycomponent/http://www.adobe.com/2006/flex/mx/internal::_mycomponent_StylesInit()
at mycomponent$iinit()
I don't know what happened between Beta2 and Beta3,
does anyone have any idea ?
Thanks
--
David Rousselie
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
Web site design development | Computer software development | Software design and development |
Macromedia flex | Software development best practice |
YAHOO! GROUPS LINKS
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.