I'm trying to load an image from a stylesheet in a module, then use
that style declaration in the main application. It doesn't seem to
work, but wondered if there is something special I need to do to get
it to work?

I have the following in my stylesheet in my module:

.sun
{
        icon: "@Embed(source='../assets/Background/Sun.png')";
}

Then in my module I have a function like:

public function getSunStyle():CSSStyleDeclaration
{
    return StyleManager.getStyleDeclaration(".sun");
}

I've checked the return value here and it does exist (I've also
checked it with simple things like background colours etc).

Now, in my main application, I take that return value and do this:

var sun:CSSStyleDeclaration = module.getSunStyle;
if (gui.controlPanelBackgroundStyle != null)
{
    StyleManager.setStyleDeclaration(".sun", sun, true);
}

And I have a button (in the main app) defined as:

<mx:Button x="10" y="10" label="Button" styleName=".sun"/>

Is it possible to achieve what I'm trying to do?

Reply via email to