How to use the Feathers ScreenNavigator
component
The ScreenNavigator
class supports navigation between screens or pages. It is best suited for working with a set of screens in a flat hierarchy.
Events dispatched from the active screen can be used to trigger navigation. Navigation can be enhanced with animation, called a transition. Feathers provides a number of transitions out of the box, and a simple API lets you create custom transitions.
The Basics
First, let's create a ScreenNavigator
component and add it to the display list:
this._navigator = new ScreenNavigator();
this.addChild( this._navigator );
You may also set its width
and height
, but that's optional because the ScreenNavigator
will automatically resize itself to fill the entire stage, if you don't provide explicit dimensions.
To add a new screen that the navigator can show, call addScreen()
and pass in an ID string to associate with the screen along with a ScreenNavigatorItem
:
var mainMenuItem:ScreenNavigatorItem = new ScreenNavigatorItem( MainMenuScreen );
this._navigator.addScreen( "mainMenu", mainMenuItem );
This screen's ID is "mainMenu"
. We'll use this ID later when we ask the screen navigator to display this screen. There are a number of other APIs that require this ID too.
The first argument required by the ScreenNavigatorItem
constructor may be one of three types. We can pass in a Class
to instantiate, a display object that has already been instantiated, or a Function
that returns a display object. In most cases, a Class
is recommended. For more details, see the screen
property.
To show a specific screen, call showScreen()
, and pass in the screen's ID. We'll use the "mainMenu"
string that we registered with addScreen()
earlier:
this._navigator.showScreen( "mainMenu" );
To access the currently visible screen, use the activeScreen
property.
var mainMenu:MainMenuScreen = MainMenuScreen( this._navigator.activeScreen );
You can also use activeScreenID
to get the ID of the active screen. In this case, again, it would be "mainMenu"
.
To make the ScreenNavigator
remove the active screen, call clearScreen()
.
this._navigator.clearScreen();
Navigation
If the active screen dispatches an event, the ScreenNavigator
can listen for it to automatically navigate to another screen.
Before we get to that, let's make a couple of changes to our existing code. First, let's move the main menu screen's ID into a constant. Then, let's add a second screen.
private static const MAIN_MENU:String = "mainMenu";
private static const OPTIONS:String = "options";
The constants will help us avoid typing mistakes that the compiler can easily catch. Let's use the MAIN_MENU
constant in the call to addScreen()
:
var mainMenuItem:ScreenNavigatorItem = new ScreenNavigatorItem( MainMenuScreen );
this._navigator.addScreen( MAIN_MENU, mainMenuItem );
You probably noticed that we defined an OPTIONS
constant too. Let's add the options screen that goes with it:
var optionsItem:ScreenNavigatorItem = new ScreenNavigatorItem( OptionsScreen );
this._navigator.addScreen( OPTIONS, optionsItem );
Now that we have a second screen, let's look at how we can navigate from the main menu to the options screen.
Dispatch events from the screen
The best way to navigate from one screen to another is to dispatch an event from the currently active screen. Using the ScreenNavigatorItem
, we can map an event to a screen indentifier. The ScreenNavigator
will automatically navigate to a different screen when one of these events is dispatched. Let's map an event from the main menu screen that will navigate to the options screen:
var mainMenuItem:ScreenNavigatorItem = new ScreenNavigatorItem( MainMenuScreen );
mainMenuItem.setScreenIDForEvent( MainMenuScreen.SHOW_OPTIONS, OPTIONS );
this._navigator.addScreen( MAIN_MENU, mainMenuItem );
Using setScreenIDForEvent()
, we tell the ScreenNavigatorItem
that the screen navigator should navigate to the screen with the OPTIONS
ID when MainMenuScreen.SHOW_OPTIONS
is dispatched by the MainMenuScreen
.
Inside MainMenuScreen
, we can add a constant named SHOW_OPTIONS
that we'll use as an event type:
public static const SHOW_OPTIONS:String = "showOptions";
Then, we might dispatch this event when a button is triggered:
protected function optionsButton_triggeredHandler( event:Event ):void
{
this.dispatchEventWith( SHOW_OPTIONS );
}
Next, let's repeat the process with the options screen to navigate back to the main menu screen when an event is dispatched.
var optionsItem:ScreenNavigatorItem = new ScreenNavigatorItem( OptionsScreen );
optionsItem.setScreenIDForEvent( Event.COMPLETE, MAIN_MENU );
this._navigator.addScreen( OPTIONS, optionsItem );
Inside OptionsScreen
, we might dispatch an event when a button is triggered, similar to how we did it in MainMenuScreen
. This time, we'll just use the built in Event.COMPLETE
constant instead of defining a new one:
protected function optionsButton_triggeredHandler( event:Event ):void
{
this.dispatchEventWith( Event.COMPLETE );
}
Now, we can navigate back and forth between the two screens.
We can call setScreenIDForEvent()
as many times as needed to listen for multiple events.
Animated Transitions
As we learned above, we can either show a screen or we can clear the currently active screen. Each of these actions can be animated, improving the user experience and adding a little bit of life to our games and apps. This animation during navigation is called a transition.
We can find a number of useful transition classes in the feathers.motion
package. One example is the Fade
class, which fades a screen by animating its alpha
property.
Each of the built-in transition classes has one or more static methods that you can call to create a transition function that screen navigator calls when navigating to a different screen. In this case, let's call Fade.createFadeInTransition()
.
We can pass the result to the screen navigator's transition
property:
this._navigator.transition = Fade.createFadeInTransition();
In the code above, we didn't pass any arguments to Fade.createFadeInTransition()
. However, this function exposes some optional parameters that we can customize, if desired. For instance, we might want to customize the duration of the animation (in seconds) and the easing function:
this._navigator.transition = Fade.createFadeInTransition( 0.75, Transitions.EASE_IN_OUT );
Now, the animation will last a little longer while easing in and out.
Events when transitions start and complete
A ScreenNavigator
dispatches FeathersEventType.TRANSITION_START
when a new screen is being shown and the transition animation begins. Similarly, it dispatches FeathersEventType.TRANSITION_COMPLETE
when the transition animation has ended.
Let's listen for FeathersEventType.TRANSITION_COMPLETE
:
this._navigator.addEventListener( FeathersEventType.TRANSITION_COMPLETE, navigator_transitionCompleteHandler );
The event listener might look like this:
private function navigator_transitionCompleteHandler( event:Event ):void
{
// do something after the transition animation
}
Property Injection
Optionally, we can pass properties to the screen before it is shown. If we have multiple screens that need to share some data, this is a useful way to ensure that each screen has access to it. For instance, we might have an OptionsData
class that stores things like audio volume and other common options. We'd want to pass that to the OptionsScreen
to let the user change the volume, obviously. We'd also want to pass it to other screens that play audio so that it plays at the correct volume.
In the class where we create the ScreenNavigator
, let's create an OptionsData
instance too. In a moment, we'll pass it to each screen that needs it.
this._optionsData = new OptionsData();
Now, when we add our OptionsScreen
to the ScreenNavigator
, we pass it the OptionsData
instance in using the properties
property on the ScreenNavigatorItem
:
var optionsItem:ScreenNavivatorItem = new ScreenNavigatorItem( OptionsScreen );
optionsItem.properties.options = this._optionsData;
In OptionsScreen
, we need to add a variable or a getter and setter named options
to match up with optionsItem.properties.options
:
protected var _options:OptionsData;
public function get options():OptionsData
{
return this._options;
}
public function set options( value:OptionsData ):void
{
this._options = value;
}
We want to update the screen when the options
property changes, so we should invalidate the screen, and the draw()
function will be called again:
public function set options( value:OptionsData ):void
{
if(this._options == value)
{
return;
}
this._options = value;
this.invalidate( INVALIDATION_FLAG_DATA );
}
Advanced Functionality
ScreenNavigator
offers a number of advanced features to customize navigation behavior.
Call a function instead of navigating to a different screen
The ScreenNavigatorItem
event map can be used for more than simply navigating from one screen to another. You can also call a function when an event or signal is dispatched. Let's add a new event to the main menu that will be dispatched when an "About Our Product" button is clicked. We want it to open a website in the browser.
var mainMenuItem:ScreenNavigatorItem = new ScreenNavigatorItem( MainMenuScreen );
mainMenuItem.setScreenIDForEvent( MainMenuScreen.SHOW_OPTIONS, OPTIONS );
mainMenuItem.setFunctionForEvent( MainMenuScreen.LINK_TO_HOME_PAGE, openHomePageLink );
The function may optionally receives the event listener arguments.
protected function openHomePageLink():void
{
navigateToURL( new URLRequest( "http://www.example.com/" ), "_blank" );
}
Optionally, the function may receive the listener arguments for the event dispatched by the screen, if needed:
protected function openHomePageLink( event:Event ):void
Listen to signals instead of events
Alternatively, you may use the as3-signals library instead of events to trigger navigation. Feathers doesn't actually require as3-signals as a dependency, but at runtime, Feathers will check to see if as3-signals is compiled into the SWF. If it is, then the screen navigator will enable special behavior to check if the event map is referring to an event or a signal.
If as3-signals has been detected, the ScreenNavigator
will first check a screen for a signal that's a public property before falling back to adding an event listener. For example, if the event map defines an "complete"
key, the ScreenNavigator
will check of the screen has a property named complete
. If the property exists, in must implement the ISignal
interface. If both of these conditions are true, a listener will be added to the signal. If either condition is false, then the ScreenNavigator
will fall back to adding a listener for the "complete" event instead.
Let's rework the example above to use signals instead of events. Let's start with changing how MainMenuScreen
is added to the ScreenNavigator
:
var mainMenuItem:ScreenNavigatorItem = new ScreenNavigatorItem( MainMenuScreen );
mainMenuItem.setScreenIDForEvent( "onOptions", OPTIONS );
this._navigator.addScreen( MAIN_MENU, mainMenuItem );
Inside MainMenuScreen
, we add a signal called onOptions
that will automatically be detected when the ScreenNavigator
reads the event map:
protected var _onOptions:Signal = new Signal();
public function get onOptions():ISignal
{
return this._onOptions;
}
The MainMenuScreen
might dispatch onOptions
when a button is triggered:
protected function optionsButton_triggeredHandler( event:Event ):void
{
this._onOptions.dispatch();
}
Modifying OptionsScreen
to use signals instead of events would be the same.


