Search code examples
apache-flexflex3actionscript-3stylingtextinput

how to smooth an embeded image in flex when its embed as a class for textinput border style


Hello my fellow stackoverflower,

i'm looking for away to smooth an image of and embed png file. i'm using the embeded png as the borderskin for my textInput.

i have seen some other postings about this subject but i can figure it out. Does anybody have an idea, how i can a complish this? some real solid code example wwould be nice.

this is what i would like to do.

step 1) embed and image

    [Embed(source='assets/images/searchBoxImg.png')]
    private var searchBG:Class;  

step 2) smooth the image somehow?

step 3) and us it as a borderskin for my textInput.

        this.setStyle('borderSkin',searchBG);

is there anybody out there that can help me with this?

DJ


Solution

  • Well i finelly found a solution. Actually is pretty simpel to smooth and embeded image in a class.

    Step one) create an new actionscript class that extends BitmapAsset.

    Step two) Embed and image and set smoothing to true

    package 
    {
        import mx.core.BitmapAsset;
    
        [Embed(source='assets/images/searchBoxImg.png')]
        public class searchBG extends BitmapAsset
        {
            public function searchBG()
            {
                smoothing = true;
            }
        }
    }
    

    Step three) Create a new as3 class and import the first class.

    now you are able to use the searchBG Class on the borderSkin.

    this.setStyle('borderSkin', searchBG);
    

    thats it.