Visualizzazione dei risultati da 1 a 2 su 2
  1. #1
    Utente di HTML.it L'avatar di morfo
    Registrato dal
    Oct 2005
    Messaggi
    85

    news in xml/flash ogni ora

    Ciao a tutti,
    devo realizzare un lettore di news esterne (xml) in AS che scorra le notizie ciclicamente con la sequenza dei nodi ogni ora.
    Questo AS che riporto va bene in parte in quanto mi legge del testo da un file xml in sequenza di nodi cliccando sul pulsante next o back. Per risolvere il problema devo far scorrere le notizie ciclicamente senza i pulsanti ogni ora (solamente next) e inoltre devo rendere l'azione dell'AS ciclica, eliminando il comando "breack" che mi blocca tutto sull'ultimo nodo.
    Potreste darmi una mano a modificare il codice? GRAZIE!!


    images_xml = new XML();
    images_xml.onLoad = startImageViewer;
    images_xml.load("text.xml");
    images_xml.ignoreWhite = true;
    //
    // Show the first image and intialize variables
    function startImageViewer(success) {
    if (success == true) {
    rootNode = images_xml.firstChild;
    // 'totalImages' is the variable name set to correspond with the the dynamic text instance of 'totalImages'
    totalImages = rootNode.childNodes.length;
    // [ totalImages = rootNode.childNodes.length; ] gets the total number of childNodes (total number of image and text files) in your .xml document
    firstImageNode = rootNode.firstChild;
    currentImageNode = firstImageNode;
    // 'currentIndex' is the variable name set to correspond with the dynamic text instance of 'currentIndex'
    currentIndex = 1;
    // [ currentIndex = 1; ] sets the viewer to play the first childNode (first image and text file) in your .xml document
    updateImage(firstImageNode);
    }
    }
    //
    // Updates the current image with new image and text
    function updateImage(newImageNode) {
    // 'imagePath' is the variable name set to correspond with the .jpeg file name located in your .xml document
    imagePath = newImageNode.attributes.jpegURL;
    // 'imageText' is the variable name for the instance 'textArea'
    imageText = newImageNode.firstChild.nodeValue;
    // 'targetClip' is the instance name for the movie clip 'imageArea', this is where all your image files from your .xml document are loaded
    targetClip.loadMovie(imagePath);
    // IMPORTANT : RESCALING THE SIZE OF THE 'imageArea' MOVIE CLIP WILL AFFECT THE ORIGNAL SIZE OF WHATEVER IMAGE YOU HAVE IN YOUR IMAGES FOLDER
    }

    next_btn.onRelease = function() {
    nextImageNode = currentImageNode.nextSibling;
    if (nextImageNode == null) {
    break;
    } else {
    currentIndex++;
    updateImage(nextImageNode);
    currentImageNode = nextImageNode;
    }
    };
    //
    // Event handler for 'Previous image' button
    back_btn.onRelease = function() {
    previousImageNode = currentImageNode.previousSibling;
    if (previousImageNode == null) {
    break;
    } else {
    currentIndex--;
    currentImageNode = previousImageNode;
    updateImage(previousImageNode);
    }
    };

  2. #2
    il crossposting è vietato dal regolamento: continua pure la discussione in ActionScript, forum maggiormente consono rispetto alla tua domanda.

    ciao

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.