1 Reply Latest reply on Jun 3, 2008 5:09 AM by mammut02

    SimpleButton crashes in AIR but not in Flash9

    mammut02
      Hello
      I'm facing a strange bug. I'm building a SimpleButton from FlashCS3, with upState and overState created dynamically from library assets. In AIR app, when I mouse over, it crashes the app.
      Why this code works fine when I export in Flash9, but crashes when I export in AIR.
      Here is the simple code : (put 2 assets in your library with linkage name "btnAssetOut" and "btnAssetOver"

      import flash.utils.getDefinitionByName;

      var ButtonState:Class = getDefinitionByName("btnAssetOut") as Class;
      var _btnState:MovieClip = new ButtonState();
      var ButtonOverState:Class = getDefinitionByName("btnAssetOver") as Class;
      var _btnOverState:MovieClip = new ButtonOverState();

      var buttonMC:SimpleButton = new SimpleButton();
      buttonMC.upState = _btnState;
      buttonMC.overState = _btnOverState;
      buttonMC.downState = _btnState;
      buttonMC.hitTestState = _btnState;
      buttonMC.width = 160;
      buttonMC.height = 30;

      this.addChild(buttonMC);