starling-framework
Version:
A fast, productive library for 2D cross-platform development.
700 lines (699 loc) • 158 kB
HTML
<!doctype html>
<html class="default no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Starling | starling-framework</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../assets/css/main.css">
</head>
<body>
<header>
<div class="tsd-page-toolbar">
<div class="container">
<div class="table-wrap">
<div class="table-cell" id="tsd-search" data-index="../assets/js/search.js" data-base="..">
<div class="field">
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
<input id="tsd-search-field" type="text" />
</div>
<ul class="results">
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li>
</ul>
<a href="../index.html" class="title">starling-framework</a>
</div>
<div class="table-cell" id="tsd-widgets">
<div id="tsd-filter">
<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
<div class="tsd-filter-group">
<div class="tsd-select" id="tsd-filter-visibility">
<span class="tsd-select-label">All</span>
<ul class="tsd-select-list">
<li data-value="public">Public</li>
<li data-value="protected">Public/Protected</li>
<li data-value="private" class="selected">All</li>
</ul>
</div>
<input type="checkbox" id="tsd-filter-inherited" checked />
<label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
<input type="checkbox" id="tsd-filter-externals" checked />
<label class="tsd-widget" for="tsd-filter-externals">Externals</label>
<input type="checkbox" id="tsd-filter-only-exported" />
<label class="tsd-widget" for="tsd-filter-only-exported">Only exported</label>
</div>
</div>
<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
</div>
</div>
</div>
</div>
<div class="tsd-page-title">
<div class="container">
<ul class="tsd-breadcrumb">
<li>
<a href="../index.html">starling</a>
</li>
<li>
<a href="../modules/starling.core.html">core</a>
</li>
<li>
<a href="starling.core.starling.html">Starling</a>
</li>
</ul>
<h1>Class Starling</h1>
</div>
</div>
</header>
<div class="container container-main">
<div class="row">
<div class="col-8 col-content">
<section class="tsd-panel tsd-comment">
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>The Starling class represents the core of the Starling framework.</p>
</div>
<p>The Starling framework makes it possible to create 2D applications and games that make
use of the Stage3D architecture introduced in Flash Player 11. It implements a display tree
system that is very similar to that of conventional Flash, while leveraging modern GPUs
to speed up rendering.</p>
<p>The Starling class represents the link between the conventional Flash display tree and
the Starling display tree. To create a Starling-powered application, you have to create
an instance of the Starling class:</p>
<pre>starling:Starling = new Starling(Game, stage);</pre>
<p>The first parameter has to be a Starling display object class, e.g. a subclass of
<code>starling.display.Sprite</code>. In the sample above, the class "Game" is the
application root. An instance of "Game" will be created as soon as Starling is initialized.
The second parameter is the conventional (Flash) stage object. Per default, Starling will
display its contents directly below the stage.</p>
<p>It is recommended to store the Starling instance as a member variable, to make sure
that the Garbage Collector does not destroy it. After creating the Starling object, you
have to start it up like this:</p>
<pre>starling.start();</pre>
<p>It will now render the contents of the "Game" class in the frame rate that is set up for
the application (as defined in the Flash stage).</p>
<p> <strong>Context3D Profiles</strong></p>
<p>Stage3D supports different rendering profiles, and Starling works with all of them. The
last parameter of the Starling constructor allows you to choose which profile you want.
The following profiles are available:</p>
<ul>
<li>BASELINE_CONSTRAINED: provides the broadest hardware reach. If you develop for the
browser, this is the profile you should test with.</li>
<li>BASELINE: recommend for any mobile application, as it allows Starling to use a more
memory efficient texture type (RectangleTextures). It also supports more complex
AGAL code.</li>
<li>BASELINE_EXTENDED: adds support for textures up to 4096x4096 pixels. This is
especially useful on mobile devices with very high resolutions.</li>
<li>STANDARD_CONSTRAINED, STANDARD, STANDARD_EXTENDED: each provide more AGAL features,
among other things. Most Starling games will not gain much from them.</li>
</ul>
<p>The recommendation is to deploy your app with the profile "auto" (which makes Starling
pick the best available of those), but to test it in all available profiles.</p>
<p> <strong>Accessing the Starling object</strong></p>
<p>From within your application, you can access the current Starling object anytime
through the static method <code>Starling.current</code>. It will return the active Starling
instance (most applications will only have one Starling object, anyway).</p>
<p> <strong>Viewport</strong></p>
<p>The area the Starling content is rendered into is, per default, the complete size of the
stage. You can, however, use the "viewPort" property to change it. This can be useful
when you want to render only into a part of the screen, or if the player size changes. For
the latter, you can listen to the RESIZE-event dispatched by the Starling
stage.</p>
<p> <strong>Native overlay</strong></p>
<p>Sometimes you will want to display native Flash content on top of Starling. That's what the
<code>nativeOverlay</code> property is for. It returns a Flash Sprite lying directly
on top of the Starling content. You can add conventional Flash objects to that overlay.</p>
<p>Beware, though, that conventional Flash content on top of 3D content can lead to
performance penalties on some (mobile) platforms. For that reason, always remove all child
objects from the overlay when you don't need them any longer.</p>
<p> <strong>Multitouch</strong></p>
<p>Starling supports multitouch input on devices that provide it. During development,
where most of us are working with a conventional mouse and keyboard, Starling can simulate
multitouch events with the help of the "Shift" and "Ctrl" (Mac: "Cmd") keys. Activate
this feature by enabling the <code>simulateMultitouch</code> property.</p>
<p> <strong>Skipping Unchanged Frames</strong></p>
<p>It happens surprisingly often in an app or game that a scene stays completely static for
several frames. So why redraw the stage at all in those situations? That's exactly the
point of the <code>skipUnchangedFrames</code>-property. If enabled, static scenes are
recognized as such and the back buffer is simply left as it is. On a mobile device, the
impact of this feature can't be overestimated! There's simply no better way to enhance
battery life. Make it a habit to always activate it; look at the documentation of the
corresponding property for details.</p>
<p> <strong>Handling a lost render context</strong></p>
<p>On some operating systems and under certain conditions (e.g. returning from system
sleep), Starling's stage3D render context may be lost. Starling will try to recover
from a lost context automatically; to be able to do this, it will cache textures in
RAM. This will take up quite a bit of extra memory, though, which might be problematic
especially on mobile platforms. To avoid the higher memory footprint, it's recommended
to load your textures with Starling's "AssetManager"; it is smart enough to recreate a
texture directly from its origin.</p>
<p>In case you want to react to a context loss manually, Starling dispatches an event with
the type "Event.CONTEXT3D_CREATE" when the context is restored, and textures will execute
their <code>root.onRestore</code> callback, to which you can attach your own logic.
Refer to the "Texture" class for more information.</p>
<p> <strong>Sharing a 3D Context</strong></p>
<p>Per default, Starling handles the Stage3D context itself. If you want to combine
Starling with another Stage3D engine, however, this may not be what you want. In this case,
you can make use of the <code>shareContext</code> property:</p>
<ol>
<li>Manually create and configure a context3D object that both frameworks can work with
(ideally through <code>RenderUtil.requestContext3D</code> and
<code>context.configureBackBuffer</code>).</li>
<li>Initialize Starling with the stage3D instance that contains that configured context.
This will automatically enable <code>shareContext</code>.</li>
<li>Call <code>start()</code> on your Starling instance (as usual). This will make
Starling queue input events (keyboard/mouse/touch).</li>
<li>Create a game loop (e.g. using the native <code>ENTER_FRAME</code> event) and let it
call Starling's <code>nextFrame</code> as well as the equivalent method of the other
Stage3D engine. Surround those calls with <code>context.clear()</code> and
<code>context.present()</code>.</li>
</ol>
<p>The Starling wiki contains a <a href="http://goo.gl/BsXzw">tutorial</a> with more
information about this topic.</p>
<p> @see starling.utils.AssetManager
@see starling.textures.Texture</p>
</div>
</section>
<section class="tsd-panel tsd-hierarchy">
<h3>Hierarchy</h3>
<ul class="tsd-hierarchy">
<li>
<a href="starling.events.eventdispatcher.html" class="tsd-signature-type">EventDispatcher</a>
<ul class="tsd-hierarchy">
<li>
<span class="target">Starling</span>
</li>
</ul>
</li>
</ul>
</section>
<section class="tsd-panel-group tsd-index-group">
<h2>Index</h2>
<section class="tsd-panel tsd-index-panel">
<div class="tsd-index-content">
<section class="tsd-index-section tsd-is-external">
<h3>Constructors</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite tsd-is-external"><a href="starling.core.starling.html#constructor" class="tsd-kind-icon">constructor</a></li>
</ul>
</section>
<section class="tsd-index-section tsd-is-external">
<h3>Properties</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-external"><a href="starling.core.starling.html#antialiasing" class="tsd-kind-icon">anti<wbr>Aliasing</a></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-external"><a href="starling.core.starling.html#contentscalefactor" class="tsd-kind-icon">content<wbr>Scale<wbr>Factor</a></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-external"><a href="starling.core.starling.html#context" class="tsd-kind-icon">context</a></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-external"><a href="starling.core.starling.html#contextvalid" class="tsd-kind-icon">context<wbr>Valid</a></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-external"><a href="starling.core.starling.html#enableerrorchecking" class="tsd-kind-icon">enable<wbr>Error<wbr>Checking</a></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-external"><a href="starling.core.starling.html#frameid" class="tsd-kind-icon">frameID</a></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-external"><a href="starling.core.starling.html#isstarted" class="tsd-kind-icon">is<wbr>Started</a></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-external"><a href="starling.core.starling.html#juggler" class="tsd-kind-icon">juggler</a></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-external"><a href="starling.core.starling.html#nativeoverlay" class="tsd-kind-icon">native<wbr>Overlay</a></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-external"><a href="starling.core.starling.html#nativestage" class="tsd-kind-icon">native<wbr>Stage</a></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-external"><a href="starling.core.starling.html#painter" class="tsd-kind-icon">painter</a></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-external"><a href="starling.core.starling.html#profile" class="tsd-kind-icon">profile</a></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-external"><a href="starling.core.starling.html#root" class="tsd-kind-icon">root</a></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-external"><a href="starling.core.starling.html#rootclass" class="tsd-kind-icon">root<wbr>Class</a></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-external"><a href="starling.core.starling.html#sharecontext" class="tsd-kind-icon">share<wbr>Context</a></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-external"><a href="starling.core.starling.html#showstats" class="tsd-kind-icon">show<wbr>Stats</a></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-external"><a href="starling.core.starling.html#simulatemultitouch" class="tsd-kind-icon">simulate<wbr>Multitouch</a></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-external"><a href="starling.core.starling.html#skipunchangedframes" class="tsd-kind-icon">skip<wbr>Unchanged<wbr>Frames</a></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-external"><a href="starling.core.starling.html#stage" class="tsd-kind-icon">stage</a></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-external"><a href="starling.core.starling.html#stage3d" class="tsd-kind-icon">stage3D</a></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-external"><a href="starling.core.starling.html#supportbrowserzoom" class="tsd-kind-icon">support<wbr>Browser<wbr>Zoom</a></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-external"><a href="starling.core.starling.html#supporthighresolutions" class="tsd-kind-icon">support<wbr>High<wbr>Resolutions</a></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-external"><a href="starling.core.starling.html#touchprocessor" class="tsd-kind-icon">touch<wbr>Processor</a></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-external"><a href="starling.core.starling.html#viewport" class="tsd-kind-icon">view<wbr>Port</a></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-static tsd-is-external"><a href="starling.core.starling.html#version" class="tsd-kind-icon">VERSION</a></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-static tsd-is-external"><a href="starling.core.starling.html#all" class="tsd-kind-icon">all</a></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-static tsd-is-external"><a href="starling.core.starling.html#current" class="tsd-kind-icon">current</a></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-static tsd-is-external"><a href="starling.core.starling.html#multitouchenabled" class="tsd-kind-icon">multitouch<wbr>Enabled</a></li>
</ul>
</section>
<section class="tsd-index-section tsd-is-external">
<h3>Methods</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external"><a href="starling.core.starling.html#addeventlistener" class="tsd-kind-icon">add<wbr>Event<wbr>Listener</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-external"><a href="starling.core.starling.html#advancetime" class="tsd-kind-icon">advance<wbr>Time</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external"><a href="starling.core.starling.html#dispatchevent" class="tsd-kind-icon">dispatch<wbr>Event</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external"><a href="starling.core.starling.html#dispatcheventwith" class="tsd-kind-icon">dispatch<wbr>Event<wbr>With</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-external"><a href="starling.core.starling.html#dispose" class="tsd-kind-icon">dispose</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.core.starling.html#get_antialiasing" class="tsd-kind-icon">get_<wbr>anti<wbr>Aliasing</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.core.starling.html#get_contentscalefactor" class="tsd-kind-icon">get_<wbr>content<wbr>Scale<wbr>Factor</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.core.starling.html#get_context" class="tsd-kind-icon">get_<wbr>context</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.core.starling.html#get_contextvalid" class="tsd-kind-icon">get_<wbr>context<wbr>Valid</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.core.starling.html#get_enableerrorchecking" class="tsd-kind-icon">get_<wbr>enable<wbr>Error<wbr>Checking</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.core.starling.html#get_frameid" class="tsd-kind-icon">get_<wbr>frameID</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.core.starling.html#get_isstarted" class="tsd-kind-icon">get_<wbr>is<wbr>Started</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.core.starling.html#get_juggler" class="tsd-kind-icon">get_<wbr>juggler</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.core.starling.html#get_nativeoverlay" class="tsd-kind-icon">get_<wbr>native<wbr>Overlay</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.core.starling.html#get_nativestage" class="tsd-kind-icon">get_<wbr>native<wbr>Stage</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.core.starling.html#get_painter" class="tsd-kind-icon">get_<wbr>painter</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.core.starling.html#get_profile" class="tsd-kind-icon">get_<wbr>profile</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.core.starling.html#get_root" class="tsd-kind-icon">get_<wbr>root</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.core.starling.html#get_rootclass" class="tsd-kind-icon">get_<wbr>root<wbr>Class</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.core.starling.html#get_sharecontext" class="tsd-kind-icon">get_<wbr>share<wbr>Context</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.core.starling.html#get_showstats" class="tsd-kind-icon">get_<wbr>show<wbr>Stats</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.core.starling.html#get_simulatemultitouch" class="tsd-kind-icon">get_<wbr>simulate<wbr>Multitouch</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.core.starling.html#get_skipunchangedframes" class="tsd-kind-icon">get_<wbr>skip<wbr>Unchanged<wbr>Frames</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.core.starling.html#get_stage" class="tsd-kind-icon">get_<wbr>stage</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.core.starling.html#get_stage3d" class="tsd-kind-icon">get_<wbr>stage3D</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.core.starling.html#get_supportbrowserzoom" class="tsd-kind-icon">get_<wbr>support<wbr>Browser<wbr>Zoom</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.core.starling.html#get_supporthighresolutions" class="tsd-kind-icon">get_<wbr>support<wbr>High<wbr>Resolutions</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.core.starling.html#get_touchprocessor" class="tsd-kind-icon">get_<wbr>touch<wbr>Processor</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.core.starling.html#get_viewport" class="tsd-kind-icon">get_<wbr>view<wbr>Port</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external"><a href="starling.core.starling.html#haseventlistener" class="tsd-kind-icon">has<wbr>Event<wbr>Listener</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-external"><a href="starling.core.starling.html#makecurrent" class="tsd-kind-icon">make<wbr>Current</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-external"><a href="starling.core.starling.html#nextframe" class="tsd-kind-icon">next<wbr>Frame</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external"><a href="starling.core.starling.html#removeeventlistener" class="tsd-kind-icon">remove<wbr>Event<wbr>Listener</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external"><a href="starling.core.starling.html#removeeventlisteners" class="tsd-kind-icon">remove<wbr>Event<wbr>Listeners</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-external"><a href="starling.core.starling.html#render" class="tsd-kind-icon">render</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-external"><a href="starling.core.starling.html#setrequiresredraw" class="tsd-kind-icon">set<wbr>Requires<wbr>Redraw</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.core.starling.html#set_antialiasing" class="tsd-kind-icon">set_<wbr>anti<wbr>Aliasing</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.core.starling.html#set_enableerrorchecking" class="tsd-kind-icon">set_<wbr>enable<wbr>Error<wbr>Checking</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.core.starling.html#set_rootclass" class="tsd-kind-icon">set_<wbr>root<wbr>Class</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.core.starling.html#set_sharecontext" class="tsd-kind-icon">set_<wbr>share<wbr>Context</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.core.starling.html#set_showstats" class="tsd-kind-icon">set_<wbr>show<wbr>Stats</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.core.starling.html#set_simulatemultitouch" class="tsd-kind-icon">set_<wbr>simulate<wbr>Multitouch</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.core.starling.html#set_skipunchangedframes" class="tsd-kind-icon">set_<wbr>skip<wbr>Unchanged<wbr>Frames</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.core.starling.html#set_supportbrowserzoom" class="tsd-kind-icon">set_<wbr>support<wbr>Browser<wbr>Zoom</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.core.starling.html#set_supporthighresolutions" class="tsd-kind-icon">set_<wbr>support<wbr>High<wbr>Resolutions</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.core.starling.html#set_touchprocessor" class="tsd-kind-icon">set_<wbr>touch<wbr>Processor</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-external"><a href="starling.core.starling.html#set_viewport" class="tsd-kind-icon">set_<wbr>view<wbr>Port</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-external"><a href="starling.core.starling.html#showstatsat" class="tsd-kind-icon">show<wbr>Stats<wbr>At</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-external"><a href="starling.core.starling.html#start" class="tsd-kind-icon">start</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-external"><a href="starling.core.starling.html#stop" class="tsd-kind-icon">stop</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-external"><a href="starling.core.starling.html#stopwithfatalerror" class="tsd-kind-icon">stop<wbr>With<wbr>Fatal<wbr>Error</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-static tsd-is-external"><a href="starling.core.starling.html#get_all" class="tsd-kind-icon">get_<wbr>all</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-static tsd-is-external"><a href="starling.core.starling.html#get_current" class="tsd-kind-icon">get_<wbr>current</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-static tsd-is-external"><a href="starling.core.starling.html#get_multitouchenabled" class="tsd-kind-icon">get_<wbr>multitouch<wbr>Enabled</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected tsd-is-static tsd-is-external"><a href="starling.core.starling.html#set_multitouchenabled" class="tsd-kind-icon">set_<wbr>multitouch<wbr>Enabled</a></li>
</ul>
</section>
</div>
</section>
</section>
<section class="tsd-panel-group tsd-member-group tsd-is-external">
<h2>Constructors</h2>
<section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite tsd-is-external">
<a name="constructor" class="tsd-anchor"></a>
<h3>constructor</h3>
<ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite tsd-is-external">
<li class="tsd-signature tsd-kind-icon">new <wbr>Starling<span class="tsd-signature-symbol">(</span>rootClass<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, stage<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">OpenFLStage</span>, viewPort<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Rectangle</span>, stage3D<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Stage3D</span>, renderMode<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Context3DRenderMode</span>, profile<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">any</span>, sharedContext<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="starling.core.starling.html" class="tsd-signature-type">Starling</a></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<p>Overrides <a href="starling.events.eventdispatcher.html">EventDispatcher</a>.<a href="starling.events.eventdispatcher.html#constructor">constructor</a></p>
<ul>
<li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/core/Starling.d.ts#L176">lib/starling/core/Starling.d.ts:176</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Creates a new Starling instance.</p>
</div>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>rootClass: <span class="tsd-signature-type">any</span></h5>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>A subclass of 'starling.display.DisplayObject'. It will be created
as soon as initialization is finished and will become the first child
of the Starling stage. Pass <code>null</code> if you don't want to
create a root object right away. (You can use the
<code>rootClass</code> property later to make that happen.)</p>
</div>
</div>
</li>
<li>
<h5>stage: <span class="tsd-signature-type">OpenFLStage</span></h5>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>The Flash (2D) stage.</p>
</div>
</div>
</li>
<li>
<h5><span class="tsd-flag ts-flagOptional">Optional</span> viewPort: <span class="tsd-signature-type">Rectangle</span></h5>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>A rectangle describing the area into which the content will be
rendered. Default: stage size</p>
</div>
</div>
</li>
<li>
<h5><span class="tsd-flag ts-flagOptional">Optional</span> stage3D: <span class="tsd-signature-type">Stage3D</span></h5>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>The Stage3D object into which the content will be rendered. If it
already contains a context, <code>sharedContext</code> will be set
to <code>true</code>. Default: the first available Stage3D.</p>
</div>
</div>
</li>
<li>
<h5><span class="tsd-flag ts-flagOptional">Optional</span> renderMode: <span class="tsd-signature-type">Context3DRenderMode</span></h5>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>The Context3D render mode that should be requested.
Use this parameter if you want to force "software" rendering.</p>
</div>
</div>
</li>
<li>
<h5><span class="tsd-flag ts-flagOptional">Optional</span> profile: <span class="tsd-signature-type">any</span></h5>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>The Context3D profile that should be requested.</p>
<pre><code> <ul>
<li>If you pass <span class="hljs-keyword">a</span> profile String, this profile is enforced.</li>
<li>Pass <span class="hljs-keyword">an</span> Array <span class="hljs-keyword">of</span> profiles <span class="hljs-built_in">to</span> make Starling pick <span class="hljs-keyword">the</span> <span class="hljs-keyword">first</span>
<span class="hljs-literal">one</span> that works (starting <span class="hljs-keyword">with</span> <span class="hljs-keyword">the</span> <span class="hljs-keyword">first</span> array <span class="hljs-keyword">element</span>).</li>
<li>Pass <span class="hljs-keyword">the</span> String <span class="hljs-string">"auto"</span> <span class="hljs-built_in">to</span> make Starling pick <span class="hljs-keyword">the</span> best available
profile automatically.</li>
</ul>
</code></pre>
</div>
</div>
</li>
<li>
<h5><span class="tsd-flag ts-flagOptional">Optional</span> sharedContext: <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">boolean</span></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <a href="starling.core.starling.html" class="tsd-signature-type">Starling</a></h4>
</li>
</ul>
</section>
</section>
<section class="tsd-panel-group tsd-member-group tsd-is-external">
<h2>Properties</h2>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-external">
<a name="antialiasing" class="tsd-anchor"></a>
<h3>anti<wbr>Aliasing</h3>
<div class="tsd-signature tsd-kind-icon">anti<wbr>Aliasing<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/core/Starling.d.ts#L299">lib/starling/core/Starling.d.ts:299</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>The antialiasing level. 0 - no antialasing, 16 - maximum antialiasing. @default 0</p>
</div>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-external">
<a name="contentscalefactor" class="tsd-anchor"></a>
<h3>content<wbr>Scale<wbr>Factor</h3>
<div class="tsd-signature tsd-kind-icon">content<wbr>Scale<wbr>Factor<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/core/Starling.d.ts#L310">lib/starling/core/Starling.d.ts:310</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>The ratio between viewPort width and stage width. Useful for choosing a different
set of textures depending on the display resolution.</p>
</div>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-external">
<a name="context" class="tsd-anchor"></a>
<h3>context</h3>
<div class="tsd-signature tsd-kind-icon">context<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Context3D</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/core/Starling.d.ts#L279">lib/starling/core/Starling.d.ts:279</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>The render context of this instance.</p>
</div>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-external">
<a name="contextvalid" class="tsd-anchor"></a>
<h3>context<wbr>Valid</h3>
<div class="tsd-signature tsd-kind-icon">context<wbr>Valid<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/core/Starling.d.ts#L422">lib/starling/core/Starling.d.ts:422</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Indicates if the Context3D object is currently valid (i.e. it hasn't been lost or
disposed).</p>
</div>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-external">
<a name="enableerrorchecking" class="tsd-anchor"></a>
<h3>enable<wbr>Error<wbr>Checking</h3>
<div class="tsd-signature tsd-kind-icon">enable<wbr>Error<wbr>Checking<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/core/Starling.d.ts#L294">lib/starling/core/Starling.d.ts:294</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Indicates if Stage3D render methods will report errors. It's recommended to activate
this when writing custom rendering code (shaders, etc.), since you'll get more detailed
error messages. However, it has a very negative impact on performance, and it prevents
ATF textures from being restored on a context loss. Never activate for release builds!</p>
</div>
<dl class="tsd-comment-tags">
<dt>default</dt>
<dd><p>false</p>
</dd>
</dl>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-external">
<a name="frameid" class="tsd-anchor"></a>
<h3>frameID</h3>
<div class="tsd-signature tsd-kind-icon">frameID<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/core/Starling.d.ts#L417">lib/starling/core/Starling.d.ts:417</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>The number of frames that have been rendered since this instance was created.</p>
</div>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-external">
<a name="isstarted" class="tsd-anchor"></a>
<h3>is<wbr>Started</h3>
<div class="tsd-signature tsd-kind-icon">is<wbr>Started<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/core/Starling.d.ts#L266">lib/starling/core/Starling.d.ts:266</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Indicates if this Starling instance is started.</p>
</div>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-external">
<a name="juggler" class="tsd-anchor"></a>
<h3>juggler</h3>
<div class="tsd-signature tsd-kind-icon">juggler<span class="tsd-signature-symbol">:</span> <a href="starling.animation.juggler.html" class="tsd-signature-type">Juggler</a></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/core/Starling.d.ts#L270">lib/starling/core/Starling.d.ts:270</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>The default juggler of this instance. Will be advanced once per frame.</p>
</div>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-external">
<a name="nativeoverlay" class="tsd-anchor"></a>
<h3>native<wbr>Overlay</h3>
<div class="tsd-signature tsd-kind-icon">native<wbr>Overlay<span class="tsd-signature-symbol">:</span> <a href="starling.display.sprite.html" class="tsd-signature-type">Sprite</a></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/core/Starling.d.ts#L315">lib/starling/core/Starling.d.ts:315</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>A Flash Sprite placed directly on top of the Starling content. Use it to display native
Flash components.</p>
</div>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-external">
<a name="nativestage" class="tsd-anchor"></a>
<h3>native<wbr>Stage</h3>
<div class="tsd-signature tsd-kind-icon">native<wbr>Stage<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">OpenFLStage</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/core/Starling.d.ts#L343">lib/starling/core/Starling.d.ts:343</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>The Flash (2D) stage object Starling renders beneath.</p>
</div>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-external">
<a name="painter" class="tsd-anchor"></a>
<h3>painter</h3>
<div class="tsd-signature tsd-kind-icon">painter<span class="tsd-signature-symbol">:</span> <a href="starling.rendering.painter.html" class="tsd-signature-type">Painter</a></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/core/Starling.d.ts#L275">lib/starling/core/Starling.d.ts:275</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>The painter, which is used for all rendering. The same instance is passed to all
<code>render</code>methods each frame.</p>
</div>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-external">
<a name="profile" class="tsd-anchor"></a>
<h3>profile</h3>
<div class="tsd-signature tsd-kind-icon">profile<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Context3DProfile</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/core/Starling.d.ts#L375">lib/starling/core/Starling.d.ts:375</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>The Context3D profile of the current render context, or <code>null</code>
if the context has not been created yet.</p>
</div>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-external">
<a name="root" class="tsd-anchor"></a>
<h3>root</h3>
<div class="tsd-signature tsd-kind-icon">root<span class="tsd-signature-symbol">:</span> <a href="starling.display.displayobject.html" class="tsd-signature-type">DisplayObject</a></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/core/Starling.d.ts#L348">lib/starling/core/Starling.d.ts:348</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>The instance of the root class provided in the constructor. Available as soon as
the event 'ROOT_CREATED' has been dispatched.</p>
</div>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-external">
<a name="rootclass" class="tsd-anchor"></a>
<h3>root<wbr>Class</h3>
<div class="tsd-signature tsd-kind-icon">root<wbr>Class<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/core/Starling.d.ts#L361">lib/starling/core/Starling.d.ts:361</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>The class that will be instantiated by Starling as the 'root' display object.
Must be a subclass of 'starling.display.DisplayObject'.</p>
</div>
<p>If you passed <code>null</code> as first parameter to the Starling constructor,
you can use this property to set the root class at a later time. As soon as the class
is instantiated, Starling will dispatch a <code>ROOT_CREATED</code> event.</p>
<p>Beware: you cannot change the root class once the root object has been
instantiated.</p>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-external">
<a name="sharecontext" class="tsd-anchor"></a>
<h3>share<wbr>Context</h3>
<div class="tsd-signature tsd-kind-icon">share<wbr>Context<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/core/Starling.d.ts#L369">lib/starling/core/Starling.d.ts:369</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Indicates if another Starling instance (or another Stage3D framework altogether)
uses the same render context. If enabled, Starling will not execute any destructive
context operations (e.g. not call 'configureBackBuffer', 'clear', 'present', etc.
This has to be done manually, then. @default false</p>
</div>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-external">
<a name="showstats" class="tsd-anchor"></a>
<h3>show<wbr>Stats</h3>
<div class="tsd-signature tsd-kind-icon">show<wbr>Stats<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/core/Starling.d.ts#L326">lib/starling/core/Starling.d.ts:326</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Indicates if a small statistics box (with FPS, memory usage and draw count) is
displayed.</p>
</div>
<p>Beware that the memory usage should be taken with a grain of salt. The value is
determined via <code>System.totalMemory</code> and does not take texture memory
into account. It is recommended to use Adobe Scout for reliable and comprehensive
memory analysis.</p>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-external">
<a name="simulatemultitouch" class="tsd-anchor"></a>
<h3>simulate<wbr>Multitouch</h3>
<div class="tsd-signature tsd-kind-icon">simulate<wbr>Multitouch<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/core/Starling.d.ts#L284">lib/starling/core/Starling.d.ts:284</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Indicates if multitouch simulation with "Shift" and "Ctrl"/"Cmd"-keys is enabled.
@default false</p>
</div>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-external">
<a name="skipunchangedframes" class="tsd-anchor"></a>
<h3>skip<wbr>Unchanged<wbr>Frames</h3>
<div class="tsd-signature tsd-kind-icon">skip<wbr>Unchanged<wbr>Frames<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/openfl/starling/blob/bce2af2/lib/starling/core/Starling.d.ts#L405">lib/starling/core/Starling.d.ts:405</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>When enabled, Starling will skip rendering the stage if it hasn't changed since the
last frame. This is great for apps that remain static from time to time, since it will
greatly reduce power consumption. You should activate this whenever possible!</p>
</div>
<p>The reason why it's disabled by default is just that it causes problems with Render-
and VideoTextures. When you use those, you either have to disable this property
temporarily, or call <code>setRequiresRedraw()</code> (ideally on the stage) whenever
those textures are changing. Otherwise, the changes won't show up.</p>
<p> @default false</p>
</div>