Archive

Archive for October, 2009

Application global access

October 14, 2009 Leave a comment

In flex 4, accessing your application globally has changed from Application.application in flex 3, to FlexGlobals.topLevelApplication.

Flex 3:

import mx.core.Application;
var myApp:MyApp = Application.application as MyApp;

Flex 4:

import mx.core.FlexGlobals;
var myApp:MyApp = FlexGlobals.topLevelApplication as MyApp;
Categories: Flex 4 Examples

s|global && mx|global embedded fonts

October 13, 2009 Leave a comment

I’m not sure how it happened, but yesterday we noticed our fonts were suddenly (magically) messed up. In one of our applications we reference a library source path containing a common css file and some fonts. In it we were embedding the fonts appropriately and had global style declarations so the embedded fonts would be applied to both sets of controls.

Read more…

Categories: Flex Gotchas Tags: , , , , ,

<s:ItemRenderer/> currentState == null

October 1, 2009 1 comment

I received an Item renderer from my designer with a few states that were to be driven by some data. We are using an advanced data grid and one of the columns is rendered by this component.

We noticed that the state wasn’t reflected by the data despite the correct state being set. As it turns out, the ItemRenderer class has a getCurrentRendererState() method that can potentially return null – Specifically when there is no interaction (hovered, selected, etc…) and there is no “normal” state on your renderer.

So despite my setting the correct state, this base method was hijacking me and setting the state to null. You can fix this problem by overriding the method, or by overriding “setCurrentState” and not calling super.setCurrentState if the stateName is null.