Question

I'm trying to compile existing Flex 4 project but having an error:

Call to underfined method getStyleManager of StyleManager class.

The code is:

var styleManager:IStyleManager2 = StyleManager.getStyleManager(null);

I found the method in Flex documentation but when I open StyleManager.as I can't find the method declaration.

Used Flex SDK 4.0.0.10485 from here.

Was it helpful?

Solution

Try upgrading your version of Flex, is that possible? It's working for me, I do this:

import mx.managers.SystemManagerGlobals;

public static function getStyleManager():IStyleManager2
{
    return mx.styles.StyleManager.getStyleManager(SystemManagerGlobals.topLevelSystemManagers[0]);
}

I'm using Flex 13645.

It also depends on when you're calling StyleManager possibly: if you're calling that method in a Preloader, that could be a problem.

OTHER TIPS

Each app has its own StyleManager in Flex 4. You access it with the styleManager property (note the lowercase "s"), whereas before you used the static class StyleManager to get an instance.

Here's a page that describes how to use the StyleManager class: http://help.adobe.com/en_US/Flex/4.0/UsingSDK/WS2db454920e96a9e51e63e3d11c0bf69084-7f7c.html

hth, matt horn flex docs

Please check this following link,

The correct way now of using the StyleManager would be the following,

var tempStyle:CSSStyleDeclaration = StyleManager.getStyleManager(null).getStyleDeclaration(”.tempStyle”);

StyleManager.getStyleManager(null);, returns the top level instance of StyleManager.

http://www.nayansavla.com/blog/?p=401

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top