I am new to Flex. can you provide me with an example for writing a
custom skinning class which will extend the ButtonSkin class of
Flex, which can be applied to any custom component across my
application.

This is what I tried:

CUSTOM BUTTON CLASS

package org.tis.inetoo.common.components.controls
{
      import mx.controls.Button;
                          
      public class TISButton extends Button
      {     
            public function TISButton()
            {
                  super();
            }
      }
}

APPLICATION INTERFACE

<?xml version="1.0" encoding="utf-8"?>
<mx:HDividedBox horizontalGap="0" verticalGap="1"
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:cmp="org.tis.inetoo.common.components.custom.*"
xmlns:comp="org.tis.inetoo.common.components.controls.*"
width="100%" height="100%" creationComplete="createObject()">
      <mx:Script>
            <![CDATA[
                  import
org.tis.inetoo.common.skinning.TISGLBSkinButton;
           
                  [EMAIL PROTECTED](source="assets/images/up.gif")]
                  public var up:Class;
                 
                  [EMAIL PROTECTED](source="assets/images/over.gif")]
                  public var over:Class;
                 
                  [EMAIL PROTECTED](source="assets/images/down.gif")]
                  public var down:Class;
                 
                  import
org.tis.inetoo.common.components.controls.TISButton;
                  import mx.controls.Alert;
                  import org.tis.inetoo.event.LoginEvent;
                  import org.tis.inetoo.common.*;
                  import org.tis.inetoo.model.*;
                  import mx.controls.Button;
                  import flash.display.*;
                 
                  [Bindable]
                     public var model:LoginModel =
LoginModel.getInstance();
                     public var loginEvent:LoginEvent = new
LoginEvent();

                     public var fPasswd:TISButton;
                                         
                     public function createObject():void
                     {
                           fPasswd = new TISButton();
                           fPasswd.label = "Forgot your
password?";
                        loginPanel.addChild(fPasswd);
                      fPasswd.setStyle("upSkin",up);
                      fPasswd.setStyle("overSkin",over);
                      fPasswd.setStyle("downSkin",down);
               }
            ]]>
      </mx:Script>
            <mx:Panel id="loginBGImage" width="75%"
height="100%">
                  <mx:Image id="inetooImg"
source="assets/images/inetoo_bg.jpg"/>
            </mx:Panel>
            <cmp:LeftNavigation/>
            <mx:Panel id="loginPanel" width="25%" height="100%">
                  <mx:Label text="INETOO" autoSize="right"/>
                  <mx:Label text="Username" autoSize="right"/>
                  <mx:TextInput id="username"
text="{model.loginName}" change="{model.loginName=username.text}"/>
                  <mx:Label text="Password" autoSize="center"/>
     
                  <mx:HBox>
                        <mx:TextInput id="password"
text="{model.loginPassword}"
change="{model.loginPassword=password.text}"/>
                        <mx:Button id="submit" label="Login"
click="loginEvent.onLoginClick(event);"/>
                  </mx:HBox>
                  <!--<mx:Button label="Forgot your
password?"/>
                  <comp:TISButton label="Forgot your
password?"/>-->
            </mx:Panel>
</mx:HDividedBox>







--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to