I have a question about “on tag” of richText

I want to make hypertext functionality using “on tag”() of richText.
In other words, I want to associate a word in a sentence with a web page.
I tried both methods, but neither worked.
Even a click event.

First

this.richText.string = blah blah <on href=''www.google.com" click="handler">google<\on> blah blah;

Second

    var click_event = new cc.Component.EventHandler();
    click_event.target = this.richText.node;
    click_event.component = "Helloworld";
    click_event.handler = "callback";
    click_event.customEventData = "";

this.richText.string = blah blah <on click="click_event"> google </on> blah blah;

callback(event: cc.Event.EventTouch, customEventData: string) {

    cc.sys.openURL("https://www.google.com");

}

I do not know what to do!
Please Help me!
I’m using Cocos Creator version 2.1!

Reference:RichText.zip (756.6 KB)

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.