Example: Uploading And Downloading Files - Adobe FLEX 2-PROGRAMMING ACTIONSCRIPT 3.0 Manual

Programming actionscript 3.0
Table of Contents

Advertisement

Displaying messages from the socket server
Whenever a message is received from the socket server, or an event occurs, the custom
method is called. This method appends a string to the TextArea on the Stage and calls a
custom
setScroll()
bottom. The
method is as follows:
msg()
private function msg(value:String):void
{
ta.text += value;
setScroll();
}
If you didn't automatically scroll the contents of the TextArea component, users would need
to manually drag the scroll bars on the text area to see the latest response from the server.
Scrolling a TextArea component
The
method contains a single line of ActionScript that scrolls the TextArea
setScroll()
component's contents vertically so the user can see the last line of the returned text. The
following snippet shows the
public function setScroll():void
{
ta.verticalScrollPosition = ta.maxVerticalScrollPosition;
}
This method sets the
top row of characters that is currently displayed, and sets it to the value of the
maxVerticalScrollPosition
Example: Uploading and downloading
files
The FileIO example demonstrates techniques for perform file downloading and uploading in
Flash Player. These techniques are:
Downloading files to a user's computer
Uploading files from a user's computer to a server
Cancelling a download in progress
Cancelling an upload in progress
408
Networking and Communication
method, which causes the TextArea component to scroll to the very
setScroll()
verticalScrollPosition
property.
method:
property, which is the line number of the
msg()

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLEX 2-PROGRAMMING ACTIONSCRIPT 3.0 and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Flex

Table of Contents