2025-01-15 19:28:55 +01:00

53 lines
20 KiB
HTML

<!DOCTYPE html>
<html lang="en"><!-- use theme color or fallback -->
<!--use textcolor from settings, otherwise create a contrasting color to theme color-->
<head><meta charset="utf-8"/><link href="../../bootstrap/css/bootstrap.min.css" rel="stylesheet"/><link href="../../bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet"/><link href="../../bootstrap/css/bootstrap-select.min.css" rel="stylesheet"/><link href="http://fonts.googleapis.com/css?family=Open+Sans:400,700,700italic,400italic" rel="stylesheet" type="text/css"/><link href="http://fonts.googleapis.com/css?family=Source+Sans+Pro:200,600,600italic,400" rel="stylesheet" type="text/css"/><link href="http://netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.css" rel="stylesheet" type="text/css"/><script src="../../jquery-1.9.1.min.js"></script><script src="../../bootstrap/js/bootstrap.min.js"></script><script src="../../bootstrap/js/bootstrap-select.min.js"></script><link href="../../styles.css" rel="stylesheet"/><link href="../../haxe-nav.css" rel="stylesheet"/><script type="text/javascript">var dox = {rootPath: "../../",platforms: ["Neko","Android","Flash","iOS","macOS","Linux","HTML5","Windows"]};</script><script type="text/javascript" src="../../nav.js"></script><script type="text/javascript" src="../../index.js"></script><link rel="icon" href="../../favicon.ico" type="image/x-icon"></link><title>lime.utils.Assets - API Reference</title><meta name="description" content="The Assets class provides a cross-platform interface to access
embedded images, fonts, sounds and other resource files."/></head><body><style>
a, code .type {
color: #24afc4;
}
.navbar .brand {
display: inline-block;
float: none;
text-shadow: 0 0 0 transparent;
}
.nav-list>.active>a.treeLink, .nav-list>.active>a.treeLink:hover, .nav-list>.active>a.treeLink:focus {
background: #24afc4;
color: #ffffff;
text-shadow: 0 0 0 transparent;
}
.navbar .container {
width: 940px ;
}
@media (max-width: 767px) {
.navbar .container {
width: auto;
}
}
@media (max-width: 979px) and (min-width: 768px) {
.navbar .container {
width: 724px;
}
}
@media (min-width: 1200px) {
.navbar .container {
width: 1170px;
}
}
.navbar .container img {
margin: 5px 0 0 4px;
}
</style><nav class="nav"><div class="navbar"><div class="navbar-inner" style="background:#FAFAFA; border-bottom:1px solid rgba(0,0,0,.09)"><div class="container"><a class="brand" href="http://www.openfl.org"><img alt="" src="http://www.openfl.org/images/logo.png"/></a><a class="brand" style="color:#777777" href="../../">API Reference</a></div></div></div></nav><div class="container main-content"><div class="row-fluid"><div class="span3"><div class="well sidebar-nav"><form class="form-search" id="searchForm"><div class="input-prepend input-block-level"><span class="add-on"><i class="icon-search"></i></span><input id="search" type="text" placeholder="Search" autocomplete="off"/></div></form><div class="dropdown"><select id="select-platform" class="selectpicker" title="Filter by platform" data-width="100%"><option value="all" selected="true">All Platforms</option><option>Neko</option><option>Android</option><option>Flash</option><option>iOS</option><option>macOS</option><option>Linux</option><option>HTML5</option><option>Windows</option></select></div></div><div class="well sidebar-nav"><div id="nav"></div></div></div><div class="span9"><div class="page-header"><h1><small>class</small> Assets</h1><h4><small>package <a href="../../lime/utils/index.html">lime.utils</a></small></h4> <p class="availability"><hr/><em>Available on all platforms</em></p></div><div class="body"><div class="doc doc-main"><div class="indent"><p>The Assets class provides a cross-platform interface to access
embedded images, fonts, sounds and other resource files.</p><p>The contents are populated automatically when an application
is compiled using the Lime command-line tools, based on the
contents of the project file.</p><p>For most platforms, the assets are included in the same directory
or package as the application, and the paths are handled
automatically. For web content, the assets are preloaded before
the start of the rest of the application.</p></div></div><h3 class="section">Static variables</h3><div class="fields"><div class="field "><a name="cache"></a><h3><p><code><span class="label">static</span><a href="../../lime/utils/Assets.html#cache"><span class="identifier">cache</span></a>:<a class="type" title="" href="../../lime/utils/AssetCache.html">AssetCache</a><span> = new AssetCache()</span></code></p></h3><div class="doc"><p></p></div></div><div class="field "><a name="onChange"></a><h3><p><code><span class="label">static</span><a href="../../lime/utils/Assets.html#onChange"><span class="identifier">onChange</span></a>:<a class="type" title="" href="../../lime/app/Event.html">Event</a>&lt;<a class="type" title="The standard Void type." href="../../Void.html">Void</a>&nbsp;&#8209;&gt;&nbsp;<a class="type" title="The standard Void type." href="../../Void.html">Void</a>&gt;<span> = new Event&lt;Void&gt;()</span></code></p></h3><div class="doc"><p></p></div></div></div><h3 class="section">Static methods</h3><div class="fields"><div class="field "><a name="exists"></a><h3><p><code><span class="label">static</span><a href="#exists"><span class="identifier">exists</span></a> (<span style="white-space:nowrap">id:<a class="type" title="The basic String class." href="../../String.html">String</a>,</span> <span style="white-space:nowrap">?type:<a class="type" title="" href="../../lime/utils/AssetType.html">AssetType</a></span>):<a class="type" title="The standard Boolean type, which can either be true or false." href="../../Bool.html">Bool</a></code></p></h3><div class="doc"><p></p></div></div><div class="field "><a name="getAsset"></a><h3><p><code><span class="label">static</span><a href="#getAsset"><span class="identifier">getAsset</span></a> (<span style="white-space:nowrap">id:<a class="type" title="The basic String class." href="../../String.html">String</a>,</span> <span style="white-space:nowrap">type:<a class="type" title="" href="../../lime/utils/AssetType.html">AssetType</a>,</span> <span style="white-space:nowrap">useCache:<a class="type" title="The standard Boolean type, which can either be true or false." href="../../Bool.html">Bool</a></span>):<a class="type" title="Dynamic is a special type which is compatible with all other types." href="../../Dynamic.html">Dynamic</a></code></p></h3><div class="doc"><p>Gets an instance of a cached or embedded asset
@usage var sound = Assets.getAsset("sound.wav", SOUND);</p><p class="javadoc">Parameters:</p><table class="table table-bordered params"><tr><th width="25%"><code>id</code></th><td><p>The ID or asset path for the asset</p></td></tr></table><p class="javadoc">Returns:</p><div class="indent inline-content"><p>An Asset object, or null.</p></div></div></div><div class="field "><a name="getAudioBuffer"></a><h3><p><code><span class="label">static</span><a href="#getAudioBuffer"><span class="identifier">getAudioBuffer</span></a> (<span style="white-space:nowrap">id:<a class="type" title="The basic String class." href="../../String.html">String</a>,</span> <span style="white-space:nowrap">useCache:<a class="type" title="The standard Boolean type, which can either be true or false." href="../../Bool.html">Bool</a> = true</span>):<a class="type" title="" href="../../lime/media/AudioBuffer.html">AudioBuffer</a></code></p></h3><div class="doc"><p>Gets an instance of an embedded sound
@usage var sound = Assets.getSound("sound.wav");</p><p class="javadoc">Parameters:</p><table class="table table-bordered params"><tr><th width="25%"><code>id</code></th><td><p>The ID or asset path for the sound</p></td></tr></table><p class="javadoc">Returns:</p><div class="indent inline-content"><p>A new Sound object</p></div></div></div><div class="field "><a name="getBytes"></a><h3><p><code><span class="label">static</span><a href="#getBytes"><span class="identifier">getBytes</span></a> (<span style="white-space:nowrap">id:<a class="type" title="The basic String class." href="../../String.html">String</a></span>):<a class="type" title="" href="../../lime/utils/Bytes.html">Bytes</a></code></p></h3><div class="doc"><p>Gets an instance of an embedded binary asset
@usage var bytes = Assets.getBytes("file.zip");</p><p class="javadoc">Parameters:</p><table class="table table-bordered params"><tr><th width="25%"><code>id</code></th><td><p>The ID or asset path for the file</p></td></tr></table><p class="javadoc">Returns:</p><div class="indent inline-content"><p>A new Bytes object</p></div></div></div><div class="field "><a name="getFont"></a><h3><p><code><span class="label">static</span><a href="#getFont"><span class="identifier">getFont</span></a> (<span style="white-space:nowrap">id:<a class="type" title="The basic String class." href="../../String.html">String</a>,</span> <span style="white-space:nowrap">useCache:<a class="type" title="The standard Boolean type, which can either be true or false." href="../../Bool.html">Bool</a> = true</span>):<a class="type" title="" href="../../lime/text/Font.html">Font</a></code></p></h3><div class="doc"><p>Gets an instance of an embedded font
@usage var fontName = Assets.getFont("font.ttf").fontName;</p><p class="javadoc">Parameters:</p><table class="table table-bordered params"><tr><th width="25%"><code>id</code></th><td><p>The ID or asset path for the font</p></td></tr></table><p class="javadoc">Returns:</p><div class="indent inline-content"><p>A new Font object</p></div></div></div><div class="field "><a name="getImage"></a><h3><p><code><span class="label">static</span><a href="#getImage"><span class="identifier">getImage</span></a> (<span style="white-space:nowrap">id:<a class="type" title="The basic String class." href="../../String.html">String</a>,</span> <span style="white-space:nowrap">useCache:<a class="type" title="The standard Boolean type, which can either be true or false." href="../../Bool.html">Bool</a> = true</span>):<a class="type" title="" href="../../lime/graphics/Image.html">Image</a></code></p></h3><div class="doc"><p>Gets an instance of an embedded bitmap
@usage var bitmap = new Bitmap(Assets.getBitmapData("image.jpg"));</p><p class="javadoc">Parameters:</p><table class="table table-bordered params"><tr><th width="25%"><code>id</code></th><td><p>The ID or asset path for the bitmap</p></td></tr><tr><th width="25%"><code>useCache</code></th><td><p>(Optional) Whether to use BitmapData from the cache(Default: true)</p></td></tr></table><p class="javadoc">Returns:</p><div class="indent inline-content"><p>A new BitmapData object</p></div></div></div><div class="field "><a name="getLibrary"></a><h3><p><code><span class="label">static</span><a href="#getLibrary"><span class="identifier">getLibrary</span></a> (<span style="white-space:nowrap">name:<a class="type" title="The basic String class." href="../../String.html">String</a></span>):<a class="type" title="" href="../../lime/utils/AssetLibrary.html">AssetLibrary</a></code></p></h3><div class="doc"><p></p></div></div><div class="field "><a name="getPath"></a><h3><p><code><span class="label">static</span><a href="#getPath"><span class="identifier">getPath</span></a> (<span style="white-space:nowrap">id:<a class="type" title="The basic String class." href="../../String.html">String</a></span>):<a class="type" title="The basic String class." href="../../String.html">String</a></code></p></h3><div class="doc"><p>Gets the file path (if available) for an asset
@usage var path = Assets.getPath("image.jpg");</p><p class="javadoc">Parameters:</p><table class="table table-bordered params"><tr><th width="25%"><code>id</code></th><td><p>The ID or asset path for the asset</p></td></tr></table><p class="javadoc">Returns:</p><div class="indent inline-content"><p>The path to the asset (or null)</p></div></div></div><div class="field "><a name="getText"></a><h3><p><code><span class="label">static</span><a href="#getText"><span class="identifier">getText</span></a> (<span style="white-space:nowrap">id:<a class="type" title="The basic String class." href="../../String.html">String</a></span>):<a class="type" title="The basic String class." href="../../String.html">String</a></code></p></h3><div class="doc"><p>Gets an instance of an embedded text asset
@usage var text = Assets.getText("text.txt");</p><p class="javadoc">Parameters:</p><table class="table table-bordered params"><tr><th width="25%"><code>id</code></th><td><p>The ID or asset path for the file</p></td></tr></table><p class="javadoc">Returns:</p><div class="indent inline-content"><p>A new String object</p></div></div></div><div class="field "><a name="hasLibrary"></a><h3><p><code><span class="label">static</span><a href="#hasLibrary"><span class="identifier">hasLibrary</span></a> (<span style="white-space:nowrap">name:<a class="type" title="The basic String class." href="../../String.html">String</a></span>):<a class="type" title="The standard Boolean type, which can either be true or false." href="../../Bool.html">Bool</a></code></p></h3><div class="doc"><p></p></div></div><div class="field "><a name="isLocal"></a><h3><p><code><span class="label">static</span><a href="#isLocal"><span class="identifier">isLocal</span></a> (<span style="white-space:nowrap">id:<a class="type" title="The basic String class." href="../../String.html">String</a>,</span> <span style="white-space:nowrap">?type:<a class="type" title="" href="../../lime/utils/AssetType.html">AssetType</a>,</span> <span style="white-space:nowrap">useCache:<a class="type" title="The standard Boolean type, which can either be true or false." href="../../Bool.html">Bool</a> = true</span>):<a class="type" title="The standard Boolean type, which can either be true or false." href="../../Bool.html">Bool</a></code></p></h3><div class="doc"><p></p></div></div><div class="field "><a name="list"></a><h3><p><code><span class="label">static</span><a href="#list"><span class="identifier">list</span></a> (<span style="white-space:nowrap">?type:<a class="type" title="" href="../../lime/utils/AssetType.html">AssetType</a></span>):<a class="type" title="An Array is a storage for values." href="../../Array.html">Array</a>&lt;<a class="type" title="The basic String class." href="../../String.html">String</a>&gt;</code></p></h3><div class="doc"><p></p></div></div><div class="field "><a name="loadAsset"></a><h3><p><code><span class="label">static</span><a href="#loadAsset"><span class="identifier">loadAsset</span></a> (<span style="white-space:nowrap">id:<a class="type" title="The basic String class." href="../../String.html">String</a>,</span> <span style="white-space:nowrap">type:<a class="type" title="" href="../../lime/utils/AssetType.html">AssetType</a>,</span> <span style="white-space:nowrap">useCache:<a class="type" title="The standard Boolean type, which can either be true or false." href="../../Bool.html">Bool</a></span>):<a class="type" title="" href="../../lime/app/Future.html">Future</a>&lt;<a class="type" title="Dynamic is a special type which is compatible with all other types." href="../../Dynamic.html">Dynamic</a>&gt;</code></p></h3><div class="doc"><p></p></div></div><div class="field "><a name="loadAudioBuffer"></a><h3><p><code><span class="label">static</span><a href="#loadAudioBuffer"><span class="identifier">loadAudioBuffer</span></a> (<span style="white-space:nowrap">id:<a class="type" title="The basic String class." href="../../String.html">String</a>,</span> <span style="white-space:nowrap">useCache:<a class="type" title="The standard Boolean type, which can either be true or false." href="../../Bool.html">Bool</a> = true</span>):<a class="type" title="" href="../../lime/app/Future.html">Future</a>&lt;<a class="type" title="" href="../../lime/media/AudioBuffer.html">AudioBuffer</a>&gt;</code></p></h3><div class="doc"><p></p></div></div><div class="field "><a name="loadBytes"></a><h3><p><code><span class="label">static</span><a href="#loadBytes"><span class="identifier">loadBytes</span></a> (<span style="white-space:nowrap">id:<a class="type" title="The basic String class." href="../../String.html">String</a></span>):<a class="type" title="" href="../../lime/app/Future.html">Future</a>&lt;<a class="type" title="" href="../../lime/utils/Bytes.html">Bytes</a>&gt;</code></p></h3><div class="doc"><p></p></div></div><div class="field "><a name="loadFont"></a><h3><p><code><span class="label">static</span><a href="#loadFont"><span class="identifier">loadFont</span></a> (<span style="white-space:nowrap">id:<a class="type" title="The basic String class." href="../../String.html">String</a>,</span> <span style="white-space:nowrap">useCache:<a class="type" title="The standard Boolean type, which can either be true or false." href="../../Bool.html">Bool</a> = true</span>):<a class="type" title="" href="../../lime/app/Future.html">Future</a>&lt;<a class="type" title="" href="../../lime/text/Font.html">Font</a>&gt;</code></p></h3><div class="doc"><p></p></div></div><div class="field "><a name="loadImage"></a><h3><p><code><span class="label">static</span><a href="#loadImage"><span class="identifier">loadImage</span></a> (<span style="white-space:nowrap">id:<a class="type" title="The basic String class." href="../../String.html">String</a>,</span> <span style="white-space:nowrap">useCache:<a class="type" title="The standard Boolean type, which can either be true or false." href="../../Bool.html">Bool</a> = true</span>):<a class="type" title="" href="../../lime/app/Future.html">Future</a>&lt;<a class="type" title="" href="../../lime/graphics/Image.html">Image</a>&gt;</code></p></h3><div class="doc"><p></p></div></div><div class="field "><a name="loadLibrary"></a><h3><p><code><span class="label">static</span><a href="#loadLibrary"><span class="identifier">loadLibrary</span></a> (<span style="white-space:nowrap">id:<a class="type" title="The basic String class." href="../../String.html">String</a></span>):<a class="type" title="" href="../../lime/app/Future.html">Future</a>&lt;<a class="type" title="" href="../../lime/utils/AssetLibrary.html">AssetLibrary</a>&gt;</code></p></h3><div class="doc"><p></p></div></div><div class="field "><a name="loadText"></a><h3><p><code><span class="label">static</span><a href="#loadText"><span class="identifier">loadText</span></a> (<span style="white-space:nowrap">id:<a class="type" title="The basic String class." href="../../String.html">String</a></span>):<a class="type" title="" href="../../lime/app/Future.html">Future</a>&lt;<a class="type" title="The basic String class." href="../../String.html">String</a>&gt;</code></p></h3><div class="doc"><p></p></div></div><div class="field "><a name="registerLibrary"></a><h3><p><code><span class="label">static</span><a href="#registerLibrary"><span class="identifier">registerLibrary</span></a> (<span style="white-space:nowrap">name:<a class="type" title="The basic String class." href="../../String.html">String</a>,</span> <span style="white-space:nowrap">library:<a class="type" title="" href="../../lime/utils/AssetLibrary.html">AssetLibrary</a></span>):<a class="type" title="The standard Void type." href="../../Void.html">Void</a></code></p></h3><div class="doc"><p></p></div></div><div class="field "><a name="unloadLibrary"></a><h3><p><code><span class="label">static</span><a href="#unloadLibrary"><span class="identifier">unloadLibrary</span></a> (<span style="white-space:nowrap">name:<a class="type" title="The basic String class." href="../../String.html">String</a></span>):<a class="type" title="The standard Void type." href="../../Void.html">Void</a></code></p></h3><div class="doc"><p></p></div></div></div></div></div></div></div><footer class="section site-footer" style="background:#FAFAFA"><div class="container"><div class="copyright"><p style="color:#777777">&copy; 2017 &nbsp;<a style="color:#777777" href="http://www.openfl.org">http://www.openfl.org</a></p></div></div></footer><script src="../..//highlighter.js"></script><link href="../../highlighter.css" rel="stylesheet"/></body></html>