FlashExtensions Home | FlashInterface Products Page

Communicating between Flash 8 and Flash 9

This example shows two Flash 8 SWFs loaded into a Flash 9 SWF. Flash 9 can communicate with each SWF and vice-versa, through event handlers and direct calls to both functions and properties.

* The Flex icon is used to represent the Flash 9 player. FlashInterface is not limited to Flex and will work within all Flash 9 projects.

FlashInterface dispatcher

Sample Code for Loading up a Flash 8 SWF


swfLoader.source = "flash/flash8.swf?flashId=flash_1";

By loading up the SWF with a flash var (in this case flash_1) we are giving the instance the id or name of flash_1. The Flash 9 SWF can now reference this SWF as flash_1.

Sample Code for Dispatching to Flash 8 SWF


FlashInterface.dispatchEvent({type:'talkToFlash', data:"Dispatched from Flash9."})

Sample Code for Communicating Directly to a Function in the Flash 8 SWF


FlashInterface.call("flash_1.sendMessage", "Method executed from Flash9.")

Sample Code for Communicating Directly to a Property in the Flash 8 SWF


FlashInterface.call("flash_1.txtOutput.text", "Property executed from Flash9.")