homepage Welcome to WebmasterWorld Guest from 54.166.108.167
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / XML Development
Forum Library, Charter, Moderators: httpwebwitch

XML Development Forum

    
Loading XML in FLash with URL's
tomtukin




msg:3910899
 10:13 am on May 11, 2009 (gmt 0)

Hello all.

I am a step away from finishing the website, but that last step I just cannot figure out.
I have Flash file to which XML file is loaded. This displays text and it works perfectly.
Problem is that in some of the words form XML i would like to inser links to URL's which should be open in a new window. I can't figure this out.
Could you please heltp me. Bellow you can see both AS and XML.

XML:

XML:
<loadtext><headLine>FLASHSCROLLBARMAID</headLine><br><mainBody>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy
</mainBody></loadtext>

Action Script:

//SCROLLER
_root.scrollbar_mc.scroller_mc.onPress = function()
{
startDrag(_root.scrollbar_mc.scroller_mc,false,0,0,0,_root.scrollbar_mc._height-_root.scrollbar_mc.scrol ler_mc._height);
_root.scrollbar_mc.onEnterFrame = function()
{
con = Math.ceil(100 * ((_root.scrollbar_mc.scroller_mc._y)/(_root.scrollbar_mc._height-_root.scrollbar_mc.scroller_mc._height)));
_root.tTe xt.scroll = (con/100) * _root.tText.maxscroll;
}
}
_root.scrollbar_mc.scroller_mc.onRelease = function()
{
stopDrag();
}
_root.scrollbar_mc.scroller_mc.onReleaseOutside = function()
{
stopDrag();
}

//TEXT LOAD
tText.html = true;
tText.wordWrap = true;
tText.multiline = true;
tText._alpha = 100;
tText.border = false;
tText.backgroundColor = 0xDCDBD9;
// makes it scrollable

loadtextStyleCast = new TextField.StyleSheet();
// create a new instance of a Class StyleSheet

loadtextStyleCast.load(„flashscrollbarmaid.css”);
// loads your CSS document with defined tags

tText.styleSheet = loadtextStyleCast;
// applies your new XML styles to myText

//myText.setStyle(„backgroundColor”,„fxfffff”);
// sets the background color
// (Text color is set in the CSS.)

loadtextContentCast = new XML();
// create a new instance of an XML Class

loadtextContentCast.ignoreWhite = true;
loadtextContentCast.load(„flashscrollbarmaid.xml”);
// identifies the file to be loaded

loadtextContentCast.onLoad = function(success)
{
if(success)
{
tText.text = loadtextContentCast;
// loads the file into the TextArea
}
}

-------

Thnax in advance

 

httpwebwitch




msg:3911561
 4:11 am on May 12, 2009 (gmt 0)

Hi tomtukin, Welcome to WebmasterWorld!
I haven't used Flash in a while, but I recall that if you put HTML into a text area, it'll render the HTML with working clickable links. I may be wrong ;)

anyways, I'd suggest you format your XML with the HTML wrapped as a CDATA node, so it's treated as a string, not a nodeset. For example:

<loadtext><headLine>FLASHSCROLLBARMAID</headLine><br><mainBody>
<![CDATA[Lorem <a href='ipsum.html'>ipsum</a> dolor sit amet]]>
</mainBody></loadtext>

See if that works... cheers

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / XML Development
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved