Controlling SWF file playback
565
You can also send variables along with the URL, using
GET
or
POST
methods. This is useful if
the page you are loading from an application server, such as a ColdFusion server (CFM) page,
expects to receive form variables. For example, suppose you want to load a CFM page named
addUser.cfm that expects two form variables, first
Name
and
age
. To do this, you can create a
movie clip named
variables_mc
that defines those two variables, as shown in the following
example:
variables_mc.firstName = "Francois";
variables_mc.age = 32;
The following code then loads addUser.cfm into a blank browser window and passes
variables_mc.name
and
variables_mc.age
in the
POST
header to the CFM page:
variables_mc.getURL("addUser.cfm", "_blank", "POST");
The functionality of
getURL()
is dependent on what browser you use. The most reliable way
to get all browsers to work the same is to call a JavaScript function in the HTML code that
uses the JavaScript
window.open()
method to open a window. Add the following HTML and
JavaScript within your HTML template:
<script language="JavaScript">
<--
function openNewWindow(myURL) {
window.open(myURL, "targetWindow");
}
// -->
</script>
You can use the following ActionScript to call
openNewWindow
from your SWF file:
var myURL:String = "http://foo.com";
getURL("javascript:openNewWindow('" + String(myURL) + "');");
For more information, see getURL function in the
ActionScript 2.0 Language Reference
.
Содержание FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
Страница 1: ...Learning ActionScript 2 0 in Flash...
Страница 8: ...8 Contents...
Страница 18: ...18 Introduction...
Страница 30: ...30 What s New in Flash 8 ActionScript...
Страница 66: ...66 Writing and Editing ActionScript 2 0...
Страница 328: ...328 Interfaces...
Страница 350: ...350 Handling Events...
Страница 590: ...590 Creating Interaction with ActionScript...
Страница 710: ...710 Understanding Security...
Страница 730: ...730 Debugging Applications...
Страница 780: ...780 Deprecated Flash 4 operators...
Страница 830: ...830 Index...