1. on startMovie
  2.   -- load main movie or script from Documents folder
  3.   main = getHome()&"/Documents/main"
  4.   if bx_exists(main&".dir") then
  5.     _movie.go(1, main&".dir")
  6.    
  7.   else if bx_exists(main&".ls") then
  8.     m = new(#script)
  9.     m.name = "main"
  10.     ba = bx_file_get_contents(main&".ls")
  11.     str = ba.readRawString(ba.length)
  12.     m.scripttext = str
  13.     call(#startMovie, [script("main")])
  14.    
  15.   else if bx_exists(main&".js") then
  16.     m = new(#script)
  17.     m.name = "main"
  18.     m.scriptSyntax = #javaScript
  19.     ba = bx_file_get_contents(main&".js")
  20.     str = ba.readRawString(ba.length)
  21.     m.scripttext = str
  22.     h = script("main").handlers()
  23.     if h.getPos(#startMovie) then
  24.       script("main").startMovie()
  25.     end if
  26.    
  27.   else
  28.     put "[msg] Error: no main.dir/main.ls/main.js found!"
  29.     put "[msg] Upload main.dir or main.ls or main.js into the app's Documents folder, and then start this app again."
  30.   end if
  31. end
  32.  
[raw code]