Results 1 to 3 of 3

Thread: need help with xml gallery

  1. #1
    Join Date
    Nov 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default need help with xml gallery

    Iīm using a xml gallery with thumbs . I tried several things but canīt get it work. I want to add links in the textfield. The text in the textfield comes from a .txt file and xml file. I dont know if itīs possible to add links in .txt files or if there is any other way to open urls with links for the different images.

    I hope someone can help me with this..

    file included...
    http://www.robertr.se/flash/portfoliopage.zip
    207 kb

    Very best regards
    /Robert

  2. #2
    Join Date
    Jul 2008
    Posts
    9
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    I have wondered the same thing. When I try to code the url link inside the xml, flash just ignores the text, or displays the a href as if it were regular text.

    I am working in actionscript 2 here, but have you checked to see if the dynamic text fields are rendering in html, and that the actionscript is defining them as .htmlText instead of .text?

    Heres a snippet from mine:

    picture._alpha = 0;
    picture.loadMovie(image[p], 1);
    client_txt.htmlText = client[p];
    ttl_txt.htmlText = ttl[p];
    desc_txt.htmlText = description[p];
    picture_num();

    client_txt, for example, is an instance name for a dynamic text field on the stage. See if on your file the instance name is client_txt.htmlText, not client_txt.text. Changing that may help, but I'm not sure. I am pretty new to actionscript myself. It would be really nice to have this option!

    Good luck!
    Last edited by parodeis; 09-27-2008 at 11:03 PM. Reason: spelling

  3. #3
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    It's actually quite simple to add a link through XML. For testing purposes, I'll describe a simple UI. Open up Flash and add a simple dynamic text field to the stage. Let's give it an instance name of textfield.

    Next, open up the Actions panel, and add the following AS:

    Code:
    var xml:XML = new XML();
    xml.ignoreWhite = true;
    xml.onLoad = function() {
    	textfield.html = true;
    	textfield.htmlText = this.firstChild.childNodes[0].childNodes[0];
    }
    xml.load("test.xml");
    This should be familiar to you if you're already using XML. Note that I'm turning on the html property of the text field.

    Next, create a XML document saved as test.xml with the following contents:
    Code:
    <xml>
    	<link><a href="http://www.google.com">Google</a></link>
    </xml>
    Finally, go back to Flash and test. You should have a working link.

    Note: If you're using XML and flat text files, you're probably over-complicating your workflow.

Bookmarks

Posting Permissions

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