In particular, focus on the x and y attributes. This works as
I expect, as in, I get the result I want. However, I'm a bit
baffeld about the under pinnings about how/why it works :)
How does the canvas know to re-position itself each time the
browser is re-sized?
How would I make these bindings into a function so I don't
have to have my "code" intermingled with the actual mxml parts? Or
is this even possible?
I have read various things on binding but still have the
above outstanding questions.
The binding mechanism recognizes bindable variables in the
expression you give it. If any of those variables change, the
entire expression is re-evaluated. In this case,
parentDocument.width is a bindable variable.
One thing you can do is bind to a method call. The trick is
to pass the method a bindable variable so that the binding
mechanism calls your method whenever the variable changes.
And getx() does the calculations and returns an int.