2 Replies Latest reply on Apr 6, 2008 3:39 PM by jfrumar

    Change state of custom skin

    jfrumar
      Quite simply, I want to access MySkin.currentState = 'over'.

      Is this possible? If so, how am I supposed to get a handle on the skin?

        • 1. Re: Change state of custom skin
          peterent Level 2
          Skin classes are very lightweight and do not support states. You can write your own skin class to extend UIComponent, but it will be at the cost of being heavy.

          What should happen is that your skin should examine its name property and use that determine how it should appear. Then you assign the styles:

          yourComponet {
          upSkin: ClassReference("YourSkin");
          overSkin: ClassReference("YourSkin");
          // etc
          }
          • 2. Re: Change state of custom skin
            jfrumar Level 1
            Hi Peter,

            Thanks lots for your quick reply.

            Here's the situation in a little more detail:

            - I have created a skin in Flash CS3 Professional which is exported as class mx.flash.UIMovieClip using the Flex Component Kit. As a result, it has 4 frames with labels (i.e. up,down,over,disabled).
            - I am exporting to an SWC, and compiling that into my flex SWF.
            - I set the skin in the <Style> section as the single "skin: ..." statement. Flex handles the events using those named frames in the Flash Component.

            Now here's what I'm trying to achieve:

            - When I hover over the button, the skin switches to the "up" frame from the Flash component. This is what I want to be able to trigger programatically.
            - So I think I need to get a handle on that skin class, so I can set skinClass.currentState = 'over' or something to that effect.

            Does this make more sense?

            Thanks!