03.05.2013 Views

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

function Circle(radius) {<br />

this.radius = radius;<br />

this.getArea = function(){<br />

return Math.PI*this.radius*this.radius;<br />

};<br />

this.getDiameter = function() {<br />

return 2*this.radius;<br />

};<br />

this.setRadius = function(param_radius) {<br />

this.radius = param_radius;<br />

}<br />

}<br />

// ActionScript 2.0 code that uses the Circle class<br />

var myCircle:Circle = new Circle(5);<br />

trace(myCircle.getArea());<br />

trace(myCircle.getDiameter());<br />

myCircle.setRadius("10");<br />

trace(myCircle.radius);<br />

trace(myCircle.getArea());<br />

trace(myCircle.getDiameter());<br />

See also<br />

class statement<br />

private statement<br />

class someClassName{<br />

private var name;<br />

private function name() {<br />

// your statements here<br />

}<br />

}<br />

Note: To use this keyword, you must specify ActionScript 2.0 <strong>and</strong> Flash Player 6 or later in<br />

the Flash tab of your FLA file's Publish Settings dialog box. This keyword is supported only<br />

when used in external script files, not in scripts written in the Actions panel.<br />

Specifies that a variable or function is available only to the class that declares or defines it or to<br />

subclasses of that class. By default, a variable or function is available to any caller. Use this<br />

keyword if you want to restrict access to a variable or function.<br />

You can use this keyword only in class definitions, not in interface definitions.<br />

Parameters<br />

name:String - The name of the variable or function that you want to specify as private.<br />

192 ActionScript language elements

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!