Hi Tibor,
Applet loads independent of page. Your document may be ready but the applet may not, that is the reason it's not recommended to use page lifecyle events with applet instead you have separate lifecyle events for applets.
You can copy CreationEvent param from above shared example and place it in your applet code. This would automatically call your function with the applet has loaded completely.
Thanks,
Swaroop