1 Reply Latest reply on Oct 22, 2006 2:24 PM by leotemp

    [Bindable] causes compilation errors (definition not found) ?

    Jake_Bloomberg
      I'm trying to build a simple actionscript project, where an embedded gif is moving around the screen.
      Without the [Bindable] tag it works fine, with [Bindable] it throws:

      1172: Definition mx.binding:BindingManager could not be found. hello2.as hello2 line 1
      1172: Definition mx.binding:BindingManager could not be found. hello2.as hello2 line 1
      1172: Definition mx.core:IPropertyChangeNotifier could not be found. hello2.as hello2 line 1
      1172: Definition mx.core:IPropertyChangeNotifier could not be found. hello2.as hello2 line 1
      1172: Definition mx.events:PropertyChangeEvent could not be found. hello2.as hello2 line 1
      1172: Definition mx.events:PropertyChangeEvent could not be found. hello2.as hello2 line 1
      1172: Definition mx.utils:ObjectProxy could not be found. hello2.as hello2 line 1
      1172: Definition mx.utils:ObjectProxy could not be found. hello2.as hello2 line 1
      1172: Definition mx.utils:UIDUtil could not be found. hello2.as hello2 line 1
      1172: Definition mx.utils:UIDUtil could not be found. hello2.as hello2 line 1
      1120: Access of undefined property PropertyChangeEvent. hello2.as hello2 line 12

      I looked in the docs, there is no mx.binding package at all. Is this a flex bug or what? Source is below.


      package {
      import flash.display.Sprite;
      import flash.events.*;
      import mx.core.BitmapAsset;

      public class hello2 extends Sprite
      {
      [Embed(source="assets/back.gif")]
      [Bindable]
      private var bar:Class;
      private var foo:BitmapAsset;

      public function hello2()
      {
      foo = new bar();
      foo.smoothing = true;
      addChild(foo);
      foo.y =100;
      addEventListener(Event.ENTER_FRAME, this.onEnterFrame);
      stage.frameRate = 50;
      }
      private function onEnterFrame(event:Event):void
      {
      foo.x++;
      }
      }
      }
        • 1. Re: [Bindable] causes compilation errors (definition not found) ?
          leotemp Level 1
          I think you need to bind the asset outside of your class declaration like this:

          package {
          import flash.display.Sprite;
          import flash.events.*;
          import mx.core.BitmapAsset;

          [Embed(source="assets/back.gif")]
          [Bindable]
          private var bar:Class;
          private var foo:BitmapAsset;

          public class hello2 extends Sprite
          {

          public function hello2()
          {
          foo = new bar();
          foo.smoothing = true;
          addChild(foo);
          foo.y =100;
          addEventListener(Event.ENTER_FRAME, this.onEnterFrame);
          stage.frameRate = 50;
          }
          private function onEnterFrame(event:Event):void
          {
          foo.x++;
          }
          }
          }

          Let me know if that doesnt work, i have allot of questions about packages myself and havent got much help on this forum yet. Hopefully as more people get better at flex that will change.