problem with flash xml script

D

dan

does anyone know why this script doesnt work propertly
the images on the right side can not be displayed
here is the script i use

function initSettings () {
for ( var i = 1; i <= 50; i++){
removeMovieClip("thumbnails.thumbBox" + i)
}
thumbSpacing = 72
thumbsInRow = 5
bottomLimit = 268
topLimit = 40
tooltip.swapDepths(10000)
pics.info.txt.html = true
pics.info.txt.htmlText = ""
pics.info._visible = false
showTooltip ("off")
pics.btn_right._visible = pics.btn_left._visible = false
pics.btn_fullview._visible = false
pics.btnInfo._visible = false
btnScrollDown._visible = btnScrollUp._visible = false
}
function parsePortXML () {
thumbnails._x = 34
thumbnails._y = topLimit
totalProjects = portXML.firstChild.childNodes.length
for ( var i = 1; i <= totalProjects; i++){
thumbnails.attachMovie("thumbBox","thumbBox" + i,100 + i)
column = i % thumbsInRow
if (column == 0) {
column = thumbsInRow
}
row = Math.ceil(i / thumbsInRow)
thumbnails["thumbBox" + i]._x = thumbSpacing * (column - 1)
thumbnails["thumbBox" + i]._y = thumbSpacing * (row - 1)
if (thumbnails["thumbBox" + totalProjects]._y + thumbSpacing >
bottomLimit) {
btnScrollDown._visible = true
}
}
thumbnails.thumbBox1.gotoAndPlay(2)
}
function showTooltip (txt) {
if (txt == "off") {
stopDrag()
tooltip._x = -1000
} else {
tooltip.txt = " " + txt + " "
startDrag ("tooltip",true)
}
}
function changeProject (projNum) {
if (currentProj == undefined) {
pics.loading.play()
}
thumbnails["thumbBox" + currentProj].gotoAndStop("on")
currentProj = projNum
projNode = portXML.firstChild.childNodes[projNum - 1]
pics.project = projNode.attributes.name
projectInfo = projNode.attributes.info
if (projectInfo.length > 0) {
projectInfo = projectInfo.split("[").join("<")
projectInfo = projectInfo.split("]").join(">")
pics.info.txt.htmlText = projectInfo
pics.info._visible = false
pics.btnInfo._visible = true
} else {
pics.info.txt.htmlText = ""
pics.btnInfo._visible = false
}
totalPics = projNode.childNodes.length
clearInterval (picsSwitcher)
if (totalPics > 1) {
pics.btn_right._visible = pics.btn_left._visible = true
picsSwitcher = setInterval (showNextPic,5000)
} else {
pics.btn_right._visible = pics.btn_left._visible = false
}
showPic (1)
}
function showPic (picNum) {
picNode = projNode.childNodes[picNum - 1]
pics.picPlace = picNode.attributes.name
fileToLoad = sitePath + "pics/" + picNode.attributes.file + ".jpg"
loadVariables(fileToLoad,pics.loader)
currentPic = picNum
W = Number(picNode.attributes.fullW)
H = Number(picNode.attributes.fullH)
if ((W > 0) && (H > 0)) {
pics.btn_fullview._visible = true
} else {
pics.btn_fullview._visible = false
}
}
function openFullView () {
file = "fullview/" + picNode.attributes.file + ".jpg"
popupTitle = projNode.attributes.name + " : " +
picNode.attributes.name
getURL("javascript:FullView('" + file + "'," + W + "," + H + ",'" +
popupTitle + "')","")
}
function showNextPic () {
if ((pics.loader.getBytesLoaded() == pics.loader.getBytesTotal())
&& (pics.loader.getBytesLoaded() > 100)) {
nextPic = currentPic + 1
if (nextPic > totalPics) {
nextPic = 1
}
showPic (nextPic)
}
}
function resetSwitcherInterval () {
clearInterval (picsSwitcher)
picsSwitcher = setInterval (showNextPic,5000)
}
function doScroll (direction) {
if (direction == "up") {
var yGap = 2
}
else if (direction == "down") {
var yGap = -2
}
clearInterval (scrollInterval)
scrollInterval = setInterval (function () {
thumbnails._y = thumbnails._y + yGap
btnScrollUp._visible = btnScrollDown._visible = true
if (thumbnails._y > topLimit) {
btnScrollUp._visible = false
clearInterval (scrollInterval)
}
if (thumbnails._y + thumbnails["thumbBox" +
totalProjects]._y + thumbSpacing < bottomLimit) {
btnScrollDown._visible = false
clearInterval (scrollInterval)
}
},20)
}
stop()
if (getProperty("",_url).substr(0,4) == "file") {
sitePath = ""
} else {
sitePath = ""
}
portXML = new XML ();
portXML.ignoreWhite = true
portXML.onLoad = function () {
initSettings ()
parsePortXML ()
}
portXML.load(sitePath + "portfolio_interior.xml")
btnScrollDown.onRollOver = function () {
doScroll ("down")
}
btnScrollUp.onRollOver = function () {
doScroll ("up")
}
btnScrollDown.onRollOut = btnScrollUp.onRollOut =
btnScrollDown.onDragOut = btnScrollUp.onDragOut = function () {
clearInterval (scrollInterval)
}
 
P

paron

Just scanning it, I don't see an onLoad function. How do you make sure
your XML is loaded before the attachMovie gets called?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,246
Members
46,841
Latest member
WilmerBelg

Latest Threads

Top