Quote:
what is the main stage/timeline in flex.
is there a display list as it is in flash....e.g are the objects created/layered in the order of code appearance. eg. stuff defined between tags at the beginning of the file are placed at the bottom of the display list, and as the code moves along rest of the stuff is added on top.
|
Yes.
Quote:
|
does objects/tags nesting determine their placement in display list+parent child relationship.
|
Yes.
Quote:
do the width and height in a markup like this
<mx:Object width="400" height="400" >
refer to DisplayObject.width/height in flash.
|
Well yes and no. All you are doing in your example is instantiating an Object and giving it a width and height.
The following do the exact same thing in MXML / AS:
Code:
<mx:Object id="myObject" width="400" height="400" />
Code:
public class MyClass()
{
function MyClass()
{
this.myObject = {width:400, height:400};
}
public var myObject:Object;
}
When you add a tag to MXML you are telling it to instantiate whatever Actionscript class that tag represents. You can then use the attributes to set initial class properties, add event handlers, etc. If the class happens to be a DisplayObject, it will add it to the display list of it's parent tag. So yes, if your tag is a DisplayObject, than you are assigning the width/height of the DisplayObject.
Quote:
and lastly, how do events propagate in flex. ive seen in tutorials that flex uses listeners like javascript eg onclick=function().
is there a way to listen events by addEventListener()
|
Again, same things:
Code:
<fx:Script>
<![CDATA[
private function changeHandler(event:Event):void { }
]]>
</fx:Script>
<s:TextInput id="textInput" change="changeHandler(event)" />
Code:
this.textInput.addEventListener(Event.Chage, changeHandler);
...it's a matter of personal preference.
Quote:
|
anyway this whole flex structure and oop seems very odd atm. cant see much benefit of using it. the only thing atm i could think if is the use of % in defining objects width and placement on the screen.
|
It helps if you think of every MXML file as an Actionscript class. Any code you add in the script tag is just like you were to add it to a Class. Any MXML tags within that file is just a shortcut notation to instantiate other classes, assign initial properties, add event handlers, assign styles, etc.
All of the same OOP rules apply. Just like in AS, it's up to the programmer to follow OOP conventions or not.