WHAT'S HOT
Prev | Current Page 159 | Next

LordAlex Leon, Greg Goralski

"Foundation Flex for Designers"

zip file.
8. Switch over to the Source view in the MXML Editor.
The ActionScript
As with all Flex Builder applications, we begin by creating the Script tags, below the application tags,
before the components tags. Below this we list the ActionScript libraries we want to import (Figure 12-9).
Figure 12-9. Imported file libraries
243
FLEX AND AIR
The first of these, flash.filesystem.file, allows us to navigate through the directories on our computer.
The following three give us control over our video and sound files.
The function initTree, shown in Figure 12-10, sets our FileSystemTree component to point to the
desktop of the user. This function works for both Mac and PC.
Figure 12-10. The initTree function
We will be setting up the function getDetails (see Figure 12-11) to respond when the user doubleclicks
on an object in the FileSystemTree. If this object is a directory, this function will open it. If the
object is not a directory, then another function, named logFileDetails, is called.
Figure 12-11. The getDetails function
The logFileDetails function (Figure 12-12) takes the file that the user has double-clicked and figures
out what to do with it. This first step is to separate the extension from the rest of the file. This is
placed into the variable type. A switch then decides what to do based on the extension stored in type.
The first three possibilities (png, jpg, and gif) are all image formats. Therefore, when a file with any of
these extensions is selected, a function called showImage is called.


Pages:
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171
Kylie Minogue 39 i p Stroiki ślubne teksty pl siatki tkane