[ Pobierz całość w formacie PDF ]
.Example 4-4 creates a Lingo list of all the cast member names.Using theexamineList() utility from Example 3-2, we can check the cast member names forduplicates or potentially extraneous spaces:examineList (buildCastmemberNamesList())144 Chapter 4  CastLibs, Cast Members, and Sprites CastLib and Cast Member LingoExample 4-4: Checking for Troublesome Cast Member Nameson buildCastmemberNamesListset nameList = []-- Create a list containing castmember namesrepeat with i = 1 to the number of castLibsrepeat with j = 1 to the number of members of castLib i-- Find cast members with namesset thisMember = member j of castLib iif the type of thisMember #empty thenif the name of thisMember EMPTY thenadd (nameList, the name of thisMember)end ifend ifend repeatend repeatreturn nameListend buildCastmemberNamesListFinding linked cast membersThe utility in Example 4-5 finds all cast members that have links to external filesand reports if the specified path is not in the same folder as the current Directormovie.Add clauses to the case statement as needed to handle the different proper-ties for linked file paths.Example 4-5: Checking for Linked Cast Memberson checkLinks-- Create a list containing castmember namesrepeat with i = 1 to the number of castLibsrepeat with j = 1 to the number of members of castLib iset thisMember = member j of castLib icase (the type of thisMember) of#SWA: set linkPath = the streamName of thisMember#flash: set linkPath = the pathName of thisMemberotherwise: set linkPath = the fileName of thisMemberend caseif linkPath EMPTY thenif (linkPath starts the moviePath) thenput "Linked" && thisMember & ":" && linkPath && "OK"elseput "Linked" && thisMember & ":" && linkPath && ¬"not in same folder as DIR movie"end ifend ifend repeatend repeatend checkLinksReader Exercise: Modify Example 4-5 to check whether the specified files exist andto verify that the file paths obey the Windows 3.1 file naming requirements.Youmight use an appropriate Xtra to copy the files to the local directory, and reset thefileName, streamName, or pathName of member property.You might even sort theCastLib and Cast Member Lingo 145 CastLib and Cast Member Lingofiles into different subdirectories based on their media type.You can also modifythe example to find and check linked castLibs using the fileName of castLibproperty.External file sizesThe size of member property does not return meaningful data for most externallylinked files.To obtain the actual size of an external file on disk, use Example 4-6,which returns the size in KB.It requires the FileIO Xtra and returns  43 as anerror code if the file cannot be found and other negative numbers for other errors.(See Chapter 14 and Appendix E, Error Messages and Codes, in Lingo in aNutshell.)Example 4-6: Determining External File Sizeson getSize extMember-- Returns the file size of an external asset, in KB-- This assumes that the FileIO Xtra is installedset fileObj = new (Xtra "FileIO")if objectP(fileObj) then-- Get the file's lengthopenFile (fileObj, the fileName of member extMember, 1)set errCode = status (fileObj)-- A negative code indicates an errorif errCode 0 and size 16X) > 2400 KB/sec > 2000 KB/sec = 3.0)set gHasQT2 = the quickTimePresentelse-- Macintosh has only one version of QT installedif the quickTimePresent thenset gHasQT3 = (quickTime3check() >= 3.0)set gHasQT2 = not (gHasQT3)elseset gHasQT3 = FALSEset gHasQT2 = FALSEend ifend ifend checkQTversionson quickTime3check-- This checks whether the QT3 Xtra is installed-- before attempting to call quickTimeVersion()repeat with x = 1 to the number of Xtrasif the name of xtra x = "QuickTimeSupport" then544 Chapter 16  Digital Video Digital Video in DirectorExample 16-2: Checking for QT2 and QT3 Presence in D6.5 (continued)return quickTimeVersion()end ifend repeatif the quickTimePresent then-- Assumes QT 2.x is installed if pre-QT3 version is foundreturn 2 [ Pobierz caÅ‚ość w formacie PDF ]

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • drakonia.opx.pl
  • Linki