3 Replies Latest reply on Oct 2, 2006 6:22 AM by Starlover_jacob

    button bold italic underline

    Starlover_jacob Level 1
      hello

      can someone help me get these buttons to style my text?
      bold
      italic
      underline
      those beautiful buttons that are placed in the rich text editor.

      Greetz, jacob
        • 1. Re: button bold italic underline
          Starlover_jacob Level 1
          A little correction. I made buttons with B I U on it but i want to change an label with it. so if you click bold on the label text turns bold.
          How do i do this?
          • 2. Re: button bold italic underline
            inlineblue Level 1
            Write click events for your buttons and do one of the following:

            Bold: label.setStyle("fontWeight", "bold");
            Italic: label.setStyle("fontStyle", "italic");
            Underline: label.setStyle("textDecoration", "underline");
            • 3. Re: button bold italic underline
              Starlover_jacob Level 1
              Thanx , that did the trick.

              my code is:
              <?xml version="1.0" encoding="utf-8"?>
              <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">
              <mx:Script>
              <![CDATA[
              private function checkbold ():void
              {
              if(boldtext.selected==true)
              {
              //maak de tekst niet bold
              sample_label.setStyle("fontWeight","normal");
              }
              if(boldtext.selected==false)
              {
              //maak de tekst bold
              sample_label.setStyle("fontWeight","bold");
              }
              }
              private function checkitalic ():void
              {
              if(italictext.selected==true)
              {
              //maak de tekst niet cursief
              sample_label.setStyle("fontStyle","normal");
              }
              if(italictext.selected==false)
              {
              //maak de tekst cursief
              sample_label.setStyle("fontStyle","italic");
              }
              }
              private function checkunderline ():void
              {
              if(underlinetext.selected==true)
              {
              //maak de tekst niet onderstreept
              sample_label.setStyle("textDecoration","none");
              }
              if(underlinetext.selected==false)
              {
              //maak de tekst onderstreept
              sample_label.setStyle("textDecoration","underline");
              }
              }
              ]]>
              </mx:Script>


              <mx:Button x="137" y="70" label="B" width="26" fontWeight="bold" toggle="true" id="boldtext" mouseUp="checkbold()"/>
              <mx:Button x="171" y="70" label="I" width="26" fontStyle="italic" toggle="true" id="italictext" mouseUp="checkitalic()"/>
              <mx:Button x="205" y="70" label="U" width="26" textDecoration="underline" toggle="true" id="underlinetext" mouseUp="checkunderline()"/>

              <mx:Label text="Voorbeeldlink"
              horizontalCenter="0"
              verticalCenter="0"
              color="{selectfontcolor.selectedColor}"
              fontFamily="{selectfont.selectedItem.label}"
              fontSize="{selectfontsize.selectedItem.label}"
              fontWeight="normal"
              fontStyle="normal"
              textDecoration="none"
              id="sample_label"/>

              </mx:Application>