dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: xml won't work in a nested MC

Threaded View

  1. #1
    Junior Member
    Join Date
    Aug 2005
    Posts
    6

    xml won't work in a nested MC

    hi! I am getting pretty desperate over an issue I have with both XML and the regular "loadMovie" methods of importing data into flash.
    I have a main movie and in its main timeline I have another MC from where I do a loadMovie of a navigation menu movie. In the menu movie I used a piece of xml code I found online:
    PHP Code:
    function loadXML(loaded) { 
    if (
    loaded) { 
    xmlNode this.firstChild
    image = []; 
    description = []; 
    total xmlNode.childNodes.length
    for (
    i=0i<totali++) { 
    image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue
    description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue

    firstImage(); 
    } else { 
    content "file not loaded!"


    xmlData = new XML(); 
    xmlData.ignoreWhite true
    xmlData.onLoad loadXML
    xmlData.load("images.xml"); 
    ///////////////////////////////////// 
    listen = new Object(); 
    listen.onKeyDown = function() { 
    if (
    Key.getCode() == Key.LEFT) { 
    prevImage(); 
    } else if (
    Key.getCode() == Key.RIGHT) { 
    nextImage(); 

    }; 
    Key.addListener(listen); 
    previous_btn.onRelease = function() { 
    prevImage(); 
    }; 
    next_btn.onRelease = function() { 
    nextImage(); 
    }; 
    ///////////////////////////////////// 
    0
    this.onEnterFrame = function() { 
    filesize picture.getBytesTotal(); 
    loaded picture.getBytesLoaded(); 
    preloader._visible true
    if (
    loaded != filesize) { 
    preloader.preload_bar._xscale 100*loaded/filesize
    } else { 
    preloader._visible false
    if (
    picture._alpha<100) { 
    picture._alpha += 10


    }; 
    function 
    nextImage() { 
    if (
    p<(total-1)) { 
    p++; 
    if (
    loaded == filesize) { 
    picture._alpha 0
    picture.loadMovie(image[p], 1); 
    desc_txt.text description[p]; 
    picture_num(); 



    function 
    prevImage() { 
    if (
    p>0) { 
    p--; 
    picture._alpha 0
    picture.loadMovie(image[p], 1); 
    desc_txt.text description[p]; 
    picture_num(); 


    function 
    firstImage() { 
    if (
    loaded == filesize) { 
    picture._alpha 0
    picture.loadMovie(image[0], 1); 
    desc_txt.text description[0]; 
    picture_num(); 


    function 
    picture_num() { 
    current_pos p+1
    pos_txt.text current_pos+" / "+total

    The issue I have is that when I test the menu movie on its own, everything works but if I test it in the main movie as it should be, the data import doesn't work. This happens with both XML and simple loadMovie methods. What am I missing? Do I really have to keep everything within the main movie or is there something wrong with my targets/urls?
    Please help! Thanks in advance!
    Last edited by tupps; 10-01-2005 at 04:27 AM. Reason: Updated so code is displayed correctly

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center