problem with flash xml script

Discussion in 'XML' started by dan, Apr 18, 2005.

  1. dan

    dan Guest

    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)
    }
     
    dan, Apr 18, 2005
    #1
    1. Advertising

  2. dan

    paron Guest

    Re: problem with flash xml script

    Just scanning it, I don't see an onLoad function. How do you make sure
    your XML is loaded before the attachMovie gets called?
     
    paron, Apr 19, 2005
    #2
    1. Advertising

  3. dan

    paron Guest

    Re: problem with flash xml script

    Oops, just found it. Please disregard previous numbskull post.
     
    paron, Apr 19, 2005
    #3
  4. dan

    dan malka Guest

    Re: problem with flash xml script

    paron, what is the solution then you said you solve it

    *** Sent via Developersdex http://www.developersdex.com ***
     
    dan malka, Apr 20, 2005
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bernie
    Replies:
    0
    Views:
    646
    Bernie
    Sep 5, 2004
  2. Jim Higson
    Replies:
    1
    Views:
    548
    Jim Higson
    Sep 21, 2004
  3. Replies:
    8
    Views:
    23,624
    SABOND21
    Feb 9, 2012
  4. bparsons

    XML and Flash problem

    bparsons, May 10, 2005, in forum: XML
    Replies:
    0
    Views:
    364
    bparsons
    May 10, 2005
  5. Ymtrader
    Replies:
    1
    Views:
    615
    Adam Tauno Williams
    Mar 15, 2011
Loading...

Share This Page