October 12, 2006 1 Comment
[Peter Ent: Writing Flex 2 Components]: Being part of the Flex framework insures that the component is created properly and receives events at the right time. For example, when the component is created its constructor is called, but that’s not the time to make any children (the skins – needle, frame, and cover). When it is time for the children to be created, the Flex framework invokes the component’s createChildren() method. But that’s not when the component is visualized (or rendered). For that, the Flex framework invokes the component’s updateDisplayList() method.
I’m going to use the overly simple Gauge component as the example. It is simple because there is the logic to make the gauge work plus three skins. In general, that’s how components are: there is a class for the component and then skins to visualize the component. You can have many classes which make up the component, and indeed some of the Flex components do that. For the sake of brevity, I’ve limited this to a single class file.