- 浏览: 349932 次
- 性别:
- 来自: 深圳
文章分类
- 全部博客 (354)
- Flash | as3 (53)
- AIR | Starling (46)
- Android (55)
- Java (10)
- C++ (6)
- PHP (43)
- IOS (9)
- Unity3D (2)
- cocos2d-x (1)
- OpenGL (2)
- WebGL (3)
- Server (4)
- MemCache (13)
- MySql (2)
- NoSql (2)
- PhoneGap (13)
- jQuery | jQuery Mobile (14)
- javaScript | html5 | css3 (14)
- Linux (1)
- Box2D (2)
- SmartFox (1)
- Ruby (0)
- Python (2)
- Golang (11)
- Redis (1)
- 开源项目 (6)
- 游戏策划 (1)
- 云平台 (2)
- 项目管理 (6)
- 听见月光 (32)
最新评论
-
kenkao:
http://www.linuxidc.com/Linux/2 ...
解决idea编译时resources文件夹内容不自动复制到输出路径classes的问题 -
kenkao:
http://blog.csdn.net/yanwushu/a ...
解决idea编译时resources文件夹内容不自动复制到输出路径classes的问题 -
wpy126:
你这种比较根本不公平AppCan 用了多个页面,jqm内容都 ...
AppCan VS PhoneGap - 对比两大移动开发平台 -
kenkao:
zs12593 写道这个,这个
这里只是转载,建议看一下原文, ...
android游戏开发框架libgdx环境搭建 -
zs12593:
这个,这个
android游戏开发框架libgdx环境搭建
Getting Started with Feathers
from:http://wiki.starling-framework.org/feathers/getting-started
In the following beginner-level tutorial, we'll create our first Feathers Button control. This is a very simple demonstration that sets a label, adds an event listener, and creates a theme that will apply a skin.
-
You should understand how to set up a regular Starling project. Please start with the Starling guides and tutorials, if you're new to Starling.
-
The complete source code for the Hello World example is included with Feathers, so that you can follow along. You may also view the most recent version of the source code on Github.
See the Hello World example running live in your browser. Requires Adobe Flash Player.
Download feathers from here: http://feathersui.com/download/ (At the moment of writing, the last stable version is “1.0 beta”). Unzip, find ”/feathers-1.0.0-beta/swc/feathers.swc” and copy it to the folder you use for '.swc' files. Now we should tell IDE where it can find feathers. In Flash Professional CS6:
-
Go to 'Edit → Preferences → (Preferences dialog pop-ups)
-
Category: ActionScript → Click 'ActionScript 3.0 Settings'
-
On the right side of 'Library path' click icon with plus and then 'browse for swc' icon
-
Find feathers.swc file and choose it
-
Click 'OK', Click 'OK'.
Now you can use Feathers, as if it were built in ActionScript.
Do the same procedure with Starling if you didn't already. Go to: https://github.com/PrimaryFeather/Starling-Framework. And click 'ZIP' button to download Starling with full source code. But we need only ”/starling/bin/starling.swc”. Add it to 'Library path' in the same way. Now you can use Starling, as if it were built in ActionScript.
If you are getting something like this:
"ArgumentError: Error #1063: Несоответствие количества аргументов в starling.events::TouchEvent/getTouches(). Ожидалось 1, получено 3. (Expected 1 argument, got 3) at feathers.controls::Button/touchHandler() at starling.events::EventDispatcher/invoke() at starling.events::EventDispatcher/bubble() at starling.events::EventDispatcher/dispatchEvent() at starling.display::DisplayObject/dispatchEvent() at TouchProcessor/advanceTime() at starling.core::Starling/advanceTime() at starling.core::Starling/nextFrame() at starling.core::Starling/onEnterFrame()"
Be sure to reload the latest version of Starling from GitHub.com (At the moment of writing - 1.3 RC (Release Candidate) )
Now copy 'assets' and 'source' folders from ”/feathers-1.0.0-beta/themes/MetalWorksMobileTheme” to your project folder. And set 'source' folder as sources folder for this particular project:
-
Select your '.fla' file
-
Go to 'ActionScript 3.0 Settings'
-
Select 'Source path' tab (if it isn't selected)
-
Double click on the only line in the list
-
Replace './' (that is default) with './source'
-
Click OK
Now remember to save all your '.as' files in '/source' folder.
The following class should be the root display object that is initialized with Starling. Here's the basic structure of the class that we'll start with. Most of the code that we add later will go into the addedToStageHandler()
function.
Create '/source/HelloFeathers.as' file with following content:
import starling.display.Sprite; import feathers.themes.MetalWorksMobileTheme; import feathers.controls.Button; import feathers.controls.Label; import feathers.controls.Callout; import starling.events.Event;
public class HelloFeathers extends Sprite { public function HelloFeathers() { this.addEventListener( Event.ADDED_TO_STAGE, addedToStageHandler ); } protected var theme:MetalWorksMobileTheme; protected var button:Button; protected function addedToStageHandler( event:Event ):void { } }
Let's start by initializing a theme. By default, the Feathers components don't have skins. However, a theme can be instantiated in just one line of code, and it will automatically provide skins to all Feathers components that are added to the stage.
this.theme = new MetalWorksMobileTheme( this.stage );
We pass a reference to the stage into the theme's constructor. The theme listens for certain events to detect when a new Feathers component is added to the stage. When a new component is added, the theme will create appropriate skins, including backgrounds, icons, text formats, and skins for sub-components, and pass them in automatically.
MetalWorksMobileTheme
. The Feathers library comes with several themes that you may choose from. Or you can create your own theme.
With the theme created, let's create the button and set it's label:
this.button = new Button(); this.button.label = "Click Me"; this.addChild( button );
If we want to do something when the button is tapped or clicked, we should listen to the Event.TRIGGERED
event.
this.button.addEventListener( Event.TRIGGERED, button_triggeredHandler );
Our listener function should look something like this:
protected function button_triggeredHandler( event:Event ):void { const label:Label = new Label(); label.text = "Hi, I'm Feathers!\nHave a nice day."; Callout.show(label, this.button); }
This triggered listener displays a Label
component in a Callout
component. Like with our button, these two components are automatically skinned by the theme.
Finally, let's position the button in the middle of the stage. First, though, let's take note of one thing about how Feathers controls work. Feathers uses a system of invalidation that delays redraws until just immediately before Starling renders to the screen. This keeps Feathers from using too much CPU by redrawing over and over again when you need to change multiple properties all at once.
At this moment, our button still has width
and height
values of 0
because it hasn't drawn yet. Feathers controls automatically resize themselves to an ideal size when they redraw (unless you explicitly set your own width and height values). This is usually based on the original dimensions of the skins and other children.
In this case, we want to position our button immediately, without waiting for validation. To make a Feathers control draw *right now*, call the validate()
function:
this.button.validate();
Now, we can properly center our button on the stage because it will correctly report appropriate dimensions based on the size of the button's skin and label:
this.button.x = (this.stage.stageWidth - this.button.width) / 2; this.button.y = (this.stage.stageHeight - this.button.height) / 2;
By now you should have:
-
/HelloFeathers.fla (if in Flash Professional CS6)
-
/assets/…
-
/source/feathers/…
-
/source/HelloFeathersStartup.as:
package { import flash.display.MovieClip; import starling.core.*; public class HelloFeathersStartup extends MovieClip { public function HelloFeathersStartup() { var st:Starling = new Starling(HelloFeathers, this.stage); st.showStats = true; st.start(); } } }
-
/source/HelloFeathers.as
package { import starling.display.Sprite; import feathers.themes.MetalWorksMobileTheme; import feathers.controls.Button; import feathers.controls.Label; import feathers.controls.Callout; import starling.events.Event; class HelloFeathers extends Sprite { public function HelloFeathers() { this.addEventListener( Event.ADDED_TO_STAGE, addedToStageHandler ); } protected var theme:MetalWorksMobileTheme protected var button:Button; protected function addedToStageHandler( event:Event ):void { this.theme = new MetalWorksMobileTheme(this.stage); this.button = new Button(); this.button.label = "Click Me"; this.addChild(button); this.button.addEventListener(Event.TRIGGERED, bt); this.button.validate(); this.button.x = (this.stage.stageWidth - this.button.width) / 2; this.button.y = (this.stage.stageHeight - this.button.height) / 2; } private function bt(e:Event):void { const label:Label = new Label(); label.text = "Hi, I'm Feathers!\nHave a nice day."; Callout.show(label, this.button); } } }
Conclusion
That should get you started with the very basics of working with Feathers. For more information about the capabilities of the Button
class, read How to use the Feathers Button component. For the Callout
class, read How to use the Feathers Callout component.
For more extensive sample code, check out the Feathers Examples (and their source code on Github).
For more tutorials, return to the Feathers Documentation.
发表评论
-
AIR:使用 HTML + Javascript 开发桌面应用
2016-10-09 11:59 447AIR:使用 HTML + Javascript 开发桌面应 ... -
Adobe AIR移动App的互相调用实现方式
2016-08-02 15:39 574[转] Adobe AIR移动App的互相调用实现方式 ... -
Flex中动态更新List item
2016-05-16 17:26 452this.listView.dataProvider = ... -
利用Adobe AIR本地扩展支持Android开发
2015-01-13 09:14 1203http://bbs.9ria.com/thread-18 ... -
AcheGesture 简介(使用方法 / 中文教程)
2014-08-12 15:06 884http://blog.zinewow.com/catalo ... -
AIRSDK 3.7 加载远程的含有代码的swf文件
2014-06-13 14:07 679http://cenfee.com/?p=679 ... -
Adobe AIR教程:面向iOS设备的原生扩展
2014-04-16 08:44 1076来自 51CTO:http://mobile.51cto.c ... -
手机游戏开发纹理图片优化心得
2014-01-14 18:32 1266来自:http://blog.csdn.net/langre ... -
ANE内部结构探究
2013-09-30 10:05 976原文地址: http://blog.sina.com.c ... -
开发Adobe AIR移动应用程序的考虑事项
2013-09-14 14:31 564来自:http://www.infoq.com/ ... -
Starling GodRay 效果实现
2013-09-09 11:06 949Starling ‘God Ray’ Filter ... -
去掉图片黑背景输出为透明png(算法和工具)
2013-08-13 11:20 1889去掉图片黑背景输出为透明png(算法和工具) ... -
AIR仿iphone屏幕滑动效果
2013-07-24 09:32 1029=====>下载见附件 -
AcheGesture-开源免费的手势框架
2013-07-06 17:16 740http://bbs.9ria.com/thread-168 ... -
Starling实现的硬皮翻书效果
2013-07-06 16:58 1257原文:Starling实现的 ... -
[ANE for Android]Java接口部分引用第三方JAR的解决办法
2013-07-02 14:50 1223来自:http://bbs.9ria.com/thread- ... -
Adobe AIR教程:ANE面向IAP的测试和开发
2013-06-21 21:48 1265http://mobile.51cto.com/others ... -
Flashdevelop解决ANE报Not supported native extensions profile
2013-06-21 10:23 1601http://hi.baidu.com/silvanote ... -
AIR Android开发--APK结构详解
2013-06-20 11:44 1774转自:http://www.fluidea.cn/blog ... -
Adobe AIR for Android 缓存本地数据常用方法
2015-08-27 11:16 811Local SharedObject 这种方法比较简 ...
相关推荐
Starling Feathers是一款专为Adobe Starling框架设计的UI库,它允许开发者创建美观、高性能的2D用户界面。...结合其详细的API文档(FeathersAPI.CHM),开发者可以深入理解并充分利用这一工具,打造出色的应用体验。
Feathers 2.0.0 是一款专为Starling框架设计的UI组件库,它旨在为Flash开发者提供一套高效、高性能的用户界面...配合压缩包中的资源,开发者可以快速了解并掌握如何在项目中使用Feathers,从而提升开发效率和用户体验。
FeathersUI是一个高级的用户界面组件库,它构建在Starling之上,专为创建桌面和移动应用的用户界面而设计。FeathersUI提供了一系列可定制的组件,如按钮、列表、表单等,这些组件具有触摸友好、响应式布局等特点。...
快速链接新闻与更新最低要求适用于桌面或移动应用程序的Adobe AIR 32.0 适用于Web浏览器的Adobe Flash Player 19.0 Starling Framework 2.6 资料下载要下载Feathers UI的最新稳定版本,请访问feathersui.com 。
Feathers的组件库是基于Starling框架的,这确保了即使在资源有限的移动设备上,也能实现流畅的动画和用户体验。 Starling是一个2D渲染框架,旨在解决Adobe Flash Player和Air在移动设备上的性能问题。它通过使用...
它通过一个实际的Adobe AIR项目,向用户展示了如何利用Starling框架和Feathers库来开发高性能、美观的移动应用。Adobe AIR(Adobe Integrated Runtime)允许开发者使用ActionScript 3或Flex构建桌面和移动设备的应用...
在ahhenderson-desktop-client中,Feathers被用来构建用户友好的图形界面,提供标准的控件和布局,使应用具有良好的用户体验。 **Starling** 是一个高性能的2D图形渲染框架,它是基于Adobe AIR的,用于创建游戏和...
启用高级Telemetry的示例应用包括:Hungry Hero(基于Starling)、Feathers Components Demo(基于Feathers)、Invawayders(基于Away3D)和Backyard Demo(基于Coppercube)。只需在Scout中打开这些链接,即可进行...
- **示例**:已有一些知名项目如Hungry Hero(Starling)、Feathers Components Demo(Feathers)、Invawayders(Away3D)和Backyard Demo(Coppercube)启用了高级Telemetry功能,可直接在Scout中进行分析。...
此外,"flash-class-master"可能还包括了对第三方库或框架的集成,如Starling Framework或Feathers UI,这些都是在现代Flash开发中常见的高性能图形和UI工具。这些库通常提供优化的2D渲染、粒子系统、触摸事件支持等...