|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.openflow.util.Unsigned
public class Unsigned
A util library class for dealing with the lack of unsigned datatypes in Java
| Constructor Summary | |
|---|---|
Unsigned()
|
| Method Summary | |
|---|---|
static short |
getUnsignedByte(java.nio.ByteBuffer bb)
Get an unsigned byte from the current position of the ByteBuffer |
static short |
getUnsignedByte(java.nio.ByteBuffer bb,
int offset)
Get an unsigned byte from the specified offset in the ByteBuffer |
static long |
getUnsignedInt(java.nio.ByteBuffer bb)
Get an unsigned int from the current position of the ByteBuffer |
static long |
getUnsignedInt(java.nio.ByteBuffer bb,
int offset)
Get an unsigned int from the specified offset in the ByteBuffer |
static java.math.BigInteger |
getUnsignedLong(java.nio.ByteBuffer bb)
Get an unsigned long from the current position of the ByteBuffer |
static java.math.BigInteger |
getUnsignedLong(java.nio.ByteBuffer bb,
int offset)
Get an unsigned long from the specified offset in the ByteBuffer |
static int |
getUnsignedShort(java.nio.ByteBuffer bb)
Get an unsigned short from the current position of the ByteBuffer |
static int |
getUnsignedShort(java.nio.ByteBuffer bb,
int offset)
Get an unsigned short from the specified offset in the ByteBuffer |
static void |
putUnsignedByte(java.nio.ByteBuffer bb,
short v)
Put an unsigned byte into the specified ByteBuffer at the current position |
static void |
putUnsignedByte(java.nio.ByteBuffer bb,
short v,
int offset)
Put an unsigned byte into the specified ByteBuffer at the specified offset |
static void |
putUnsignedInt(java.nio.ByteBuffer bb,
long v)
Put an unsigned int into the specified ByteBuffer at the current position |
static void |
putUnsignedInt(java.nio.ByteBuffer bb,
long v,
int offset)
Put an unsigned int into the specified ByteBuffer at the specified offset |
static void |
putUnsignedLong(java.nio.ByteBuffer bb,
java.math.BigInteger v)
Put an unsigned long into the specified ByteBuffer at the current position |
static void |
putUnsignedLong(java.nio.ByteBuffer bb,
java.math.BigInteger v,
int offset)
Put an unsigned long into the specified ByteBuffer at the specified offset |
static void |
putUnsignedShort(java.nio.ByteBuffer bb,
int v)
Put an unsigned short into the specified ByteBuffer at the current position |
static void |
putUnsignedShort(java.nio.ByteBuffer bb,
int v,
int offset)
Put an unsigned short into the specified ByteBuffer at the specified offset |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Unsigned()
| Method Detail |
|---|
public static short getUnsignedByte(java.nio.ByteBuffer bb)
bb
- ByteBuffer to get the byte from
public static short getUnsignedByte(java.nio.ByteBuffer bb, int offset)
bb
- ByteBuffer to get the byte fromoffset
- the offset to get the byte from
public static void putUnsignedByte(java.nio.ByteBuffer bb, short v)
bb
- ByteBuffer to put the byte intov
- the short containing the unsigned bytepublic static void putUnsignedByte(java.nio.ByteBuffer bb, short v, int offset)
bb
- ByteBuffer to put the byte intov
- the short containing the unsigned byteoffset
- the offset to insert the unsigned byte atpublic static int getUnsignedShort(java.nio.ByteBuffer bb)
bb
- ByteBuffer to get the byte from
public static int getUnsignedShort(java.nio.ByteBuffer bb, int offset)
bb
- ByteBuffer to get the short fromoffset
- the offset to get the short from
public static void putUnsignedShort(java.nio.ByteBuffer bb, int v)
bb
- ByteBuffer to put the short intov
- the int containing the unsigned shortpublic static void putUnsignedShort(java.nio.ByteBuffer bb, int v, int offset)
bb
- ByteBuffer to put the short intov
- the int containing the unsigned shortoffset
- the offset to insert the unsigned short atpublic static long getUnsignedInt(java.nio.ByteBuffer bb)
bb
- ByteBuffer to get the int from
public static long getUnsignedInt(java.nio.ByteBuffer bb, int offset)
bb
- ByteBuffer to get the int fromoffset
- the offset to get the int from
public static void putUnsignedInt(java.nio.ByteBuffer bb, long v)
bb
- ByteBuffer to put the int intov
- the long containing the unsigned intpublic static void putUnsignedInt(java.nio.ByteBuffer bb, long v, int offset)
bb
- ByteBuffer to put the int intov
- the long containing the unsigned intoffset
- the offset to insert the unsigned int atpublic static java.math.BigInteger getUnsignedLong(java.nio.ByteBuffer bb)
bb
- ByteBuffer to get the long from
public static java.math.BigInteger getUnsignedLong(java.nio.ByteBuffer bb, int offset)
bb
- ByteBuffer to get the long fromoffset
- the offset to get the long from
public static void putUnsignedLong(java.nio.ByteBuffer bb, java.math.BigInteger v)
bb
- ByteBuffer to put the long intov
- the BigInteger containing the unsigned longpublic static void putUnsignedLong(java.nio.ByteBuffer bb, java.math.BigInteger v, int offset)
bb
- ByteBuffer to put the long intov
- the BigInteger containing the unsigned longoffset
- the offset to insert the unsigned long at
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |


