Feathers ui skin replacement

Source: Internet
Author: User

Feathers is a lightweight, easy-to-Customize skin and extended UI component (applicable to mobile devices and desktops ). Feathers uses the Starling framework and powerful GPU rendering components to achieve a smoother and more friendly experience.

It is now a Class Library Supported by Adobe!

Features:

Cross-platform
Easy to customize skin
Free and open source code

 

Here we will mainly talk about how to skin over the skin. Although the official website has provided four sets of themes, Custom Skin is definitely necessary!

Take the BUTTON as an example:

I. Theme skin

Set toptheme skin using TextureAtlas
Note that the setting skin should be used before all controls are instantiated.
This. theme = new AeonDesktopTheme (this. stage );
Before
Var mybtn: Button = new Button ();
AddChild (mybtn );

Custom Skin:

[Embed (source = "/../assets/images/aeon.png")]
Protected static const ATLAS_IMAGE: Class;

[Embed (source = "/../assets/images/aeon. xml", mimeType = "application/octet-stream")]
Protected static const ATLAS_XML: Class;

Method 1, // used to change a single topic
The user-defined skin does not change the original resource file. It inherits the built-in skin and can expand its own skin. The simplest method is as follows:
Http://wiki.starling-framework.org/feathers/extending-themes

Var theme: MetalWorksMobileTheme = new MetalWorksMobileTheme ();
Theme. setInitializerForClass (Button, myCustomButtonInitializer, "my-custom-button"); // the key method to override a topic

Var button: Button = new Button ();
Button. nameList. add ("my-custom-button"); // bind the topic you have defined
This. addChild (button );

// Reset the button topic
Private function myCustomButtonInitializer (button: Button): void
{
Button. defaultSkin = new Image (upTexture );
Button. downSkin = new Image (downTexture );
Button. hoverSkin = new Image (hoverTexture );

Button. defaultLabelProperties. textFormat = new TextFormat ("fontName", 18, 0 xffffff );
}

 

Another method is to change the global topic.
Inherit from the aeontopics toptheme class in

Override protected function initialize (): void
{
Super. initialize ();

This. setInitializerForClass (Button, myCustomButtonInitializer, ALTERNATE_NAME_MY_CUSTOM_BUTTON );
}

Private function myCustomButtonInitializer (button: Button): void
{
Button. defaultSkin = new Image (upTexture );
Button. downSkin = new Image (downTexture );
Button. hoverSkin = new Image (hoverTexture );

Button. defaultLabelProperties. textFormat = this. smallUIDarkTextFormat;
Button. disabledLabelProperties. textFormat = this. smallUIDisabledTextFormat;
Button. selectedDisabledLabelProperties. textFormat = this. smallUIDisabledTextFormat;
}

 

 

Rewrite topic:
Extends DisplayListWatcher:

Override protected function initialize (): void

 

 

 

 

 

Related information:

Http://www.starlinglib.com/wiki/News:Starling_Feathers

  • Download: https://github.com/joshtynjala/feathers/zipball/master
  • API documentation: http://feathersui.com/documentation/
  • Submit Bug: https://github.com/joshtynjala/feathers/issues
  • Getting Started: http://wiki.starling-framework.org/feathers/getting-started
  • FAQ: http://wiki.starling-framework.org/feathers/faq
  • Feathers code style convention: http://wiki.starling-framework.org/feathers/coding-conventions
Instance demo
  • Components Explorer
  • Layout Explorer
  • Tile List
  • Gallery
  • Display Object Explorer

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.