Hi developers,
I want to make sentences where user can click on words to open other windows.
Example: “You received 5 Apples from player Hana.”
- Click on Apples → show description what an apple is
- Click on Hana → show information of Hana
Has anyone here tried it? I am using version 3.7.1.
Thanks for all your help.
RichText component can help you with that
Thank you. That is the solution I need, but can you give me some examples about using tag <on>
?
<on click="handler"> click me! </on>
I have no idea where function “handler” is located
You could also build a button with Richtext and have no sprite for the button. Then you can call on the button:
this.ExampleButton.node.on(Button.EventType.CLICK, this.ActionMethod, this);.
ActionMethod(){
…
}
Just make sure the cc.Button has transition on NONE or SCALE.
handler is the function name of a component attached to your RichText node.
1 Like