• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How do you execute external javascript on last frame?

Guest
Mar 29, 2010 Mar 29, 2010

Copy link to clipboard

Copied

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.

TOPICS
ActionScript

Views

1.3K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 29, 2010 Mar 29, 2010

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 30, 2010 Mar 30, 2010

Copy link to clipboard

Copied

Sorry about the cross post.  I thought I only selected Action Script 3.  This is my first post and I am new to Flash.

The issue is that I cannot determine how or where to put externalinterface class.  I have clicked around, but not found where to put the code such that it attaches itself to the last frame of any tween.  I clicked on Commands and tried Run Command..., but I'm not sure if putting the command in a file and then clicking OK will do it.

Commands.png

I looked at the Actions dialog, but it says my current selection cannot have actions applied to it.

Actions.png

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 30, 2010 Mar 30, 2010

Copy link to clipboard

Copied

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");

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 30, 2010 Mar 30, 2010

Copy link to clipboard

Copied

Sounds great.  Where do you type it such that it executes on the last frame of a Motion Tween?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 30, 2010 Mar 30, 2010

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines