Pass Data Out Of A Swf File; Write A Function For The Try Again Button - MACROMEDIA FLASH MX 2004-LEARNING FLASH Manual

Learning flash
Table of Contents

Advertisement

Type
11.
gotoAndStop("confirm")
press Enter or Return again and type
Your script should appear as follows:
//Stops the playhead at frame 1
stop();
//Adds conditional logic for the Submit button that validates user input
this.submit_btn.onRelease = function(){
if (url_txt.text == null || url_txt.text ==""){
gotoAndStop("error");
} else {
gotoAndStop("confirm")
}
};

Pass data out of a SWF file

You can send data from a Flash application in various ways—for example, in this lesson you send
data to a web server to load a web page in the browser. After the
ActionScript to have Flash go to the URL the viewer enters in the input text field.
In the Script pane, place the insertion point in front of the line that reads
1.
gotoAndStop("confirm")
Then in the Actions toolbox, select Global Functions > Browser/Network and double-click
2.
.
getURL
With the insertion point within the
3.
specify the data that should pass from the SWF file. (Do not leave spaces in the code.)
Your script should look like the following:
stop();
this.submit_btn.onRelease = function(){
if (url_txt.text == null || url_txt.text ==""){
gotoAndStop("Error");
} else {
getUrl ("http://"+url_txt.text);
gotoAndStop("Confirm")
}
};

Write a function for the Try Again button

A function is a script that you can use repeatedly to perform a specific task. You can pass
parameters to a function, and it can return a value. In this example, when the user clicks the Try
Again button, a function runs that returns the playhead to Frame 1.
You'll write that function now. In this script, you'll type the frame number, because we did not
label Frame 1.
In the Timeline, select Frame 5 of the Actions layer.
1.
In the Script pane, type the following comment,
2.
. Press Enter or Return.
Frame 1
110
Chapter 14: Create a Form with Conditional Logic and Send Data
in the Script pane. Press Enter or Return, and type
.
};
.
parentheses, type
getURL()
//button function returns user to
statement, you'll add the
else
"http://"+url_txt.text
then
},
to

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004-LEARNING FLASH and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash mx 2004 - actionscript

Table of Contents