How can i create a button with richText display instead of label

Hi All,
I'm trying to create a button that will look exactly as the regular spark button but will have more than one color in his label (Like attached 'buttonPic.jpg')
I have tried to create a new button skin and new button component that will replace the label text and will to the job, but still it looks like the button original class overides the richText definitions. (Code attached)
Maybe there is other solution?
This is my extra code in the MyButtonSkin
     <!-- layer 8: text -->
    <!---
    @copy spark.components.supportClasses.ButtonBase#labelDisplay
    -->
    <s:Label id="labelDisplay"
             visible="false">
    </s:Label>
    <s:RichText id="exLabelDisplay"
                color="0x900000"
                textFlow="{TextConverter.importToFlow(htmlTextAsHTML, TextConverter.TEXT_FIELD_HTML_FORMAT)}"
                left="7" right="7" top="2" bottom="2">
    </s:RichText>
    <fx:Declarations>
        <fx:String id="htmlTextAsHTML"><![CDATA[<p><b>0</b>+</p>]]></fx:String>
    </fx:Declarations>

Hi mewk,
probably it was a catch due to eyes that actually got a bit of sleep
anyway small test app
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/halo" minWidth="1024" minHeight="768">
<fx:Script>
<![CDATA[
protected function updateBtn_clickHandler(event:MouseEvent):void
richbtn.label=mytext.text;
]]>
</fx:Script>
<s:Button id="richbtn" x="69" y="58" width="169" height="83" skinClass="ButtonSkin1" label="&lt;p&gt;hello&lt;/p&gt;&lt;p&gt;goodbye&lt;/p&gt;"/>
<s:Button x="70" y="333" label="Update rich button" id="updateBtn" click="updateBtn_clickHandler(event)"/>
<s:TextArea x="69" y="174" id="mytext" text="&lt;p&gt;hello&lt;/p&gt;&lt;p&gt;&lt;b&gt;bold&lt;/b&gt;&lt;/p&gt;"/>
</s:Application>
and a skin with minimal change
<?xml version="1.0" encoding="utf-8"?>
<s:SparkSkin xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark"
             xmlns:fb="http://ns.adobe.com/flashbuilder/2009" minWidth="21" minHeight="21" alpha.disabled="0.5">
    <fx:Metadata>
        <![CDATA[
        [HostComponent("spark.components.Button")]
        ]]>
    </fx:Metadata>
    <fx:Script fb:purpose="styling">
        <![CDATA[        
import flashx.textLayout.conversion.TextConverter;
            static private const exclusions:Array = ["labelDisplay"];
override public function get colorizeExclusions():Array {return exclusions;}
          override protected function initializationComplete():void
                useBaseColor = true;
                super.initializationComplete();
override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number) : void
                var cr:Number = getStyle("cornerRadius");
                if (cornerRadius != cr)
                    cornerRadius = cr;
                    shadow.radiusX = cornerRadius;
                    fill.radiusX = cornerRadius;
                    lowlight.radiusX = cornerRadius;
                    highlight.radiusX = cornerRadius;
                    border.radiusX = cornerRadius;
                if (highlightStroke) highlightStroke.radiusX = cornerRadius;
                super.updateDisplayList(unscaledWidth, unscaledHeight);
            private var cornerRadius:Number = 2;
        ]]>       
    </fx:Script>
    <!-- states -->
    <s:states>
        <s:State name="up" />
        <s:State name="over" />
        <s:State name="down" />
        <s:State name="disabled" />
    </s:states>
    <!-- layer 1: shadow -->
    <s:Rect id="shadow" left="-1" right="-1" top="-1" bottom="-1" radiusX="2">
        <s:fill>
            <s:LinearGradient rotation="90">
                <s:GradientEntry color="0x000000"
                                 color.down="0xFFFFFF"
                                 alpha="0.01"
                                 alpha.down="0" />
                <s:GradientEntry color="0x000000"
                                 color.down="0xFFFFFF"
                                 alpha="0.07"
                                 alpha.down="0.5" />
            </s:LinearGradient>
        </s:fill>
    </s:Rect>
    <!-- layer 2: fill -->
    <s:Rect id="fill" left="1" right="1" top="1" bottom="1" radiusX="2">
        <s:fill>
            <s:LinearGradient rotation="90">
                <s:GradientEntry color="0xFFFFFF"
                                 color.over="0xBBBDBD"
                                 color.down="0xAAAAAA"
                                 alpha="0.85" />
                <s:GradientEntry color="0xD8D8D8"
                                 color.over="0x9FA0A1"
                                 color.down="0x929496"
                                 alpha="0.85" />
            </s:LinearGradient>
        </s:fill>
    </s:Rect>
    <!-- layer 3: fill lowlight -->
    <s:Rect id="lowlight" left="1" right="1" bottom="1" height="9" radiusX="2">
        <s:fill>
            <s:LinearGradient rotation="90">
                <s:GradientEntry color="0x000000" alpha="0.0099" />
                <s:GradientEntry color="0x000000" alpha="0.0627" />
            </s:LinearGradient>
        </s:fill>
    </s:Rect>
    <!-- layer 4: fill highlight -->
    <s:Rect id="highlight" left="1" right="1" top="1" height="9" radiusX="2">
        <s:fill>
            <s:SolidColor color="0xFFFFFF"
                          alpha="0.33"
                          alpha.over="0.22"
                          alpha.down="0.12" />
        </s:fill>
    </s:Rect>
    <!-- layer 5: highlight stroke (all states except down) -->
    <s:Rect id="highlightStroke" left="1" right="1" top="1" bottom="1" radiusX="2" excludeFrom="down">
        <s:stroke>
            <s:LinearGradientStroke rotation="90" weight="1">
                <s:GradientEntry color="0xFFFFFF" alpha.over="0.22" />
                <s:GradientEntry color="0xD8D8D8" alpha.over="0.22" />
            </s:LinearGradientStroke>
        </s:stroke>
    </s:Rect>
    <!-- layer 6: highlight stroke (down state only) -->
    <s:Rect left="1" top="1" bottom="1" width="1" includeIn="down">
        <s:fill>
            <s:SolidColor color="0x000000" alpha="0.07" />
        </s:fill>
    </s:Rect>
    <s:Rect right="1" top="1" bottom="1" width="1" includeIn="down">
        <s:fill>
            <s:SolidColor color="0x000000" alpha="0.07" />
        </s:fill>
    </s:Rect>
    <s:Rect left="2" top="1" right="2" height="1" includeIn="down">
        <s:fill>
            <s:SolidColor color="0x000000" alpha="0.25" />
        </s:fill>
    </s:Rect>
    <s:Rect left="1" top="2" right="1" height="1" includeIn="down">
        <s:fill>
            <s:SolidColor color="0x000000" alpha="0.09" />
        </s:fill>
    </s:Rect>
    <!-- layer 7: border - put on top of the fill so it doesn't disappear when scale is less than 1 -->
    <s:Rect id="border" left="0" right="0" top="0" bottom="0" width="69" height="20" radiusX="2">
        <s:stroke>
            <s:LinearGradientStroke rotation="90" weight="1">
                <s:GradientEntry color="0x000000"
                                 alpha="0.5625"
                                 alpha.down="0.6375" />
                <s:GradientEntry color="0x000000"
                                 alpha="0.75"
                                 alpha.down="0.85" />
            </s:LinearGradientStroke>
        </s:stroke>
    </s:Rect>
    <!-- layer 8: text -->
