68
Chapter 5: Fireworks Integration
A simple FWLaunch communication example
The following command asks Fireworks to prompt the user for their name and returns the name
to Dreamweaver:
<html>
<head>
<title>Prompt in Fireworks</title>
<meta http-equiv="Content-Type" content="text/html; ¬
charset=iso-8859-1">
<script>
function commandButtons(){
return new Array("Prompt", "promptInFireworks()", "Cancel", ¬
"readyToCancel()", "Close","window.close()");
}
var gCancelClicked = false;
var gProgressTrackerCookie = null;
function readyToCancel() {
gCancelClicked = true;
}
function promptInFireworks() {
var isFireworks3 = FWLaunch.validateFireworks(3.0);
if (!isFireworks3) {
alert("You must have Fireworks 3.0 or later to use this ¬
command");
return;
}
// Tell Fireworks to execute the prompt() method.
gProgressTrackerCookie = FWLaunch.execJsInFireworks¬
("prompt('Please enter your name:')");
// null means it wasn't launched, a number means an error code
if (gProgressTrackerCookie == null || ¬
typeof(gProgressTrackerCookie) == "number") {
window.close();
alert("an error occurred");
gProgressTrackerCookie = null;
} else {
// bring Fireworks to the front
FWLaunch.bringFWToFront();
// start the checking to see if Fireworks is done yet
checkOneMoreTime();
}
}
function checkOneMoreTime() {
// Call checkJsResponse() every 1/2 second to see if Fireworks
// is done yet
window.setTimeout("checkJsResponse();", 500);
}
function checkJsResponse() {
var response = null;
// The user clicked the cancel button, close the window
if (gCancelClicked) {
000_DW_API_Print.book Page 68 Wednesday, August 20, 2003 9:14 AM
Summary of Contents for DREAMWEAVER MX 2004
Page 1: ...Dreamweaver API Reference...
Page 24: ...24 Contents...
Page 32: ......
Page 70: ...70 Chapter 5 Fireworks Integration...
Page 76: ...76 Chapter 6 Flash Integration...
Page 116: ...116 Chapter 9 The JavaBeans API...
Page 140: ......
Page 152: ...152 Chapter 11 Application...
Page 218: ...218 Chapter 12 Workspace...
Page 248: ...248 Chapter 13 Site...
Page 292: ...292 Chapter 14 Document...
Page 378: ...378 Chapter 17 Design...
Page 430: ...430 Chapter 18 Code...
Page 486: ...486 Index...