Adobe FLEX 2-PROGRAMMING ACTIONSCRIPT 3.0 Manual page 490

Programming actionscript 3.0
Table of Contents

Advertisement

Working with exceptions and returns
You should check to see if the
and
addPage()
send()
check whether these methods have been cancelled before continuing is to wrap them in an
statement, as follows:
if (myPrintJob.start())
{
// addPage() and send() statements here
}
If
PrintJob.start()
initiated a Print command), the
Also, to help manage the printing process, Flash Player now throws exceptions for the
PrintJob.addPage()
options to the user. If a
function or stop the current print job. You catch these exceptions by embedding
calls within a
try..catch
is a placeholder for the parameters specifying the actual content you want to print.
if (myPrintJob.start())
{
try
{
myPrintJob.addPage([params]);
}
catch (e:Error)
{
// Handle error,
}
myPrintJob.send();
}
Once the print job starts, you can add the content using
generates an exception (for example, if the user has cancelled the print job). If it does, you can
add logic to the
catch
options, or you can stop the current print job. If you add the page successfully, you can
proceed to send the pages to the printer using
490
Printing
PrintJob.start()
calls, in case the user has cancelled the print job. A simple way to
is
, meaning the user has selected Print (or Flash Player has
true
addPage()
method, so that you can catch errors and provide information and
PrintJob.addPage()
statement, as in the following example. In the example,
statement to provide the user (or Flash Player) with information,
method returns
and
methods can be called.
send()
method fails, you can also call another
PrintJob.addPage()
.
PrintJob.send()
before executing
true
addPage()
[params]
and see if that
if

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex

Table of Contents