KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Macromedia Flash & 4D
PRODUCT: 4D | VERSION: 6.5 | PLATFORM: Mac & Win
Published On: January 11, 2002

Macromedia Flash is an increasingly popular choice for developing web pagesMany developers ask: "Is it possible to have Flash communicate with 4D?" The answer is a resounding "Yes!"...and then some more good news: "It's actually very easy!"

Here is the Action Script for a button in Flash that sends some data to 4D:

on (release) {
loadVariables ("https://4d.mycompany.com/4DCGI/WebFlash_HandleData", _root, "POST");
}

"loadVariables" is a Flash function that will call the specified URL. When you are editing the "loadVariables" function in the Object Action palette, you will see there is an option for variables: "Send using POST" and "Send using GET". This will send the Flash variables to 4D, which you can access using GET WEB FORM VARIABLES as if the data had come from an HTML page.

To send data back to Flash, you issue a simple call like this:

SEND HTML TEXT("success=1&message="THIS CAME FROM 4D")

where "success" and "message" are variables in Flash. The "loadVariables" call will parse the result into the Flash variables.