Форум Flasher.ru

Форум Flasher.ru (http://www.flasher.ru/forum/index.php)
-   Action script 2.0 (http://www.flasher.ru/forum/forumdisplay.php?f=49)
-   -   ContextMenu (http://www.flasher.ru/forum/showthread.php?t=58264)

RDA 17.05.2004 17:34

ContextMenu
 
Что я делаю не так?

Код:

class Item extends MovieClip {
  private var menu_cm:ContextMenu;
  /////////////////////////////////////////////
  function Item() {
      this.menu_cm = new ContextMenu();
      this.menu_cm.customItems.push(new ContextMenuItem("Replace", replace));
      //
      this.menu = this.menu_cm;
  }
  //////////////////////////////////////////////
  function replace(menu,obj) {
      trace("Success!");
  }
}

Выводит ошибку
**Error** D:\My Projects\Site Plan\Flash\classes\Item.as: Line 9: There is no property with the name 'menu'.
this.menu = this.menu_cm;

???

Nucer 17.05.2004 19:22

Ты ведь пишешь this.menu , то есть обращаешься к члену класса с названием menu, а такого нету.

RDA 18.05.2004 11:46

Специально для Nucer
Код:

class Item extends MovieClip {
  private var menu_cm:ContextMenu;
  /////////////////////////////////////////////
  function Item() {
      this.menu_cm = new ContextMenu();
      this.menu_cm.customItems.push(new ContextMenuItem("Replace", replace));
      //
      this.menu = this.menu_cm;
      this._alpha = 50;
      this.onEnterFrame = function() {
        //
      }
  }
  //////////////////////////////////////////////
  function replace(menu,obj) {
      trace("Success!");
  }
}

Вопрос открыт!!!!


Часовой пояс GMT +4, время: 20:19.

Copyright © 1999-2008 Flasher.ru. All rights reserved.
Работает на vBulletin®. Copyright ©2000 - 2026, Jelsoft Enterprises Ltd. Перевод: zCarot
Администрация сайта не несёт ответственности за любую предоставленную посетителями информацию. Подробнее см. Правила.