Because the script is on a separate timeline, you need to create a loop in your flash movie that waits for the script to finish. Here is the code that I used in the sample .fla to make the loop:
When you click on the button that loads the script, the sample .fla also sets the 'loading' variable to 'YES'. The movie knows when the script is done because it tells the movie that 'loading=NO'.