سؤال

Since fontSharpness and fontThickness don't work in Flex 4, as it says here (though I'd like to be proven wrong), I have replaced every <s:Label/> in my application with <mx:Label/>.

Though it works well in panels and dialogs, it doesn't work in skins. When I add skin parts to skins, they should extend a predefined class. Say for promptDisplay in TextInputSkin I cannot use this:

<mx:Label id="promptDisplay"/>

where this:

<s:Label id="promptDisplay"/>

is supposed to be, because promptDisplay should extend an IDisplayText.

What is the best workaround for this?

هل كانت مفيدة؟

المحلول

Well, I suppose the quickest workaround would be to create your own Label class by subclassing mx Label and implementing IDisplayText. Something like this:

import mx.controls.Label;

public class MyLabel extends Label implements IDisplayText {

    public function get isTruncated():Boolean {
        return false;
    }

}

Now you can use MyLabel wherever an IDisplayText is required and apply fontSharpness and fontThickness to it, since those two styles are inherited.
Be warned though that this will not work if a TextBase is required.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top