[Widgets] BitmapLabel

Adding A BitmapLabel

Drag a BitmapLabel from the Widgets section onto the middle canvas.

258

Selecting The BitmapLabel

You can select the BitmapLabel if it isn't already selected from the Animation Editor at the bottom. The BitmapLabel doesn't appear in the resources as it's part of the Scene or other object that you are using.

249

Changing The BitmapLabel

You can change the Bitmap image used for the Font. Setting the bitmap image can be done by double clicking the Font File or dragging an image from the Resources section.

356

Accessing The BitmapLabel In Code

BitmapLabel's can be accessed via their Name or Tag which can be set in the Properties section.

352

To access the BitmapLabel from a scene for example, in code it is simple. You either access it as a Node or cast it to a BitmapLabel allowing you to use BitmapLabel methods along with Node methods.

Node *rootNode = CSLoader::createNode( "Filepath to .csb file" );
this->addChild( rootNode );

// bitmap label accessed as a node using it's name
Node *bitmapLabel = rootNode->getChildByName( "Name set in Cocos Studio" );

// bitmap label cast to a bitmap label using it's name
cocos2d::ui::TextBMFont *bitmapLabel = ( cocos2d::ui::TextBMFont * )rootNode->getChildByName( "Name set in Cocos Studio" );

// bitmap label accessed as a node using it's tag
Node *bitmapLabel = rootNode->getChildByTag( 5 );

// bitmap label cast to a bitmap label using it's tag
cocos2d::ui::TextBMFont *bitmapLabel = ( cocos2d::ui::TextBMFont * )rootNode->getChildByTag( 5 );
var rootNode = ccs.load( "Filepath to .json file" );
this.addChild( rootNode.node );

// get the bitmap label by name
var bitmapLabel = rootNode.node.getChildByName( "Name set in Cocos Studio" );

// get the bitmap label by tag
var bitmapLabel = rootNode.node.getChildByTag( 5 );

Note: Cocos2d-JS doesn't require casting to use BitmapLabel methods.