From: npo rule on
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

From: Dave C on
Check this out. Source code is available

http://www.lingoworkshop.com/examples/Image_Gallery.php
From: smileInVietnam on
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


From: smileInVietnam on
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

From: smileInVietnam on
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[i]
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[i])
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

 |  Next  |  Last
Pages: 1 2 3
Prev: bugs in director 11
Next: Pre dir11 memory issue