I was wondering if anyone knows how to get flash to open another html page after the movie has played.

im trying to make an opening page to my website which plays a short movie with the company logo on etc. When the movie has loaded and finished playing I want it to redirect the users browser to the homepage.

I have embedded the flash movie on a html page, and tried to use JavaScript to redirect the user after a set amount of time. However this doesn't really work because people with a slower connection take longer to download the movie, and then the page changes before the movie has finished playing.

I understand coding can be done in flash but I don't really have a clue how to do this as I am new to flash.

So basically what im asking is:

- Should the flash movie be embedded in a html document (I.E. domain.com/index.html), or should it be loaded directly (I.E. domain.com/movie.swf) for this to work?

- And how would I go about redirecting the user to the homepage after the movie has played?

Thanks for your time,
NuGG

Dani AI

Generated

A few important points and up-to-date context before anything else: Adobe officially ended support for Flash Player on December 31, 2020 and browser vendors have removed or blocked the plugin. For new projects it’s strongly recommended to move to HTML5/Video/Canvas; relying on SWF on a public website today will cause playback problems for most visitors. ()

If you can edit the FLA/SWF (answering and building on ): historically the simplest fix was to put a navigation action in the movie’s final frame — that still works for older AS2 timelines. For ActionScript 3 the robust approach is to call the page from the SWF via the ExternalInterface API and let the hosting HTML do the actual redirect; that requires the SWF to be embedded in an HTML wrapper (not just linked directly) and the embed parameters to permit scripting (allowscriptaccess). Using a small embedding helper (SWFObject or a modern equivalent) makes this reliable. (airsdk.dev)

If you cannot edit the SWF (answering ): options are limited but practical.

  • First try disabling looping at embed time (the Flash embed params include loop/play — if the SWF respects those, loop=false will stop repeats).
  • If the SWF ignores embed params, build a tiny wrapper SWF that loads the uneditable movie with the AS3 Loader API, watch its load/INIT/COMPLETE events and trigger the redirect when the child finishes.
  • If you own the content, convert the animation to MP4/WebM and use an HTML5 <video> element and the ended event to redirect (this is the most future-proof).
  • As a last resort for legacy content, consider a Flash emulator such as Ruffle for local viewing or archival use — emulator support varies by SWF/ActionScript version. (github.com)

Example (HTML5 fallback — easiest today):

<video id="intro" src="intro.mp4" autoplay playsinline></video>
<script>
  document.getElementById('intro').addEventListener('ended', () => {
    window.location.href = '/';
  });
</script>

Troubleshooting notes: avoid using fixed JavaScript timers for redirect (download/play timing differs across users); if using ExternalInterface test for its availability before calling it; and ensure allowscriptaccess is set appropriately when you publish/embed the SWF. (airsdk.dev)

Recommended Answers

All 3 Replies

Member Avatar for Member #114696

In the last keyframe of your movie, write following code in action panel:

getURL("http://www.domain.com/index.html");

aaha makes sense.

Thanks for that. great help,

NuGG

What if I have an swf movie I can't edit, and I want to go to a new page when the movie ends? At present, the movie replays itself in a loop. Is there some kind of workaround I can use?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.