Home
Subscribe
About
(current)
Team
Our Team
Brian Littrell
Marketing/ Trendy Guy
A.J. McLean
Chef/ Hot Sauce Connoisseur
Howie Dorough
The Finance Guy
Kevin Richardson
Sits at Computer and Looks Busy


put-workspace-in-docx.Rmd
Documents designed for workshop or classroom participation typically provide information, examples, and prompts with room for participants to respond. The functions described here provide space in a document for written responses.
put_gap()
function inserts a blank space in the document.put_axes()
function inserts an empty coordinate frame in the output document.Both functions work by creating and returning a ggplot2
object.
This function allows the author of Rmd to docx documents to insert a vertical white space of specified height.
The white space is an empty ggplot2
object. The only assignment is the panel background, made with theme(panel.background = element_rect())
.
The usage is put_gap(col = NULL, fill = NULL)
to specify the color of the rectangle border and its fill. Defaults are “transparent”.
The dimensions of the gap are determined when it is printed. For example, to create a 0.75 inch gap in an R Markdown output document, we set the dimension in the knitr
code chunk header,
```{r fig.height = 0.75}
put_gap()
```
produces this output:
With color and fill arguments and an optional width argument in the code chunk header,
```{r fig.height = 0.75, fig.width = 6}
put_gap(col = "black", fill = "gray")
```
Here’s an image from a Word document where space for written responses was created using put_gap()
.
A gap can also be used to force a page break. Alternatively, Norbert Köhler shows how to insert page breaks using Word Styles, see R Markdown: How to insert page breaks in a MS Word document.
put_axes()
creates and prints an empty, 2-dimensional coordinate axes using ggplot2
with no scales, no tick marks, and no axis labels.
Usage is put_axes(quadrant = NULL, col = NULL, size = NULL)
.
quadrant
0 for all quadrants; 1, 2, 3, 4 for a single quadrant; or any combination of adjacent quadrants, e.g., 12, 21, 23, 34, etc. The default is 1.col
is line color. Default is gray60.size
is line size. Default is 0.5.The size of the figure is determined when printed, e.g., using knitr
in an R Markdown script, the figure height in inches is set with the fig.height
code chunk option.
```{r fig.height = 2}
put_axes()
```
The default aspect ratio is 1, though it can be edited using coord_fixed()
from ggplot2
.
The graph object can be edited using the usual ggplot2
annotations. For example, to place some text in the middle of the graph,
We can add text labels to label the axes using annotate()
p <- put_axes() +
annotate("text",
x = c(1, 0), y = c(0, 1)
, label = c("x", "y")
, vjust = c(1, 0.5)
, hjust = c(1, 1.5)
, fontface = "italic"
)
p
Or we can use the usual labs()
after resetting the theme axis.title
,
If we use annotate()
and the label exceeds the data rectangle, we can make the plot margin larger and override the plot clipping.
p <- put_axes(2) +
annotate("text",
x = c(-1, 0), y = c(0, 1)
, label = c("Re", "Im")
, vjust = c(1.5, 0.5)
, hjust = c(0, -0.5)
, fontface = "italic"
) + # top, right, bottom, left
theme(plot.margin = unit(c(0, 5, 2, 0), "mm"))
# override clipping
library(grid)
pp <- ggplot_gtable(ggplot_build(p))
pp$layout$clip[pp$layout$name == "panel"] <- "off"
grid.draw(pp)


This package combines the odesolve and nlme packages for mixed-effects modelling using differential equations.
| Version: | 1.1 |
| Depends: | R (≥ 2.6.0), deSolve, nlme, lattice |
| Published: | 2012-10-27 |
| Author: | Christoffer W. Tornoe |
| Maintainer: | Christoffer W. Tornoe <ctornoe at gmail.com> |
| License: | LGPL-2.1 | LGPL-3 [expanded from: LGPL (≥ 2.1)] |
| URL: | http://www.cran.r-project.org |
| NeedsCompilation: | no |
| In views: | DifferentialEquations |
| CRAN checks: | nlmeODE results |
| Reference manual: | nlmeODE.pdf |
| Package source: | nlmeODE_1.1.tar.gz |
| Windows binaries: | r-devel: nlmeODE_1.1.zip, r-release: nlmeODE_1.1.zip, r-oldrel: nlmeODE_1.1.zip |
| OS X binaries: | r-release: nlmeODE_1.1.tgz, r-oldrel: nlmeODE_1.1.tgz |
| Old sources: | nlmeODE archive |
Please use the canonical form https://CRAN.R-project.org/package=nlmeODE to link to this page.


Thank you for playing the word quiz game. Hopefully, you know meanings of the all words now. Go back to games page >>
Answer: {{quiz.word.word_lookup_word}}
Your guess:
Next Question >> Finish Quiz


