4 Replies Latest reply on Jun 8, 2009 8:19 AM by Jim Daniel

    What is this 'Warning' trying to tell me.

    Jim Daniel Level 1

      I'm getting an error message and I'm not sure just what it is telling me and how best to go about getting it to go away.

      Here is the message:

      warning: unable to bind to property 'Screen' on class 'Object' (class is not an IEventDispatcher)

       

      And the relavent code;

       

      [Bindable]
      private var UserData:ArrayCollection;

      .

      .

      .

      .

      .

      <mx:TabNavigator x="10" y="202" width="689" height="316" borderThickness="1" cornerRadius="14" borderColor="#AB5B0C" themeColor="#AB5B0C" backgroundAlpha="1.0"
                          color="#603913" id="FoxDisplay" alpha="1.0" borderStyle="inset" backgroundColor="#E3E5DA" creationComplete="checkfFl()" selectedIndex="{displayPref}">

      <mx:Canvas label="{UserData.getItemAt(0).Screen}'s  Foxes" width="100%" height="100%" id="YourFoxsTab" color="#603913" borderColor="#AB5B0C" borderStyle="none">

       

      The problem is located in the Canvas Label where I'm attempting to use the screen name of the user found in the UserData:ArrayCollection.

       

      Any ideas?

        • 1. Re: What is this 'Warning' trying to tell me.
          _Natasha_ Level 4

          Hi,

          this warning shown because items in Array has default type Object and Object don't dispatch change events.

          I've seen this message in Flex 2, but can't reproduce it in FB3.

          1 person found this helpful
          • 2. Re: What is this 'Warning' trying to tell me.
            Jim Daniel Level 1

            Interesting.

            Any idea how serious this issue is?  Everything seems to be working as it should so I'm more than inclined to report it as a bug in the compiler.

            • 3. Re: What is this 'Warning' trying to tell me.
              Flex harUI Adobe Employee

              I doubt that it is a bug.  Let's say the objects in the arraycollection look like:

               

               

               

               

              There is no way to watch for changes to the Screen property because these objects are plain Objects and don't dispatch events.  Your app as written will work because as the Canvas is initialized it will read the value of the first item's Screen property.  However, if you simply add a button and change "screen1" to "screenX", when you click that button, I doubt you'll see those changes reflected.

               

              Using Object is "inefficient" anyway, so it is best to create a class for your user data and make the properties bindable.

               

              Alex Harui

              Flex SDK Developer

              Adobe Systems Inc.

              Blog: http://blogs.adobe.com/aharui

              • 4. Re: What is this 'Warning' trying to tell me.
                Jim Daniel Level 1

                You make a valid point about the Object in the ArrayCollection.  The reason I think this is a bug in the compiler is that
                1: The ArrayCollection is bindable
                2: ArrayCollections are recommended object for dataProvider
                3: When an element of an object in an ArrayCollection changes the ArrayCollection has changed so shouldn't the bindable property of the ArrayCollection be the controlling property?

                As to creating a custom object, the ArrayCollection UserData is populated by an AMFPHP service call I don't see any practicable method for doing this.  I may be wrong about this and would love to find away to create custom objects in ArrayCollections that are populated by service calls to my data base.