Lab: Adobe Captivate-to-Flash ActionScript Communication

A word about root

“Root” refers to the main timeline of the parent movieclip; adding the prefix _root to unloadMe() eliminates scope problems.  In simple terms, adding _root helps Flash Player determine where the function unloadMe() is located, and which SWF is responsible for executing it when it gets invoked by the Captivate SWF.

If unloadMe() is invoked by the Captivate SWF without the prefix _root, the Flash Player plug-in will look for a function named unloadMe() in the main timeline of the Captivate SWF. Since the function is not stored in the Captivate SWF, Flash Player won’t be able to find and execute the function.

By adding the prefix _root to unloadMe(), we’ve instructed Flash Player to look for a function named unloadMe() in the main timeline of the parent SWF.

In our scenario, the Captivate SWF has been loaded into the player SWF; in Flash Player’s eyes, this makes the Captivate SWF a child of the player SWF.  Therefore the reference to _root will point to the timeline of the player SWF

"Where is _root?" diagram