10 Replies Latest reply on Apr 22, 2008 5:28 AM by npo rule

    Photo Gallery Porgram

    npo rule Level 1
      Hi everyone, hope you are all well.

      I am hoping someone here will be able to help me with a problem I am having with a photo gallery program I am trying to create.

      I am using Macromedia Director MX 2004.

      So basically what I am trying to create is a photo gallery where the user can upload pictures and photographs from their computer/laptop/USB stick/CD/DVD etc into the program.

      So when the user views the album the first picture will appear as a large photo with a text box beside it containing a discription. Underneath this is thumbnails of the rest of the photos in the album and the user can scroll back and forwards and select a thumbnail to be displayed as the large photo on the screen.

      My problem is I haven't been able to find anywhere a behaviour, piece of lingo or anything that will allow pictures to be scrolled.

      I already know how to use the custom scrollbar within director but this has only worked with text and scrolling up and down, not left and right.

      I have thought of putting the photos into some sort of textbox or something and getting it to move left and right but the problem is I wont know how many photos the user will upload into the album.

      Can anyone help me and/or point me in the direction of a director example so I can see how it works and the lingo behind it?

      Many thanks
        • 2. Re: Photo Gallery Porgram
          smileInVietnam
          cast member name : script main

          on prepareMovie
          script("script filmStrip manager").register()
          script("script imageView manager").register()
          end

          on stopMovie
          script("script filmStrip manager").destory()
          script("script imageView manager").destory()
          end
          • 3. Re: Photo Gallery Porgram
            smileInVietnam Level 1
            cast member name : script imageView manager

            global gImageViewerMgr
            global gFilmStripMgr

            property pImageInfo

            on new me
            me.initData()

            return me
            end

            on initData me
            pImageInfo = [:]
            pImageInfo[#sprite] = sprite(47)
            pImageInfo[#width] = 520
            pImageInfo[#height] = 390
            me.showClickedImg(1)
            end

            --------------------------------------------------------------
            -- ********************** public **************************--
            --------------------------------------------------------------

            on register me
            if voidP(gImageViewerMgr) then
            gImageViewerMgr = me.new()
            else
            gImageViewerMgr.initData()
            end if
            end

            on destory me
            (the actorList).deleteOne(gImageViewerMgr)
            gImageViewerMgr = void
            end

            on showClickedImg me, orderNum
            spNum = pImageInfo.sprite.spriteNum
            back1_sprite = sprite(spNum - 1)
            back2_sprite = sprite(spNum - 2)

            pImageInfo.sprite.visible = false
            back1_sprite.visible = false
            back2_sprite.visible = false

            imageMem = pImageInfo.sprite.member
            filePath = gFilmStripMgr.getImgPath(orderNum)
            imageMem.fileName = filePath

            imageMem.regPoint = point(imageMem.width/2, imageMem.height/2)

            if imageMem.width / 4 > imageMem.height / 3 then
            pImageInfo.sprite.width = pImageInfo.width
            pImageInfo.sprite.height = pImageInfo.width * imageMem.height / imageMem.width
            else
            pImageInfo.sprite.height = pImageInfo.height
            pImageInfo.sprite.width = pImageInfo.height * imageMem.width / imageMem.height
            end if

            back1_sprite.width = pImageInfo.sprite.width + 3
            back1_sprite.height = pImageInfo.sprite.height + 3
            back1_sprite.loc = pImageInfo.sprite.loc - [back1_sprite.width/2, back1_sprite.height/2]
            back2_sprite.width = pImageInfo.sprite.width + 5
            back2_sprite.height = pImageInfo.sprite.height + 5
            back2_sprite.loc = pImageInfo.sprite.loc - [back2_sprite.width/2, back2_sprite.height/2]


            pImageInfo.sprite.visible = true
            back1_sprite.visible = true
            back2_sprite.visible = true

            if filePath contains "avi" then
            go to "avi"
            mFile= filePath
            if mFile="" then return
            sendallsprites(#PlayFile,mFile)
            pFolder=FileFolder(mFile)

            else
            go to "bitmap"
            end if
            end

            on changeNextImage me

            end
            • 4. Re: Photo Gallery Porgram
              smileInVietnam Level 1
              cast member name : script filmStrip manager

              global gFilmStripMgr

              property pFilmStrip
              property pIconImg

              on new me
              me.initData()

              return me
              end

              on initData me
              baRegister("sharp",2294439)

              pIconImg = [:]
              pIconImg[#orderList] = []
              pIconImg[#maxSpeed] = 15
              pIconImg[#leftLimit] = -300 -- 왼쪽으로 이 값에 도달하면 재 배열을 한다...
              pIconImg[#rightLimit] = 100 -- 오른쪽으로 이 값에 도달하면 재 배열을 한다...
              pIconImg[#curPos] = -100 -- 이 값에서 시작을 한다...
              pIconImg[#distance] = 200 -- 각 아이콘 사이의 거리...

              pFilmStrip = [:]
              pFilmStrip[#folderList] = baFolderList( _movie.path )
              pFilmStrip[#curFolderNum] = 1
              pFilmStrip[#fileList] = []
              pFilmStrip[#startNum] = 1 -- 플름 스트립의 왼쪽 첫번째 리스트 번호...
              pFilmStrip[#fileNum] = 1 -- 현재 보여주는 파일의 이름...
              me.resetFileList()

              pFilmStrip[#folderText] = member("text folderName")
              end

              on resetFileList me
              -- 현재 지정한 폴더의 파일 리스트를 갱신해준다.
              curFolderName = pFilmStrip.folderList[pFilmStrip.curFolderNum]
              pFilmStrip.fileList = baFileList( _movie.path & curFolderName, "*.*" )

              -- 필요 없는 종류는 걸러준다...
              repeat with i = pFilmStrip.fileList.count down to 1
              file_Name = pFilmStrip.fileList
              file_extension = file_Name.char[file_Name.length - 2..file_Name.length]
              case file_extension of
              "jpg", "avi" :
              -- 이 두가지 파일만 허용한다...
              otherwise :
              pFilmStrip.fileList.deleteAt(i)
              end case
              end repeat

              pFilmStrip.fileNum = pFilmStrip.fileList.count -- 이래야지 화면에서는 처음것부터 보이겠지...
              pIconImg.curPos = -100
              end

              on viewFolderName me
              -- 현재 폴더 이름 보여주고...
              pFilmStrip.folderText.text = me.getCurFolderPath()
              end

              on getCurFolderPath me
              -- 현재 폴더의 경로를 반환한다.
              curFolderName = pFilmStrip.folderList[pFilmStrip.curFolderNum]
              return _movie.path & curFolderName
              end

              on getImgPath me, orderNum
              -- 현재 폴더의 큰 그림 이미지를 반환...
              curFolderPath = me.getCurFolderPath()

              curFileName = me.getFileName(orderNum)
              imgFilePath = curFolderPath & "\" & curFileName

              return imgFilePath
              end

              on getFileName me, orderNum
              -- 파일 이름을 반환한다...
              -- 왼쪽부터 지정한 번호번째의 이미지를 돌려준다...
              listNum = pIconImg.orderList.getOne(orderNum)
              if listNum = 0 then listNum = 2
              curListNum = listNum + pFilmStrip.fileNum - 1
              if curListNum > pFilmStrip.fileList.count then
              -- 끝번보다 크면 1번으로...
              curListNum = curListNum mod pFilmStrip.fileList.count
              if curListNum = 0 then curListNum = pFilmStrip.fileList.count

              end if

              if pFilmStrip.fileList = [] then exit

              curFileName = pFilmStrip.fileList[curListNum]

              return curFileName
              end
              --------------------------------------------------------------
              -- ********************** public **************************--
              --------------------------------------------------------------

              on register me
              if voidP(gFilmStripMgr) then
              gFilmStripMgr = me.new()
              else
              gFilmStripMgr.initData()
              end if
              end

              on destory me
              (the actorList).deleteOne(gFilmStripMgr)
              gFilmStripMgr = void
              end

              on registSpriteOrder me, orderNum
              -- 각 필름 스트립 스프라이트의 순번 리스트를 저장한다...
              pIconImg.orderList.add(orderNum)
              end

              on moveFolder me, moveDirection
              case moveDirection of
              #prev : -- 이전폴더... 그런데 처음 폴더까지 가면 다시 마지막으로...
              pFilmStrip.curFolderNum = pFilmStrip.curFolderNum - 1
              if pFilmStrip.curFolderNum < 1 then
              pFilmStrip.curFolderNum = pFilmStrip.folderList.count
              end if

              #next :
              -- 다음폴더... 그런데 마지막 폴더까지 가면 다시 첨으로...
              pFilmStrip.curFolderNum = pFilmStrip.curFolderNum + 1
              if pFilmStrip.curFolderNum > pFilmStrip.folderList.count then
              pFilmStrip.curFolderNum = 1
              end if
              end case


              -- pIconImg = [:]
              pIconImg.orderList.sort()
              -- pIconImg[#maxSpeed] = 15
              -- pIconImg[#leftLimit] = -300 -- 왼쪽으로 이 값에 도달하면 재 배열을 한다...
              -- pIconImg[#rightLimit] = 100 -- 오른쪽으로 이 값에 도달하면 재 배열을 한다...
              -- pIconImg[#curPos] = -100 -- 이 값에서 시작을 한다...
              -- pIconImg[#distance] = 200 -- 각 아이콘 사이의 거리...

              -- pFilmStrip = [:]
              -- pFilmStrip[#folderList] = baFolderList( _movie.path )
              -- pFilmStrip[#curFolderNum] = 1
              -- pFilmStrip[#fileList] = []
              pFilmStrip.startNum = 1 -- 플름 스트립의 왼쪽 첫번째 리스트 번호...
              pFilmStrip.fileNum = 1 -- 현재 보여주는 파일의 이름...
              -- me.resetFileList()


              me.resetFileList()
              me.viewFolderName()
              end

              on getIconImgPath me, orderNum
              -- 현재 폴더의 아이콘 이미지를 반환...
              curFolderPath = me.getCurFolderPath()
              iconFolderPath = curFolderPath & "\icon\"

              curFileName = me.getFileName(orderNum)
              iconFilePath = iconFolderPath & curFileName

              return iconFilePath
              end

              on getIconPos me, orderNum
              -- 각 아이콘의 해당 좌표를 찾아서 반환한다...
              listNum = pIconImg.orderList.getOne(orderNum)
              newLocH = pIconImg.curPos + (listNum - 1) * pIconImg.distance
              return newLocH
              end

              on setMove me, speed
              -- 이것은 지정한 스피드의 속도로 기준이 되는 좌표를 이동하는 것이다...
              -- 그런데 전체 갯수가 1개밖에 안되면 어쩌누... 멈춰야겠지...
              if pFilmStrip.fileList.count <= 4 then exit -- 화면에 보여주는게 4개니까...

              pIconImg.curPos = pIconImg.curPos + integer(pIconImg.maxSpeed * speed)
              if pIconImg.curPos < pIconImg.leftLimit then

              pIconImg.curPos = pIconImg.curPos + pIconImg.distance

              -- 첫번째 오더에 있는 넘을 맨 뒤로 보내준다...
              firstNum = pIconImg.orderList[1]
              pIconImg.orderList.deleteAt(1)
              pIconImg.orderList.add(firstNum)

              -- 왼쪽의 기준 파일을 바꿔준다...
              pFilmStrip.fileNum = pFilmStrip.fileNum + 1
              if pFilmStrip.fileNum > pFilmStrip.fileList.count then
              -- 끝번보다 크면 1번으로...
              pFilmStrip.fileNum = 1
              end if

              else if pIconImg.curPos > pIconImg.rightLimit then

              pIconImg.curPos = pIconImg.curPos - pIconImg.distance

              -- 마지막 오더에 있는 넘을 맨 처음으로 보내준다...
              tempList = [pIconImg.orderList[pIconImg.orderList.count]]
              repeat with i = 1 to pIconImg.orderList.count - 1
              tempList.add(pIconImg.orderList
              )
              end repeat
              pIconImg.orderList = tempList

              -- 왼쪽의 기준 파일을 바꿔준다...
              pFilmStrip.fileNum = pFilmStrip.fileNum - 1
              if pFilmStrip.fileNum < 1 then
              -- 1번보다 작으면 끝번으로...
              pFilmStrip.fileNum = pFilmStrip.fileList.count
              end if
              end if
              end
              • 5. Re: Photo Gallery Porgram
                smileInVietnam Level 1
                cast member name : behavior filmStrip

                -- 이것은 필름에서 돌아가는 각각의 이미지들을 컨트롤하는 비해비어이다...

                global gFilmStripMgr
                global gImageViewerMgr

                property pIconNum
                property pMySprite
                property pSprite_back1
                property pSprite_back2
                property pMovieSprite

                on beginSprite me
                pMySprite = sprite(me.spriteNum)
                pSprite_back1 = sprite(me.spriteNum - 6)
                pSprite_back2 = sprite(me.spriteNum - 12)
                pMovieSprite = sprite(me.spriteNum - 18)

                -- 이 스프라이트 순번을 등록한다.
                gFilmStripMgr.registSpriteOrder(pIconNum)

                me.resetMyImg()
                end

                on resetMyImg me
                myFileName = gFilmStripMgr.getIconImgPath(pIconNum)
                if myFileName <> pMySprite.member.fileName then
                pMySprite.member.fileName = myFileName
                pMySprite.member.regPoint = point(pMySprite.member.width / 2, pMySprite.member.height / 2)

                if myFileName contains "avi" then
                pMovieSprite.locZ = me.spriteNum + 1
                else
                pMovieSprite.locZ = pMovieSprite.spriteNum
                end if
                end if
                end

                on mouseUp me
                gImageViewerMgr.showClickedImg(pIconNum)

                sendAllSprites(#setSpeedBarLocZ)
                end

                on prepareFrame me
                me.setMyPos()
                me.resetMyImg()
                me.setBackRect()
                end

                on setMyPos me
                -- 내 위치를 잡는다...
                pMySprite.locH = gFilmStripMgr.getIconPos(pIconNum)
                pMovieSprite.locH = pMySprite.locH
                end

                on setBackRect me
                -- 테두리의 위치를 잡아준다...
                pSprite_back1.rect = pMySprite.rect + rect(-1, -1, 1, 1) * 5
                pSprite_back2.rect = pMySprite.rect + rect(-1, -1, 1, 1) * 7
                end


                on getPropertyDescriptionList
                propertyList = [:]

                propertyList[#pIconNum] = [:]
                propertyList.pIconNum[#comment] = "icon number :"
                propertyList.pIconNum[#default] = 1
                propertyList.pIconNum[#format] = #integer

                return propertyList
                end
                • 6. Re: Photo Gallery Porgram
                  smileInVietnam Level 1
                  cast member name : behavior flow filmStrip


                  -- 이것은 필름을 흐르게 해주는 비해비어이다...

                  global gFilmStripMgr

                  property pMySprite
                  property pDirection
                  property pLocZ_down

                  on beginSprite me
                  pMySprite = sprite(me.spriteNum)
                  pLocZ_down = me.spriteNum - 20
                  end

                  on mouseDown me
                  pMySprite.locZ = pLocZ_down
                  end

                  on mouseUp me
                  me.setSpeedBarLocZ()
                  end

                  on mouseLeave me
                  me.setSpeedBarLocZ()
                  end

                  on setSpeedBarLocZ me
                  pMySprite.locZ = me.spriteNum
                  end

                  on prepareFrame me
                  if the rollover <> me.spriteNum then exit

                  case pDirection of
                  #left : -- 왼쪽으로 움직이는 것이면 오른쪽에서 멀수록 빠르게 움직임...
                  speedPower = float(pMySprite.left - the mouseH) / pMySprite.width
                  #right :
                  speedPower = float(pMySprite.right - the mouseH) / pMySprite.width
                  end case

                  gFilmStripMgr.setMove(speedPower)

                  -- put pDirection && speedPower
                  end



                  on getPropertyDescriptionList
                  propertyList = [:]

                  propertyList[#pDirection] = [:]
                  propertyList.pDirection[#comment] = "move Direction :"
                  propertyList.pDirection[#default] = #left
                  propertyList.pDirection[#format] = #symbol
                  propertyList.pDirection[#range] = [#left, #right]
                  return propertyList
                  end
                  • 7. Photo Gallery Porgram
                    smileInVietnam Level 1
                    cast member name: simFn
                    this is handler about controling Divx Video.
                    U should use below xtras.
                    -- AC3Filter.x32
                    -- simDS.x32
                    -- XvidDecoder.x32
                    -------------------------------------------------
                    on FileOpenDialog initFolder,filtStr,dlogTitle
                    ObjFileXtra4=xtra("FileXtra4").new()
                    return ObjFileXtra4.fx_FileOpenDialog (initFolder, filtStr, dlogTitle, true,false)
                    end
                    -------------------------------------------------
                    on ReadStringItem str,num,Del
                    preDel=_player.itemDelimiter
                    _player.itemDelimiter=Del
                    restr= str.item

                    _player.itemDelimiter=preDel
                    return restr
                    end
                    -------------------------------------------------
                    on ReadStringItemTo str,num,num1,Del
                    preDel=_player.itemDelimiter
                    _player.itemDelimiter=Del
                    restr= str.item[num..num1]
                    _player.itemDelimiter=preDel
                    return restr
                    end
                    -------------------------------------------------
                    on ReadStringItems str,Del
                    preDel=_player.itemDelimiter
                    _player.itemDelimiter=Del
                    restr= str.items.count
                    _player.itemDelimiter=preDel
                    return restr
                    end
                    -------------------------------------------------
                    on ReadStringItemLast stringtext,Del
                    Num=ReadStringItems(stringtext,Del)
                    return ReadStringItem(stringtext,Num,Del)
                    end
                    -------------------------------------------------
                    on FileOnlyName fName
                    str=ReadStringItemLast(fName,"\")
                    num=-1
                    if ReadStringItems(str,".")>1 then num=ReadStringItemLast(str,".").length
                    return str.char[1..str.length-num-1]
                    end
                    -------------------------------------------------
                    on FileFolder fName
                    mNum=ReadStringItems(fName,"\")
                    return ReadStringItemTo(fName,1,mNum-1,"\")&"\"
                    end
                    -------------------------------------------------
                    on FileExist Pathname
                    ObjFileXtra4=xtra("FileXtra4").new()
                    return ObjFileXtra4.fx_FileExists(Pathname)
                    end
                    -------------------------------------------------
                    on FileterText mStr
                    mLineSu=mStr.line.count
                    reStr=""
                    repeat with i=1 to mLineSu
                    mLineStr=mStr.line
                    if i=1 then
                    reStr=mLineStr
                    next repeat
                    end if

                    charNum=charToNum(mLineStr.char[1])
                    if charNum=10 then mLineStr=mLineStr.char[2..mLineStr.length]
                    reStr=reStr&return&mLineStr
                    end repeat
                    return reStr
                    end
                    • 8. Re: Photo Gallery Porgram
                      smileInVietnam Level 1
                      if I have your e-mail address then I can send file

                      but I don't have it.

                      if you use MSN messenger, I can send sample file.

                      msn Id is hanul22@dreamwiz.com.

                      don't send e-mail with this address, it is just msn id, i don't use this...
                      • 9. Re: Photo Gallery Porgram
                        jclegs
                        This looks awfully like our coursework mmm.....
                        • 10. Re: Photo Gallery Porgram
                          npo rule Level 1
                          lol which team are you?