5 Replies Latest reply on Apr 27, 2006 3:01 PM by Balthazarin

    external files with same first 12 chars

    Balthazarin
      Hello.
      I m makin a interactive map that have a linked images, the problen is when I click in any ponit of map, i need search the images with de firs 12 chars are the same tha the point that i clicking.(my inglish is very bad), and after the coincident images apear in a lis enumering this images and after i wil can click in this names an director showme de image.

      1.the user make a click in a any seccion of map that have a name.
      2.director search this name in a external cast of images names(the first 12 char) and show the names of this images in the stage.
      3. the user see the posibilites and chse una imgen(clicking) and show the image.

      i try make a list of external images:

      on getImageList
      gimageList= [ ]
      repeat with i = 1 to 89
      fileName = getNthFileNameinFolder(gImageFolder, i)
      if string(filename.char[1..12]) contains "" then exit repeat
      gImageList.add(fileName)
      return(gimageList)
      end repeat
      end if
      end

      the most importhan thing of may problen, is the posibility sherch the imagens that contains the same firs 12 chars and show me this images.


        • 1. Re: external files with same first 12 chars
          Level 7
          You could try Buddy API which will permit you to obtain a listing of
          filenames with wildcard matching.

          For example, if your first 12 characters happened to be "abcdefghijkl"
          you could obtain a list of similarly named files with something like:
          tChars = "abcdefghijkl"
          lFiles = baFileList(_movie.path & "Images", tChars & "*.*")

          Buddy API is free for the first 2 functions used any number of times in
          a single session: < http://www.mods.com.au>
          • 2. Re: external files with same first 12 chars
            Level 7
            Try the following (replacement) handler:
            -- example call:
            lFiles = getFileMatchList(aFilename.char[1..12],_movie.path&"Images","jpg")

            --
            on getFileMatchList aMatchFilename, aFolder, aFileType
            -- validate parameters
            if ilk(aMatchFilename, #string) = 0 then return []
            if ilk(aFolder, #string) = 0 then return []

            -- set default if file type not passed
            -- (handler expects something like: "jpg", "bmp", "html", etc.)
            if voidP(aFileType) then aFileType = "*"

            -- return list of files matching search criteria:
            return baFileList(aFolder, aMatchFilename & "*." & aFileType)
            end
            • 3. external files with same first 12 chars
              Balthazarin Level 1
              hi,
              i have another question, i put the files in diferent folders, and i need put with bafilelist a variavle but a i try LFiles = baFileList(_movie.path & "images " & namefolder, "*.*" ) the variabel "namefolder" is the name of the point of the map, and is the nema of de subpath of images. but don`t work. how put a variable in the path string???????.

              thank for the heelp
              • 4. Re: external files with same first 12 chars
                Level 7
                > i have another question, i put the files in diferent folders, and i need put
                > with bafilelist a variavle but a i try LFiles = baFileList(_movie.path &
                > "images " & namefolder, "*.*" ) the variabel "namefolder" is the name of the
                > point of the map, and is the nema of de subpath of images. but don`t work. how
                > put a vaiavle in the path string.

                It should work as you've posted (assuming the web forum has removed the
                folder delimiter from what you posted)
                Could you try something like the following:
                tPath = _movie.path
                tPath = tPath & "images" & tPath.char[tPath.length] & namefolder
                lFiles = baFileList(tPath, "*.*")
                • 5. Re: external files with same first 12 chars
                  Balthazarin Level 1
                  hi, tanks for the help.

                  look at this, this is my script, this work very good, now i need use preloadthing for precargin the images, because are very large and i need show a progress bar, but i don no how use this with this dinamic script..., found a script http://www.lingoworkshop.com/Articles/Shockwave_Preloader.php and is is i like to do, but, with this script..

                  property spriteNum, nombre , imagen, Lfolder, alt, carpeta,netID
                  global tPath, lPath, itemText


                  on mousedown tPath,

                  Lfolder = baFolderList( _movie.path & "Archivos" )
                  pointClicked = _mouse.mouseLoc
                  currentMember = sprite(spriteNum).member
                  itemNum = sprite(spriteNum).pointToline(pointClicked)
                  itemText = currentMember.line[itemNum]

                  pos = member(9).rect
                  alt = itemText.char.count


                  if itemText.char[13] ="_" then
                  carpeta = itemText.char[1..12]


                  else
                  if itemText.char[14] = "_" then
                  carpeta = itemText.char[1..13]

                  else
                  if itemText.char[12] = "_" then
                  carpeta = itemText.char[1..11]

                  end if
                  end if
                  end if

                  tPath = _movie.path & "Archivos\" & carpeta & "\"


                  member(9).filename = tPath & itemText
                  member(13).filename = tPath & itemText


                  end


                  i have another quiestion, i think that put evrything in mousedown handler not is the best way, whish are?