문제

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