getting started with starling and feathers

26
Getting Started with Starling and Feathers HAWAII FLASH USER GROUP - FEBRUARY 11 2014

Upload: joseph-labrecque

Post on 09-May-2015

5.666 views

Category:

Documents


5 download

DESCRIPTION

In this presentation, Joseph Labrecque shows you how to use the Feathers and Starling user interface frameworks along with Stage3D to build out mobile applications with Adobe AIR. We'll cover the history of Stage3D and Starling, see how to get both Starling and Feathers libraries integrated within a Flash Builder project, configure the Starling stage, and instantiate Feathers components within Starling classes to provide functional user interface elements within both games and apps. Mobile AIR has Stage3D capabilities and a set of solid frameworks to use it easily - no excuses!

TRANSCRIPT

Page 1: Getting Started with Starling and Feathers

Getting Started with

Starling and FeathersHAWAII FLASH USER GROUP - FEBRUARY 11 2014

Page 2: Getting Started with Starling and Feathers

Introduction

Flash Runtimes – What’s New?

Stage3D Overview

Starling Overview

Feathers Overview

Setting up Starling

Working with Feathers

Page 3: Getting Started with Starling and Feathers

Joseph Labrecque

Senior Interactive Software Engineer | Adjunct FacultyUniversity of Denver

Proprietor | OwnerFractured Vision Media, LLC

Adobe Community ProfessionalAdobe Education LeaderAdobe Certified ExpertAdobe Certified EducatorAdobe Influencer

AuthorLynda.com | Peachpit Press | Adobe Press | Packt Publishing | O’Reilly Media | video2brain

ArtistAn Early Morning Letter, Displaced | shivervein

Page 4: Getting Started with Starling and Feathers

Flash Player 12 / AIR 4

Released in December 2013

New number cycle

Quarterly releases

Flash Player 13 / AIR 13 on Labs

Page 5: Getting Started with Starling and Feathers

What’s new with the Runtimes?

Flash Player 12 / AIR 4

Improved Packaging Engine - iOS - BETA

Graphics: Buffer Usage flag for Stage3D

Mobile Workers (concurrency) - Android

Support for native resources access by R* mechanism in ANE - Android

Stage3D Creation of Context3D with Profile Array

Flash Player 13 beta / AIR 13 beta

Nothing major announced

Page 6: Getting Started with Starling and Feathers

Stage3D Overview

GPU accelerated graphics

Desktop and mobile

AGAL

3rd Party Frameworks:

Starling

Away3D

Citrus

Many, many others…

Page 7: Getting Started with Starling and Feathers

What is Starling?

Stage3D Game Engine (2D)

Open Source

DisplayList-like API

Plugin Architecture

Supported by Adobe

Page 8: Getting Started with Starling and Feathers

What is Feathers?

UI Components for Starling

Open Source

Fully Skinnable

Supported by Adobe

Page 9: Getting Started with Starling and Feathers

Configure Starling

STARLING

Sets up the GPU stuff for us.

Build a Starling instance.

Load in Feathers!

Page 10: Getting Started with Starling and Feathers

Starling Setup

Import the Starling classes.

Declare a new Starling instance.

Optionally set Starling to handle

lost context and multitouch.

Instantiate a new Starling

instance, passing in both a main

class and the stage to bind it to.

Start up the instance.

import starling.core.Starling;

private var starling:Starling;

Starling.handleLostContext = true;

Starling.multitouchEnabled = false;

starling = new Starling(Main, stage);

starling.start();

Page 11: Getting Started with Starling and Feathers

Main Starling Class

Import the Starling Sprite class.

Have the main Starling class extend Starling

Sprite.

We are now ready for Feathers.

import starling.display.Sprite;

public class Main extends Sprite {}

Page 12: Getting Started with Starling and Feathers

Instantiate Feathers

FEATHERS

Implement a theme.

Apply a ScreenNavigator

Decide upon a Layout or two.

Build out the content.

Page 13: Getting Started with Starling and Feathers

Feathers Setup

Import a Feathers theme for use in the app.

Wait for the Stage to become ready.

Instantiate a new Feathers theme within the

main Starling class once the Stage is ready.

Feathers is now ready and skinned.

import feathers.themes.FeathersTheme;

this.addEventListener(

Event.ADDED_TO_STAGE, onStageReady);

new FeathersTheme();

Page 14: Getting Started with Starling and Feathers

Feathers Screens

Similar to mobile Flex Views.

Many individual Screens.

Use with a ScreenNavigator.

Optionally bind Screen controls to

