add appletIsLoaded funcion