Skip navigation
Nolehace
Currently Being Moderated

How do you execute external javascript on last frame?

Mar 29, 2010 4:46 PM

I have searched and read and searched some more, but have had no luck . . . could be because I'm new to Flash and Action Script and don't know enough to know what terms to search for.

 

I'm authoring in Flash CS4 using Motion Tweens.

 

Here is the situation.  I have a JavaScript that closes the DIV containing my flash object.  It currently closes after 15 seconds.  That is supposed to be how long the Flash movie lasts.  however, slower machines run the movie longer.  this means the flash object closes too quickly and they don't see the entire movie . . . if I increase the time, the users of fast machines have to wait around awhile for the movie to disappear.

 

So, I would like the movie to execute the javaScript when it gets to the last frame.

 
Replies
  • kglad
    72,189 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 29, 2010 5:26 PM   in reply to Nolehace

    please don't cross-post.  in fact, ignore your duplicate message in the as1/as2 forum.

     

    on the last frame of your swf, you can call your javascript function using the flash externalinterface class.

     
    |
    Mark as:
  • kglad
    72,189 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 30, 2010 12:30 PM   in reply to Nolehace

    you don't put the class anywhere.   you just use its methods.  i don't think you even need to import it when using as3:

     

     

    ExternalInterface.call("yourJSfunction", "any variable(s) you want to send");

     
    |
    Mark as:
  • kglad
    72,189 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 30, 2010 3:31 PM   in reply to Nolehace

    create a keyframe at the end of your tween (using a different layer) and, place the code there.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points