Feathers components like TabBar or

ButtonGroup.

Page 15: Getting Started with Starling and Feathers

Building a ScreenNavigator

Import the Feathers ScreenNavigator

class to hold and manage our screens.

Declare and instantiate the

ScreenNavigator instance.

Add the instance to the display.

import feathers.controls.ScreenNavigator;

private var screenNavigator:ScreenNavigator =

new ScreenNavigator();

addChild(screenNavigator);

Page 16: Getting Started with Starling and Feathers

Building Screens

Create a new class for each screen

which extends the Feathers Screen

class.

Override the initialize function for

instantiating and building objects.

Override the draw function for

managing the size and layout of

objects.

import feathers.controls.Screen;

public class ParticleScreen extends Screen {}

override protected function initialize():void {}

override protected function draw():void {}

Page 17: Getting Started with Starling and Feathers

Populating ScreenNavigator

Import the Feathers

ScreenNavigatorItem class and our

Screen classes.

Declare various screens as constants.

Use ScreenNavigator.addScreen() to

populate the ScreenNavigator with

references to our Screen classes.

Use ScreenNavigator.showScreen() to

switch screens.

import feathers.controls.ScreenNavigatorItem;

import com.josephlabrecque.demo.screens.MyScreen;

private static const SCREEN:String = “myScreen”;

screenNavigator.addScreen(SCREEN, new

ScreenNavigatorItem(MyScreen));

screenNavigator.showScreen(SCREEN);

Page 18: Getting Started with Starling and Feathers

Feathers Components

Similar to Flex components.

Buttons, Callouts, Headers, Lists,

Loaders, Labels, Steppers, Panels,

Pickers, Radios, Checkboxes,

Containers, Sliders, TabBars,

TextAreas, TextInputs, Toggles,

and more…

All GPU accelerated through Starling!

Page 19: Getting Started with Starling and Feathers

Using Components

Import the Feathers component we

want to use – Button, in this example.

Declare the Button instance.

Instantiate the instance within the

initialize function.

Adjust visual properties within the

draw function.

import feathers.controls.Button;

private var myButton:Button;

override protected function initialize():void {

myButton = new Button();

myButton.label = “Click Me";

addChild(myButton);

}

override protected function draw():void {

myButton.validate();

myButton.y = 500;

}

Page 20: Getting Started with Starling and Feathers

Feathers Layouts

Lots of similarities to Flex layouts.

Horizontal

Vertical

Tiled (rows/columns)

Anchored

Lots of options for each!

Page 21: Getting Started with Starling and Feathers

Creating Layouts

Import the specific Feathers layout

classes you intend to use.

Declare your layout for later use.

Instantiate your layout and set the

optional properties of that specific

layout.

import feathers.layout.VerticalLayout;

private var layout:VerticalLayout;

layout = new VerticalLayout();

layout.horizontalAlign = VerticalLayout.HORIZONTAL_ALIGN_CENTER;

layout.verticalAlign = VerticalLayout.VERTICAL_ALIGN_MIDDLE;

layout.hasVariableItemDimensions = true;

Page 22: Getting Started with Starling and Feathers

Applying Layouts

We’re applying our layout to a

LayoutGroup – so be sure you have

imported the Feathers LayoutGroup class.

Declare and then instantiate a new

LayoutGroup instance.

Set the previously created layout object to

the layout property of your LayoutGroup .

Add the LayoutGroup instance to the

view.

import feathers.controls.LayoutGroup;

private var container:LayoutGroup;

container = new LayoutGroup();

container.layout = layout;

this.addChild(container);

Page 23: Getting Started with Starling and Feathers

Future Explorations

“StarlingJS”

Away Foundation

TypeScript

Canvas

WebGL

Page 24: Getting Started with Starling and Feathers

Building a Mobile App with

Feathers and Starling Downloading the frameworks and

the AIR SDK

Configuring the project

Implementing a theme

Creating the screen classes

Adding a navbar component

Building the classes

Returning saved files

Publishing a project

Installing and running the app

http://www.lynda.com/JosephLabrecque

Page 25: Getting Started with Starling and Feathers

Emergent Collective Three

Compilation album series produced to

showcase the aural talent which exists within

the general “creative” and “developer”

communities.

Deadline: March 13th 2014

Email: [email protected]

More info:

http://inflagrantedelicto.memoryspiral.com

/2014/01/emergent-collective-three/

Page 26: Getting Started with Starling and Feathers

Thanks. Questions?

CONTACT JOSEPH

@JosephLabrecque

JosephLabrecque.com

[email protected]