ActionScript 3 Language Specification |
|||
| ActionScript 3.0 Language Specification > 12 Namespaces > 12.5 Namespace examples > 12.5.1 Access control | |||
class A {
private namespace Key
private var friends = [ B ]
function beMyFriend( suitor ) {
for each( friend in friends )
{
if( suitor is friend ) return Key
}
return null
}
Key function makeMyDay()
{
trace("making my day")
}
}
class B {
function befriendAnA(a:A) {
var key : Namespace = a.beMyFriend(this)
if( key != null )
{
a.key::makeMyDay()
}
}
}
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/specs/actionscript/3/as3_specification114.html