3

How can I run code in Actionscript 3 when a page with my flash object is... well... I'm not sure of the term.

When the webpage is left and the flash applet is exited?

Benny
  • 2,250
  • 4
  • 26
  • 39
James T
  • 3,292
  • 8
  • 40
  • 70

2 Answers2

4

I don't think Flash has built-in functionality to catch this type of event. You might try a javascript solution. See this topic. By doing so, you could implement a flash object callback using Flash's ExternalInterface at the time the user leaves your page.

Community
  • 1
  • 1
chris
  • 2,893
  • 3
  • 20
  • 22
1

I would suggest that if the reason for running code on page leave is to communicate with a server and/or you are making a game to be put up on other portals and you cannot modify their javascript, save whatever you need to save every X seconds, or better, every time something major changes (eg you competed a level / new highscore). This way, if your game/browser/os crashes progress is not lost.

apscience
  • 7,033
  • 11
  • 55
  • 89