XML Flash question

  • Started
  • Last post
  • 5 Responses
  • Iamhype

    Hi,
    I really new to using xml and am currently putting together a xml image slideshow type thing in flash. I've managed to grab a basic tutorial which has helped but its missing some vital info. Thats where I was hoping someone could help.
    My first question is -
    • At the moment the image just jump straight on, what I would like is a nice fade from 0%-100% opacity
    • I would like to add an hyperlink to the copy that comes in via the xml
    • Also a simple loading bar (I understand that I will have to create this in flash, but was just after some code for it?)
    If anyone can help that will be great, I will post my xml script and my actionscript below -
    XML -
    <Slides>
    <slideNode jpegURL="images/wood01.png">Wood clothing store website - Homepage</slideNode>
    <slideNode jpegURL="images/wood02.png">Wood clothing store website - Product Page</slideNode>
    ACTIONSCRIPT-
    slides_xml = new XML();
    slides_xml.onLoad = startSlideShow;
    slides_xml.load("slides03.xml");
    slides_xml.ignoreWhite = true;
    //
    // Show the first slide and intialize variables
    function startSlideShow(success) {
    if (success == true) {
    rootNode = slides_xml.firstChild;
    totalSlides = rootNode.childNodes.length;
    firstSlideNode = rootNode.firstChild;
    currentSlideNode = firstSlideNode;
    currentIndex = 1;
    updateSlide(firstSlideNode);

    }
    }
    //
    // Updates the current slide with new image and text
    function updateSlide(newSlideNode) {
    imagePath = newSlideNode.attributes.jpegURL;
    slideText = newSlideNode.firstChild.nodeValu...
    loadMovie(imagePath, targetClip);
    }
    //
    // Event handler for 'Next slide' button
    next_btn.onRelease = function() {
    nextSlideNode = currentSlideNode.nextSibling;
    if (nextSlideNode == null) {
    break;
    } else {
    currentIndex++;
    updateSlide(nextSlideNode);
    currentSlideNode = nextSlideNode;
    }
    };
    //
    // Event handler for 'Previous slide' button
    back_btn.onRelease = function() {
    previousSlideNode = currentSlideNode.previousSibling...
    if (previousSlideNode == null) {
    break;
    } else {
    currentIndex--;
    currentSlideNode = previousSlideNode;
    updateSlide(previousSlideNode);
    }
    };

  • Iamhype0

    Sorry for the really long post, and thanks in advance if anyone can help

  • skt0

    hang on, i'll get right on that for you.

  • fyoucher10

    Paste code here instead...

    http://pastie.org/

  • Bricktop0

    you missed a { in the line 46

  • fyoucher10

    AS2...

    Redo the XML using this guys class >
    http://blog.greensock.com/xmlpar…

    It'll be a ton easier to do everything you want to do. It's well-documented too.

    For the tweening portion, you could use one of his tweening classes or one of the many others out there like mc_tween or Tweener, or these from the same guy >
    http://blog.greensock.com/catego…

    All well-documented stuff...
    That'll solve your preloader, XML, and fade probs...

    For the hyperlink, make the dynamic text 'htmlText' or set the TextField's html property to true (myTextField.html = true)
    Then in your XML, use CDATA and use a regular anchor like how you do in HTML <a href = "url.com"> textlink </a>
    To go farther, you could style the text with CSS in Flash but you might not need to go that far...

    • One more thing, to target the html text field, you'll need to use the htmlText property instead of the text property.
      myText.htmlText instead of myText.text
      fyoucher1
    • myText.htmlText instead of myText.textfyoucher1