EasyManua.ls Logo

MACROMEDIA FLASH 8-USING FLASH - Page 643

MACROMEDIA FLASH 8-USING FLASH
678 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
<popupslider> 643
First, create a file named skew.jsfl and place it in your Commands folder. Place the following
code into the file and save the file:
// Create an XML to UI dialog box using the XML definition in the skew.xml
file
var skewDlg = fl.getDocumentDOM().xmlPanel( fl.configURI + "Commands/
skew.xml" );
// Place the values of xskew and yskew from the dialog box into local
variables.
// Note that we cast (convert) the return value of skewDlg["xSkew"] to a
number before assigning
// it to xSkew because the skewSelection method takes numbers as parameters.
var xSkew = Number(skewDlg.xSkew);
var ySkew = Number(skewDlg.ySkew);
var edge = skewDlg.edge;
if (skewDlg.dismiss == "accept") {
// Place the values of xSkew and ySkew from the dialog box
// into local variables. The code casts (converts) the values from the
// dialog box to a number before assigning them to the local variables
// because the skewSelection() method takes numbers for
// the xSkew and ySkew parameters.
var xSkew = Number(skewDlg.xSkew);
var ySkew = Number(skewDlg.ySkew);
var edge = skewDlg.edge;
// check for valid input because sending 0 or undefined to
// skewSelection() will cause the object to disappear.
var inputIsValid = true;
if (xSkew == 0 || isNaN(xSkew)) {
inputIsValid = false;
}
if (ySkew == 0 || isNaN(ySkew)) {
inputIsValid = false;
}
// Call skewSelection() to carry out the resizing command.
if (inputIsValid ) {
fl.getDocumentDOM().skewSelection(xSkew, ySkew, edge);
}
}

Table of Contents

Related product manuals