Connecting FileSystemTree to functions
You can connect the FileSystemTree to the functions by either adding the code directly to the MXML
tag in the Source view or by adding the names of the functions to the properties of the component in
the Design view.
10. In the Design view, select the FileSystemTree. Switch to the Category View of the Properties panel
and open the Events folder. This folder allows you to call a function that you created in
ActionScript for any of the possible events for that component. In this case, we add initTree()
for the creationComplete event (this will run the function that we created that points our component
to the desktop as soon as the component is created) and getDetails() for the
doubleClick event. The getDetails function looks at what the user double-clicked and initiates
the appropriate function (showImage, playSound, or playVideo). This is shown in Figure 12-15.
Figure 12-15. FileSystemTree with events that call functions
If you look back at this component in the Source view, you can see how the tag has been changed
(Figure 12-16). You can add this code manually if you find it easier.
Figure 12-16. MXML tag for FileSystemTree
247
FLEX AND AIR
Adding the remaining components
We have now created the FileSystemTree and the code that goes with it. Next let??™s create the components
that respond to the FileSystemTree. Specifically this will be the display area for the media and a Text
component to show our message about the media.
Pages:
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173