• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Issues with removing Flex data binding to use Air 14

Participant ,
Jul 28, 2014 Jul 28, 2014

Copy link to clipboard

Copied

Hello,

I was wondering if anyone had optimal solution for replacing the Flex data binding classes in Air 14. I'm unable to merge the Flex and Air SDK together anymore so all the binding handlers need to be replaced. Has anyone else run into this issue yet? The automated binding generation and handling was the best feature of Flex and now that it's broken it creates huge issues for me.

This is for Air desktop and mobile applications. They still build just no of the event handling works.

Cheers,

Pete

TOPICS
Development

Views

242

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Participant , Jul 28, 2014 Jul 28, 2014

I had forgotten I solved this myself last Dec. So basically from what I can tell the precompiler no longer does any [Bindable] conversions so you have to manually create the getters and setters for your model when this changes. I hope this helps anyone who may run into the same problem. There's literally no documentation on this any wheres.

i.e.

[Bindable]

public var username : String;

becomes

private var _username : String;

    

        [Bindable(event="propertyChange")]

        public function get us

...

Votes

Translate

Translate
Participant ,
Jul 28, 2014 Jul 28, 2014

Copy link to clipboard

Copied

LATEST

I had forgotten I solved this myself last Dec. So basically from what I can tell the precompiler no longer does any [Bindable] conversions so you have to manually create the getters and setters for your model when this changes. I hope this helps anyone who may run into the same problem. There's literally no documentation on this any wheres.

i.e.

[Bindable]

public var username : String;

becomes

private var _username : String;

    

        [Bindable(event="propertyChange")]

        public function get username():String

        {

            return this._serviceState;

        }

    

        public function set username(value:String):void

        {

            var oldValue:Object = this._username;

            if (oldValue !== value)

            {

                this._username = value;

                if (this.hasEventListener("propertyChange"))

                    this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "username", oldValue, value));

            }

        }

You also need to make sure what ever class contains this property implements IEventDispatcher and has the following functions:

//IEventDispatcher implementation
//
private var _bindingEventDispatcher:flash.events.EventDispatcher =
new flash.events.EventDispatcher(flash.events.IEventDispatcher(this));
/**
  * @inheritDoc
  */
public function addEventListener(type:String, listener:Function,
  useCapture:Boolean = false,
  priority:int = 0,
  weakRef:Boolean = false):void
{
_bindingEventDispatcher.addEventListener(type, listener, useCapture,
priority, weakRef);
}
/**
  * @inheritDoc
  */
public function dispatchEvent(event:flash.events.Event):Boolean
{
return _bindingEventDispatcher.dispatchEvent(event);
}
/**
  * @inheritDoc
  */
public function hasEventListener(type:String):Boolean
{
return _bindingEventDispatcher.hasEventListener(type);
}
/**
  * @inheritDoc
  */
public function removeEventListener(type:String,
listener:Function,
useCapture:Boolean = false):void
{
_bindingEventDispatcher.removeEventListener(type, listener, useCapture);
}
/**
  * @inheritDoc
  */
public function willTrigger(type:String):Boolean
{
return _bindingEventDispatcher.willTrigger(type);
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines