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.

import macr.util.*;<br />

var myFoo:foo = new foo();<br />

On another frame script, however, you would need to reference classes in that package by<br />

their fully qualified names (var myFoo:foo = new macr.util.foo();) or add an import<br />

statement to the other frame that imports the classes in that package.<br />

Parameters<br />

className:String - The fully qualified name of a class you have defined in an external class<br />

file.<br />

Example<br />

interface statement<br />

interface InterfaceName [extends InterfaceName ] {}<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 />

Defines an interface. An interface is similar to a class, with the following important<br />

differences:<br />

■ Interfaces contain only declarations of methods, not their implementation. That is, every<br />

class that implements an interface must provide an implementation for each method<br />

declared in the interface.<br />

■ Only public members are allowed in an interface definition; instance <strong>and</strong> class members<br />

are not permitted.<br />

■ The get <strong>and</strong> set statements are not allowed in interface definitions.<br />

Example<br />

The following example shows several ways to define <strong>and</strong> implement interfaces:<br />

(in top-level package .as files Ia, B, C, Ib, D, Ic, E)<br />

// filename Ia.as<br />

interface Ia {<br />

function k():Number; // method declaration only<br />

function n(x:Number):Number; // without implementation<br />

}<br />

// filename B.as<br />

class B implements Ia {<br />

function k():Number {<br />

return 25;<br />

}<br />

Statements 189

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

Saved successfully!

Ooh no, something went wrong!