<s:RichText id="LabelDisplay"
color="0x900000"
textFlow="{TextConverter.importToFlow(hostComponent.label, TextConverter.TEXT_FIELD_HTML_FORMAT)}"
left="7" right="7" top="2" bottom="2">
</s:RichText>   
</s:SparkSkin>

Similar Messages

  • How can i create a button with a dynamic picture?

    How can i create a button with a dynamic picture using
    mcLoader.loadClip
    I did create one with it doesnt seem to be working. It loses
    all its
    functions (eg onPress onRelease)
    Thanks

    I solved thep roblem anyway creating a mc.. then creating
    another MC withing
    the first MC and i change the picture on the second MC. And i
    apply the
    propierities to the first MC , and works
    If i have troubles with mu sistem on the future I will use
    yours!
    Thanks!
    "the fleece" <[email protected]>
    escribi� en el mensaje
    news:e67i88$jlf$[email protected]..
    > the image loading will remove any properties or
    functions the mc had.
    >
    > you need to apply them in the onLoadInit function
    >
    > mclListener.onLoadInit = function(target_mc:MovieClip) {
    > target_mc.onRollOver=blah blah
    > };
    > var image_mcl:MovieClipLoader = new MovieClipLoader();
    > image_mcl.addListener(mclListener);
    > image_mcl.loadClip(blah, blahblah);
    >
    >

  • How can I create a button with a random event?

    Well for example I have a deck of 52 cards, and I want the cards to be in different order everytime the game starts.
    thanks

    use the shuffle function to reorder arrays,
    function shuffle(a:Array) {
        var p:int;
        var t:*;
        var ivar:int;
        for (ivar = a.length-1; ivar>=0; ivar--) {
            p=Math.floor((ivar+1)*Math.random());
            t = a[ivar];
            a[ivar] = a[p];
            a[p] = t;

  • How can I create a solution with Livecycle

    I work for a high school and we have about 12 pdfs that we need parents to read/scroll through, then 10 (different) pages that we want them to print, complete and return to the school.  Finally, we want them to see a "Thank you, you have done all you have to do" type screen.  We want to make it as user friendly as possible so I was thinking...
    Reading pages, 1 at a time with next at bottom.
    Click next and it takes them on.  When they get to printing pages 1 print button prints all pages we need them to print. Click next, and it takes them to optional print pages.
    Click next and it says, thank you.
    How can I make this happen if I already have all the pdfs?
    Help please.
    John Dent
    [email protected]

    Thank you soo much.  A few questions?
    They weren't created in designer but could I just import all of them?
    How do "build the structure" for the naviagtion?
    Where/how do you add the script.
    Thanks again,
    John Dent
    Date: Fri, 30 Jul 2010 07:01:08 -0600
    From: [email protected]
    To: [email protected]
    Subject: How can I create a solution with Livecycle
    I assume that all of these PDFs were created in Designer. If so you can add any buttons that you want to appear on every page (Next, Previous) onto the Master page then there is script you can add to the buttons to actual move the pages (xfa.host.pageDown() and xfa.host.pageUp()). The Prin button can be added to the specific page and you can pass the page numbers that you want to print as a parameter to the print command. Lastly when you get to the last page and the click Complete you can display a messageBox with your Thank you message.
    Hope that helps
    Paul
    >

  • How can i create  excel sheet with multiple tabs using utl file?

    how can i create excel sheet with multiple tabs using utl file?
    any one help me?

    Jaggy,
    I gave you the most suitable answer on your own thread yesterday
    Re: How to Generating Excel workbook with multiple worksheets

  • How can I create a query with tables in INFOSET?

    Dear Gurus,
    How can I create a query with tables in INFOSET?
    Just tables and fields INFOSET?
    Kind Regards,

    Hello
    Check following SCN Article for your understanding/reference:
    - [Using Infoset Query ,SAP Query and Quick Viewer|http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/10eab7af-0e54-2c10-28a5-87b47adbe1a5]
    Regards
    JP

  • How can I create a query with web service data control?

    I need to create a query with web service data control, in WSDL, it's query operation, there is a parameter message with the possible query criteria and a return message contains the results. I googled, but cannot find anything on the query with web service. I cannot find a "Named Criteria" in web service data control like normal data control. In Shay's blog, I saw the topics on update with web service data control. How can I create a query with web service data control? Thanks.

    Hi,
    This might help
    *054.     Search form using ADF WS Data Control and Complex input types*
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/index-101235.html

  • How can I create a video with effects using my ipad?

    How can I create a video with effects (sepia, B&W, Negative, oval or any other shape borders) using my ipad?  I would Like to keep a higher res and also be able to shrink it down to email or send in a MMS. Or should I just upload it to my PC and mess with it there? Some of the apps I have are very easy to use compared to the learning curve needed for video editing software.
    Thanks

    Thats the Problem . . . how many apps do I have to try until I find the one I want? I noticed a few will render the video thus losing its original size. When I went to edit it more in iMovie the video was smaller--not good. And what software do you suggest, Templeton, for the PC? I love the apps because they are easy. I dont have hours to mess around on a software to figure out if its something I want. Im looking for simplicity. Maybe Ill get more into it later. I just want to record simple video of my playing the guitar for self analysis and create a short video for family and friends.
    Apps:
    iMovie
    CinemaFXV
    VideoFix
    Cartoonatic
    Video illusion
    VidEditor
    Software:
    Windows Movie maker (wont accept .mov files)
    After Effects (Too little time, so much to learn)
    Wondershare (Very easy but little choices)
    VideoPad (Again. Few choices)

  • HOW CAN I CREATE A GROUP WITH MY CONTACTS FOR TEXTING

    HOW CAN I CREATE A GROUP WITH MY CONTACTS FOR TEXTING

    Olga, this is not a default feature in iPhone. You need a 3rd party application. I have created a free one, Easy Group, for group texting and group emailing.
    http://itunes.apple.com/fr/app/easy-group/id461469079?mt=8
    Rémi
    Note: I may receive some form of compensation, financial or otherwise,from my recommendation or link.

  • In DPS/Indesign for iPad - How can i create a button that once tapped, will pre-populate an email?

    In DPS/Indesign for iPad - How can i create a button that once tapped, will pre-populate an email? like when you tap a recipe in Marth Stewart Every Day Food for example....

    http://forums.adobe.com/message/4190932

  • How can i create a button? t

    i'm new in using flash, how can i create a button and link it in other scene? thanks in advance

    Please re-post the question to the Flash forum at http://forums.adobe.com/community/flash/flash_general.
    Steve

  • How can I create drop shadows with PSE10

    How can I create drop shadows with PSE10 & PE10?

    Layer styles let you quickly apply effects to an entire layer. In the Effects panel, you can view a variety of predefined layer styles and apply a style with just a click of the mouse.
    Three different layer styles applied to text 
    The boundaries of the effect are automatically updated when you edit that layer. For example, if you apply a drop shadow style to a text layer, the shadow changes automatically when you edit the text.
    Layer styles are cumulative, which means that you can create a complex effect by applying multiple styles to a layer. You can apply one style from each style library per layer. You can also change a layer’s style settings to adjust the final result.
    When you apply a style to a layer, a style icon appears to the right of the layer’s name in the Layers panel. Layer styles are linked to the layer contents. When you move or edit the contents of the layer, the effects are modified correspondingly.
    Once you choose Layer > Layer Style > Style Settings, you can edit the settings of a layer’s style or apply other style settings or attributes available in the dialog box.
    Lighting Angle Specifies the lighting angle at which the effect is applied to the layer.
    Drop Shadow
    Specifies the distance of a drop shadow from the layer’s content. You can also set the size and opacity with the sliders.
    Outer Glow Size Specifies the size of a glow that emanates from the outside edges of the layer’s content. You can also set the opacity with the slider.
    Inner Glow Size Specifies the size of a glow that emanates from the inside edges of the layer’s content. You can also set the opacity with the slider.
    Bevel Size Specifies the size of beveling along the inside edges of the layer’s content.
    Bevel Direction Specifies the direction of the bevel, either up or down.
    Stroke Size Specifies the size of the stroke.
    Stroke Opacity Specifies the opacity of the stroke.

  • How can i creat several rectangles with one draw rect.vi

    how can i creat several rectangles with one draw rect.vi? thanks
    Solved!
    Go to Solution.

    You can call it in a for loop, with an array of the rectangle coordinates you want to draw. Is this what you mean?
    CLA, LabVIEW Versions 2010-2013
    Attachments:
    rectangle.png ‏11 KB

  • How can I create additional security with my ipad on a shared office network?

    How can I create additional security with my ipad on a shared office network?

    Haven't heard of any security explotes on the iPad.  That should tell you security has been built in.
    Great password.  Set up remote wipe in case iPad goes missing.  Backup iPad regularly.
    Robert

  • How can I creat a VPN with my Mac computer?

    How can I creat a VPN with my Mac computer?

    copy and paste this exact question into google.

Maybe you are looking for

  • Cannot save with phothoshop CS5 or CS5.5

    Hi, since I upgraded to Mountain Lion i can't save any photoshop CS5 or CS5.5 to a mounted volume on my mac. But I can with CS4 and CS6. Do somebody has the same problem as me?

  • Issue in session method --- urgent

    Hi, I developed one bdc which is working fine in call transaction mode when i am trying to run in session method it is giving information message like '    Processing of batch input session completed'. i am sending my code below. report ZAAATEST     

  • [CS4 or CS5] How to change frame of movieclip depending on relation to mouse

    I have a movie clip that follows the mouse.. Its not done yet but its gonna be a dog chasing a/the mouse... I want to have it where the if the mouse is left or right of the following movie clip it shows it walking toward the mouse... so something lik

  • Oracle 9i Install on Solaris 8

    I get the following output when I get to the part which runs make on file ins_plsql.mk; $ pwd /space/oracle9i/OraHome1/plsql/lib $ /usr/ccs/bin/make -f ins_plsql.mk install /space/oracle9i/OraHome1 chmod 755 /space/oracle9i/OraHome1/bin rm -f wrap Li

  • Installing Snow Leopard on New Internal SSD (without External drive)

    All, I have been searching and searching for a sufficient answer for this question, but have come up short thusfar. So any help or direction would be greatly appreciated. Basically I have an early 2009 MacBook Air (RevB) with a 128 GB HDD (not SSD).