Skip to main content
Participating Frequently
November 26, 2007
Question

Strange <a> behavior in XML file

  • November 26, 2007
  • 8 replies
  • 768 views
I want to make a dynamic text that: [LIST=1]
  • is scrollable
  • it has an ability to increase or decrease font size
  • contains images wrapped in <a> tags
  • the content is loaded from an external XML file (I know that right now using XML seems like going on the hard way, but later I will need it, so please don't suggest omitting the XML way.)
  • in needs to be Action Script 2, and the site must work on Internet Explorer 6 (this is the dire need of my clients, sorry)I managed to get this working: http://www.ctdd.ro/izorep/
    The problem is - as you can see - with the image in the upper right corner of the dynamic text. Try for yourself since it's rather hard to describe. I can click on it and nothing happens. (Right click gives open in a new window and open, but left click fails to work.)

    This is the script it does the loading part, alma is the current size set by the magnifying glasses at bottom of the page.

    The function meretez does the resizing part, that seems to work.

    The home.xml can be found here: http://www.ctdd.ro/izorep/home.xml

    I hope someone could help me.

    P.S.: The myHome_txt is a dynamic text with embedded Minon Pro, and it's inside a myHome movie clip. And now the code:
  • This topic has been closed for replies.

    8 replies

    Inspiring
    November 27, 2007
    I don't know the why part... others may be able to answer.
    I would be curious to know as well. For me it works in the IDE. I didn't try it in a web page...
    Inspiring
    November 27, 2007
    Hmmm. I still don't understand either.

    The only other option I can think of trying, I didn't try it... is asfunction protocol

    <a href="asfunction:getURL,Kep/CSIzorep.jpg">

    Participating Frequently
    November 27, 2007
    Thanks a lot for the help. It was an interesting idea, unfortunately it seems that an image based <a> fails to work for me in this particular case. Since I can use swfs including a button and actionscript I managed to solves the problem, but the question remains why does not work in the logical way?
    Inspiring
    November 27, 2007
    Its confusing. I tried your same xml content in the flash IDE... but I substituted absolute urls for the images (just did a google search for a random image) and it worked. So trying absolute urls (again, I know you already tried it) is the only thing I can suggest at this at this point... I'm out of ideas.

    You don't have an invisible button or anything on the site (with useHandCursor set to false) or anything like that do you?
    Participating Frequently
    November 27, 2007
    Okay I gave it another try. Absolute path images from google. Unfortunatelly I got the same effect as with absolut path from my site.
    Inspiring
    November 26, 2007
    What happens if you take away this line from your meretez() function:

    myHome.myHome_txt.setTextFormat(myFormat);
    Participating Frequently
    November 27, 2007
    Thanks again. I have //-ed the line you mentioned, but it did not solved my problem. It's effect was that the text size does not increase, but the picture remains in the same state.
    Inspiring
    November 26, 2007
    CDATA is the way you are going to solve this, so don't discard that.

    The next step is how you get the node, I can't remember all the details, but when you use CDATA there is a different option for accessing the content of the node to get it to render properly. Show the part where you get that information and maybe that will help jog my memory.
    Participating Frequently
    November 26, 2007
    Maybe I should include the function too. It's called every time the + or - buttons are clicked or when an XML is loaded successfully.
    Inspiring
    November 26, 2007
    for the CDATA , try this

    myHome.myHome_txt.htmlText = loadtextContent.firstChild.firstChild.nodeValue;
    Participating Frequently
    November 26, 2007
    GWD, thanks a lot I changed this and put CDATA. Now it works with CDATA, but the problem is that it still fails to work as a link. I have updated the files on the web.
    XML
    Test site

    For Rothrock:
    Known Participant
    November 26, 2007
    Change your xml to the following

    Change the href to the full path of the jpg not the relative path. I've found that this can be an issue on occassion...
    you may also want to add a security allow domain statement to your action script. Search for "allow domain" in the AS help file.
    Participating Frequently
    November 26, 2007
    Thanks a lot nstanz, unfortunately that did not solved the problem. I have tried with full patch, but achieved the same effect, and <param name="allowscriptaccess" value="samedomain"> was already included.

    Edit: Due to a messager suggestion I have removed <param name="wmode" value="transparent">, but it was not helpful.
    Inspiring
    November 26, 2007
    I'm not sure exactly what the problem is. But the best way to load html content from within xml, especially if your xml will contain data as well as content, is to contain the html in a CDATA node. Do a quick search of this forum for CDATA and see if what you find makes sense.
    Participating Frequently
    November 26, 2007
    Thanks a lot for the help. I put the contents of the <text> element in a CDATA node, but as I expected it made the html tags not rendered, so instead of the image I saw the html tags. That is definitely worse then what I wanted. I'm really clueless.
    P.S.: Here is the modified XML. I did not uploaded to the web, but attached here: