binding questions...

19 views
Skip to first unread message

Ben McMaster

unread,
Feb 24, 2010, 11:24:45 PM2/24/10
to bumpslide
I am getting this argument error:

[Binding Error] Unable to execute model binding

From Binding.as. It looks like an argument error. Here is my code. I
feel like I am following the example. Not sure why it needs an
argument. I still get the error when I give it a generic dummy arg.
However, even with the error, it calls the function, and everything
seems to be working...


override protected function addChildren():void
{
super.addChildren();

// init bindings
model.bind('images', this, populateImageArray);
}

public function populateImageArray():void
{
if (model.images) {
imageDataArray = model.images;
}
}

I also tried this way of binding which I used on a previous project:

override protected function addChildren():void
{
super.addChildren();

imageContentArray = new Array();

// init bindings
model.bind('images', this);
}

public function set images(data:Array){
if (data) {
imageDataArray = data;
}
}

but I get this error:

ReferenceError: Error #1077: Illegal read of write-only property
images on myapp.view.LostGrid.
at com.bumpslide.data::Binding/executeBinding()
at com.bumpslide.data::Binding()
at com.bumpslide.data::Binding$/create()
at com.bumpslide.data::BindableModel/bind()
at myapp.view::LostGrid/addChildren()
at com.bumpslide.ui::Component/init()
at myapp.view::AppComponent/init()
at com.bumpslide.ui::BaseClip()
at com.bumpslide.ui::Component()
at myapp.view::AppComponent()
at myapp.view::LostGrid()
at myapp.view::MainView/addChildren()
at com.bumpslide.ui::Component/init()
at myapp.view::AppComponent/init()
at com.bumpslide.ui::BaseClip()
at com.bumpslide.ui::Component()
at myapp.view::AppComponent()
at myapp.view::MainView()
at myapp::AppRoot/handleStartupComplete()
at Function/http://adobe.com/AS3/2006/builtin::call()
at com.bumpslide.command::CommandEvent/result()
at com.bumpslide.command::CommandQueue/finish()
at com.bumpslide.command::CommandQueue/handleCommandComplete()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at com.bumpslide.command::Command/notifyComplete()
at com.bumpslide.command::ServiceCall/result()
at myapp.commands::LoadLostSet/result()
at com.bumpslide.net::AbstractRequest/finishCompletedRequest()
at com.bumpslide.net::HTTPRequest/handleCompleteEvent()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()

Any thoughts? Am I missing something...

Thank you!

David Knape

unread,
Feb 25, 2010, 12:13:18 AM2/25/10
to bump...@googlegroups.com
In the first case, the Binding class is catching an argument error from somewhere farther down the call stack.  The code that handles callbacks, is trying various argument combinations to see what works.  The problem is that if an argument error is being thrown for some other reason, it's still being caught by the Binding class which is tracing out that "BindingError" message.  I just removed this final catch, so hopefully you can now see where the error is really coming from.

In the second case, the problem is that the Binding class mistakenly assumes the setter also has a corresponding getter.  It does a check to see if the getter returns a matching value for the newValue, and if so, it doesn't execute the binding callback.  The error is occurring when it tries to check the current value for 'images', but you have no getter for that.  Thus, it's a 'write-only property'.  I wrapped this in a new try/catch block.

Try this updated version of Binding.as

-dk

--
David Knape
Programmer / Consultant


--
--
Bumpslide Mailing List
http://groups.google.com/group/bumpslide

To post to this group, send email to bump...@googlegroups.com
To unsubscribe from this group, send email to
bumpslide+...@googlegroups.com

Ben McMaster

unread,
Feb 25, 2010, 6:59:39 PM2/25/10
to bumpslide
Awesome. Yeah. I see what you are talking about. Thank you for making
the change to the code!

/ben

On Feb 24, 9:13 pm, David Knape <tkd...@gmail.com> wrote:
> In the first case, the Binding class is catching an argument error from
> somewhere farther down the call stack.  The code that handles callbacks, is
> trying various argument combinations to see what works.  The problem is that
> if an argument error is being thrown for some other reason, it's still being
> caught by the Binding class which is tracing out that "BindingError"
> message.  I just removed this final catch, so hopefully you can now see
> where the error is really coming from.
>
> In the second case, the problem is that the Binding class mistakenly assumes
> the setter also has a corresponding getter.  It does a check to see if the
> getter returns a matching value for the newValue, and if so, it doesn't
> execute the binding callback.  The error is occurring when it tries to check
> the current value for 'images', but you have no getter for that.  Thus, it's
> a 'write-only property'.  I wrapped this in a new try/catch block.
>

> Try this updated version of Binding.ashttp://code.google.com/p/bumpslide/source/detail?r=195

> > bumpslide+...@googlegroups.com<bumpslide%2Bunsubscribe@googlegroups .com>

Reply all
Reply to author
Forward
0 new messages