I would not mess around with moduleFactory assignments, especially if you
are embedding fonts. And if you are embedding fonts, see the post on
embedded fonts on my blog.
Flex SDK Team
Adobe System, Inc.
Based on your thoughts that it's probably an embedded font issue (our embedded font is in a font swf) I tried a couple of things:
I tried doing a manual measure of the textField inside of an extended toolTip (using a copy of the measure method from UITextFormat). But, instead of
var fontModuleFactory:IFlexModuleFactory = embeddedFontRegistry.getAssociatedModuleFactory( getEmbeddedFont(font, bold, italic), moduleFactory);
var fontModuleFactory:IFlexModuleFactory = systemManager;
which is the fallback in case the first one returned null anyway (which it wasn't). What happened was very interesting - the tooltips all sized correctly finally - but there wasn't any text in them! So - you're right - it's a font issue.
I read your post here http://blogs.adobe.com/aharui/2010/03/flex_and_embedded_fonts.html many times, but a) it seems mostly Flex 4 related b) none of those properties like swfContext or getFontContext are available to my UIComponents (probably an SDK issue) c) I couldn't figure out what I'm supposed to do w/ ISWFContext or ContextualClassFactory. Is there something I can do for the entire application? Each Module? or does it have to be on a component-by-component basis?
Flex 4 introduces CFF fonts, but other than that, the principle of getting
moduleFactory to be correct still applies to older SDK versions.
I think there is a TOOLTIP_HIDE event. I would listen for it and dump out
some information about the tooltip: moduleFactory, fontFamily, fontWeight,
fontStyle and maybe drill into the TextField that's supposed to show the
text and get its embedFonts property.
I'm working on a similar structure app - flex 3, resourceManager, Modules....
and indeed after implementing modules, and using the phrase "this.moduleFactory = Application.application.systemManager;"
I started loosing text in all kinds of tooltips in an inconsistence manner
the reason I used "this.moduleFactory = Application.application.systemManager;"
is that the modules wern't able to access fonts that the containing application could access,
and after days of searching, this was the only thing that actually worked.
I was wondering if you manage to solve the tooltips text problem and would you care to share it
Mucking with moduleFactory is probably asking for trouble. Explain your
topology and we'll see if we can get fonts working without setting
Dear Flex harUI
thank you for your responce
I have a flex 3 web app constructed with modules
fonts are embedded into an external swf vis css
if I don't include the following line, fonts are missing from the modules
currentModule.moduleFactory = this.systemManager;
they apear fine in the loading app, but missing from the loaded module
either I don't get the fonts to display in the modules, or inconsistently show/ not show text in the custom error tooltips
I'm using ModuleManager to load the modules
are there any other details I can provide?
would appreciate very much your answer
this issue is choking the project
Probably not the most elegant solution - but the quickest to ship was to monkey-patch DataTip and include this.moduleFactory = Application.application.systemManager; in the constructor. That fixed all of our tooltips/datatips.
Also, following Alex's suggestions on his blog, we instantiate itemRenderers w/ ContextualClassFactory ... e.g.
alertNameCol.itemRenderer = new ContextualClassFactory ( ReadableItemRenderer, Application.application.systemManager );
And, when including TextFields, UITextFields etc. in our custom components, we changed from var foo:TextField = new TextField() to var foo:TextField = createInFontContext( TextField ) as TextField - that fixed a bunch of font problems as well.
How are you instantiating the module classes? Are you using
factory.create() or something else?
Hi and thanks again for replying
this help is really needed!
I am using ModuleManager:
var info:IModuleInfo = ModuleManager.getModule(someModule.swf);
then using the ModuleEvent object on the event handler function like so:
does that help?
Hi wraevn and thank you for replying
what do you mean by
the quickest to ship was to monkey-patch DataTip and include this.moduleFactory = Application.application.systemManager; in the constructor. That fixed all of our tooltips/datatips.
the constructor of the app loading the modules?
the constructor of the module?
did you subclass Tooltip / DataTip and used this line in the subclass constructor?
ok, i think problem is solved for now
for every custom error tooltip i create i write
_tooltip.moduleFactory = Application.application.systemManager;
still left with the following questions:
what is the internal problem that causes this bug?
why does this line fix it?
what are the drawbacks for using this "patch"?
why is it considered a work-around rather then a solution?
what is the solution then?
the important thing is that it works for now
would help to answer those question to trust the application to last...
thanks again for your help
We would need a test case to determine the root problem.
you mean an online link or the entire application source? (it is a big one...)
I did a small scale test and everything went well, I wasn't able to replicate the scenario
but in the real application, the steps I mentioned were the only thing that made it work...
so I take it that normally this bug shouldn't occure? therefore there is no "proper" solution for it?
why "messing" with the moduleFactory is not advised?
we didn't sublcass - we monkey-patched DataTip. Monkey-patching is a last-resort way to a) gain access to private vars and methods b) make a global change throughout the framework.
Basically - you make a complete copy of the class you wish to extend (in this case DataTip). Then you place that new class in the exact same path in your local src directory (e.g. mx.charts.chartClasses.DataTip) so it matches exactly the real Flex path. Then you make whatever changes you want. When you or any other part of the codebase calls up that class, it'll load your monkey-patched class first.
Then we put the moduleFactory = code inside the DataTip constructor in the monkey-patched class.