5 Replies Latest reply on Jul 14, 2008 6:08 AM by zaharovsa

    Bitmap   as Button icon?

    zaharovsa
      I got a Bitmap - want to use it as Botton icon which accepts Class only , how to do ?
        • 1. Re: Bitmap   as Button icon?
          Level 1
          Like this

          [Embed(source="path to your image")]
          [Bindable]
          public var yourImg_sm:Class;
          • 2. Re: Bitmap   as Button icon?
            Gregory Lafrance Level 6
            Two ways to do this:
            • 3. Re: Bitmap   as Button icon?
              zaharovsa Level 1
              i have this
              import mx.controls.Image;
              import mx.utils.Base64Decoder;
              import mx.controls.Button;


              private var img:Image = new Image();

              private function init():void
              {
              var imgBase64:String = "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAg Y0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAStJREFUOE9jYBg0oHDW8/9NC57/z5z4+D 8uR4W3P8Apx5A789n/VUfe/8elKL77wf/ghmu4DciY8vT/wn0fsCqK73n4f+n+///9qy/gNiCh58n/aVveYyiKaL8P 1pw56/9/r9ITuA2I7Hr0v3f1BxRFoa33wJpb1wFt7/z73yX/AG4DApsf/q+b/w6uKLjl7v9Fe///7wBqzpjz879d3c //9hnbcRvgUXX/f/60NyiK7Ipv/0+f8/u/f9e3/zqF7/5bJKzHbYB96d3/2ZNfYyjSTzn/36ToxX+VrE//jSOX4TbA Iu/O/9T+11gVGSSd+C+b9vW/bvA83AYYZt3+H9byEqci/dTL/zV8p+E2QCftxn+/6od4Fal4TMBtgFPulf8gBXgVDZ qMh+wQAPB2wKsSwCgmAAAAAElFTkSuQmCC";

              b.height = 20
              b.width = 20
              Base64toImage(imgBase64);

              this.addChild(b);
              }
              private function Base64toImage(base64string:String):void
              {
              var base64Decoder:Base64Decoder = new Base64Decoder();
              base64Decoder.decode(base64string);
              var loader:Loader = new Loader();
              loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadCompleteHandler);
              loader.loadBytes(base64Decoder.flush());
              }

              private function loadCompleteHandler (e:Event):void
              {
              var bm:Bitmap = (e.target as LoaderInfo).content as Bitmap;
              img.source = bm;
              }

              How we can put BM in the button ico?
              • 4. Re: Bitmap   as Button icon?
                Karl_Sigiscar_1971 Level 3

                button.setStyle("icon", iconClass);
                • 5. Re: Bitmap   as Button icon?
                  zaharovsa Level 1
                  what is - iconClass ?