Type B Through Hole USB Socket - UTB
Summary
Name: Type B Through Hole USB Socket
ID: USBS-TB-X-THTH-01
Hex ID: UTB
WebPage: https://github.com/oomlout/oomlout-OOMP/wiki/USBS-TB-X-THTH-01
Short URL: http://oom.lt/UTB
Revision History: https://github.com/oomlout/oomlout-OOMP/blob/master/parts/USBS-TB-X-THTH-01/
| Type |
Size |
Color |
Description |
Index |
USBS USB Socket |
TB Type B |
X
|
THTH Through Hole |
01
|
Images
About
This part is awaiting a description.
Specifications
| Info |
Value |
| Type |
USB Socket |
| Size |
Type B |
| Description |
Through Hole |
| Width |
16 mm |
| Height |
10.3 mm |
| Length |
12.2 mm |
| Number of Pins |
4 |
Extra Details
Spotted a mistake, want to add more? Let us know<EMAIL_ADDRESS>All images and resources are licensed [CC BY-SA] unless otherwise stated (ie. the datasheets)


More!
This shows an Enum being displayed as a <select> — there's no need to add the @Select annotation as this is the default for enums.
Boolean (and boolean primitives) are treated the same way.
Click “Save” to see the form values that get submitted by this form.
Submitted values
| Value | Value |