Welcome, Guest
  • Author Topic: Question about the tutorial "Loading data into Flash" By: Jorge Solis  (Read 969 times)

    rculshaw

    • Server what's that
    • *
    • Posts: 2
      • View Profile
    Question about the tutorial "Loading data into Flash" By: Jorge Solis


    Hi

    I’ve just followed the tutorial "Loading data into Flash" by Jorge Solis.

    I have just done the loading data by xml and it is working perfectly for what I want.

    Is it possible to add hyperlinks? Either add them onto the images or as separate holders or something?

    My work would be finished if I could load text, images and hyperlinks into a flash document.

    Cheers

    Rick


    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Flash itself does not care what kind of data you are loading.
    there are not limitations.
    You just need to know about the structure.

    After you are using XML for the transport, you should not use <a hrfe=... syntax
    But you can use a <link><url>url of the ling</url><label>Label you want to show</label></link>
    or <link url="url to the link" label="label for the link" />
    whatever suites you better.
    happy flashing
    8)
    Ronald

    rculshaw

    • Server what's that
    • *
    • Posts: 2
      • View Profile
    cheers for that.

    could you give me some direction if i wanted to add links to images?

    Here is the ActionScript


    -----------


    //Create the XML Object
    myXML = new XML()
    myXML.ignoreWhite = true
    //Load XML file
    myXML.load("anastasio.xml")
    //Make a reference to current timeline
    myXML.ref = this
    // Parse XML and fetch
    myXML.onLoad = function(succes){
    if(succes){
    var root = this.firstChild
    nodes = root.childNodes
    for(var i=0; i<nodes.length; i++) {
    this.ref["Title_txt"+i].text = nodes.attributes.name
    subnodes = nodes.childNodes
    this.ref["Comments_txt"+i].text = subnodes[0].firstChild.toString()
    this.ref["holder_mc"+i].loadMovie(subnodes[1].firstChild.toString())


    }
    } else trace("Error loading XML document")
    }
    stop()




    ---------


    and the xml


    ----------




    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE data[
    <!ELEMENT title (comments, image)>
    <!ATTLIST title name CDATA #REQUIRED>
    <!ELEMENT comments (#PCDATA)>
    <!ELEMENT image (#PCDATA)>
    ]>
    <data>

    <title name="Whats New">
    <comments>the summer is here and so are our lightest summer dresses...
    </comments>
    </title>
    <title name="">
    <comments>Photo Shoot movie
    </comments>
    <image>an1.jpg</image>
    </title>
    <title name="">
    <comments>Jersey bling dress, brown
    </comments>
    <image>an2.jpg </image>
    </title>
    <title name="">
    <comments>Bubble dress, smudge rose and hot flowerk
    </comments>
    <image>an3.jpg</image>
    </title>
    <title name="Our lookbook">
    <comments>View this seaons look book
    </comments>
    <image>an4.jpg</image>
    </title>
    <title name="">
    <comments>Send us your photos
    </comments>
    <image>an5.jpg</image>
    </title>
    <title name="">
    <comments>Ying yang dress, hot pink
    </comments>
    <image>an6.jpg</image>
    </title>
    <title name="">
    <comments>New yorker playsuit, shell pink
    </comments>
    <image>an7.jpg</image>
    </title>
    <title name="Bridesmaid lookbook">
    <comments>Bridesmaid collection
    </comments>
    <image>an8.jpg</image>
    </title>


    </data>

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    You need to:

    - Add a preloader to the image, the loading begins here:

    this.ref["holder_mc"+i].loadMovie(....

    - Once loaded, add the onPress action to fire the getURL

    Jorge