Skip navigation
Currently Being Moderated

Cant understand why binding not works

Jul 9, 2012 11:12 AM

Hello. Please help me.  simple example not works for me (((


<?xml version="1.0" encoding="utf-8"?>

<s:Application xmlns:fx=""


                                 xmlns:mx="library://" minWidth="955" minHeight="600"








                              private var eee:test123;

                              protected function application1_creationCompleteHandler(event:FlexEvent):void {

                                        eee = new test123(this);



                              protected function button1_clickHandler(event:MouseEvent):void {

                                        dispatchEvent( new Event("test2"));










          <s:Label text="{eee.text}"/>

          <s:Button click="button1_clickHandler(event)"/>




and file


package {




          import mx.binding.utils.BindingUtils;



          public class test123 extends EventDispatcher{

          [Bindable(event = "test1")]

          public var text:String ;


                    public function test123(obj:EventDispatcher){




                    protected function ontest2(event:Event):void {

                              text = "fdsfadsf";

                              dispatchEvent(new Event("test1"));






When i clicked the button label not changes. But if i transfer all code from test123 directly to main program it works fine. What is wrong???

  • Currently Being Moderated
    Jul 9, 2012 2:43 PM   in reply to sadensmol

    I don’t see Re: Cant understand why binding not works metadata in the example that is not working.

    Mark as:
  • Currently Being Moderated
    Jul 10, 2012 9:49 AM   in reply to sadensmol

    Aren’t you getting warnings in the console about eee not being bindable?  I would think it would need metadata too.

    Mark as:
  • Currently Being Moderated
    Jul 11, 2012 10:12 AM   in reply to sadensmol

    If you don’t have the binding events on each level of the expression, then you are relying on timing, or that certain parts of the expression do not change.  In your first case, eee was being assigned late, in this case the singleton is ready right away.

    Mark as:
  • Currently Being Moderated
    Jul 11, 2012 5:38 PM   in reply to sadensmol

    I’m unclear what code ran and didn’t run.  I would put in more breakpoints or trace statements.

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points