Reputation: 255
how can i do binding exists property in actionscript e.g. i want image still in middle aplication..in mxml i do this simple as <mx:Image source="image.jpg" x="{this.width/2}"
/> ...i don't know how can i do this simple in actionscript without event handlers... i put this code to application_creationCompleteHandler..
something like var image:Image = new Image(); image.source="image.jpg"; image.x=this.width/2;
or have i put this to another function?? i can't do e.g. updateComplete event handler and change it there...
thanks pavel
Upvotes: 2
Views: 249
Reputation: 16085
Check the BindingUtils class and its bindSetter method. You can bind a setter to the "width" property and adjust the x property of your image in that handler.
Upvotes: 7
Reputation: 2786
Considering that as3 is OO language i always start from something like this:
public class App extends Sprite {
public function App() { //constructor
super(); //extends class constructor
loading(); //your function were you set all elements properties
}
}
Upvotes: 0