updating generate_applet_embedding_code

1) phpdoc updated
2) isActive() is used to guarantee that an applet is ready before
loading an state