Txt add AM2
Jump to navigation
Jump to search
Description
txt_id = txt_add(text,style, x,y,width,height)
txt_add is used to show a text on the specified location. The txt is also stored in memory for further references.
This page is only used for AM 2.1.3 and older. If you are using Air Manager 3.0 and up or Air Player, please go to txt_add
Return value
Argument | Type | Description |
---|---|---|
txt_id | Number | This value can be used for further reference. Functions such as txt_set can use this txt_id. Its good practice to store this txt_id in your logic code. |
Arguments
# | Argument | Type | Description |
---|---|---|---|
1 | txt | String | This is the txt being shown |
2 | style | String | The style to use. More information on styles. |
3 | x | Number | This is the most left point of the canvas where your text should be shown. |
4 | y | Number | This is the most top point of the canvas where your text should be shown. |
5 | width | Number | The text width on the canvas. |
6 | height | Number | The text height on the canvas. |
Example
-- Load and display text and images
mytext1 = txt_add("hello world", "-fx-font-size:11px; -fx-fill: black; -fx-font-weight:bold; -fx-text-alignment:right;", 0, 0, 800, 200)
-- rename text
txt_set(mytext1, "goodbye world")
When adding a font with a font family name that has spaces in it, use the following code to select the font family:
-fx-font-family:\"Font family name here\";