Static methods

staticbind(path:String, object:Dynamic):Void

Load the Prefab from path and assign all created hierarchy objects to fields of the object instance.

Parameters:

path

Prefab name. Can point to a subfolder and must be without an extension.

object

An instance to which the prefab adds itself and assigns fields from the loaded path hierarchy.

staticload(path:String, ?parent:Object, ?field:Array<Field>):Prefab

Load the Prefab with the given name path from the res folder. path can point to a subfolder (eg: "ui/button") and must be without an extension.

Parameters:

path

Prefab name.

parent

An optional parent h2d.Object instance to which prefab adds itself if set.

field

An optional Field structure to override default values ​​for an object in the prefab hierarchy(text, texture atlas tile. eg: "[{ name : "label", type : "text", value : "new label" }]").

staticmake(path:String, object:Prefab, ?field:Array<Field>):Void

Initializes an existing Prefab instance by loading a hierarchy from the given path and attaching all loaded objects as children of this prefab. The loaded hierarchy is stored in the hierarchy field, and any objects whose names match fields of this Prefab instance are automatically assigned to those fields.

Parameters:

path

Prefab name. Can point to a subfolder and must be without an extension.

object

An existing Prefab instance to initialize and populate with the loaded hierarchy.

field

An optional Field structure to override default values ​​for an object in the prefab hierarchy(text, texture atlas tile. eg: "[{ name : "label", type : "text", value : "new label" }]").

staticread(path:String):Data

Get json hxe.Lib.Data typedef of the Prefab with the given name path from the res folder.

staticsetCache(atlas:Atlas):Void



Introduction

Quick Start

Working with editor

In-game implementation

API