![]() |
|
||||||||||
|
|||||||
|
|
« Предыдущая тема | Следующая тема » |
| Опции темы | Опции просмотра |
|
![]() |
![]() |
|
|
|
|||||
|
Регистрация: Feb 2006
Сообщений: 31
|
Господа, помогите пожалуйста решить одну проблему.
Существует класс class Footballer
{
private var _fUID :Number =null;
private var _fName : String = null;
function Footballer(fUID :Number, fName :String){
this._fUID = fUID;
this._fName = fName;
this.CreateFootballer();
}
private function CreateFootballer():Void{
this.i = _root.createEmptyMovieClip ("foot"+this.fUID.toString(),_root.getNextHighestDepth());
this.foot = this.i.attachMovie("mcFootballer","foot_mc",this.i.getNextHighestDepth());
}
this.i.onPress=function(){
// здесь по клику нужно бы сохранить ссылку на объект данного класса в
//статическую переменную другого класса
ControlFootballer.Foot = this;
}
}
и обратиться к некому public свойству ControlFootballer.Foot.fName ( значение для _fName не определено) не возможно. Подскажите как в ControlFootballer.Foot запихать ссылку на весь объект класса Footballer? Спасибо |
|
|||||
|
вар.1: сохранять ссылку на экземпляр в создаваемом мувике:
private function CreateFootballer () : Void {
var i = _root.createEmptyMovieClip ("foot" + _fUID.toString () , _root.getNextHighestDepth ());
i.ref=this;
i.attachMovie ("mcFootballer", "foot_mc", this.i.getNextHighestDepth ());
i.onPress = function (){
ControlFootballer.Foot = this.ref;
}
}
private function createFootballer () : Void {
var i = _root.createEmptyMovieClip ("foot" + _fUID.toString () , _root.getNextHighestDepth ());
i.onPress=Delegate.create(this,onPress);
i.attachMovie ("mcFootballer", "foot_mc", i.getNextHighestDepth ());
}
function onPress() {
ControlFootballer.Foot = this;
}
|
|
|||||
|
Регистрация: Feb 2006
Сообщений: 31
|
Спасибо, Делегаты в АС2 не нашел, а вот первый вариант работает хорошо!
![]() |
![]() |
![]() |
Часовой пояс GMT +4, время: 03:41. |
|
|
« Предыдущая тема | Следующая тема » |
|
|