| Ultrashock Forums
• HTML Links in xml. |
|||
![]() |
||||
| Search this Thread | Thread Tools | Display Modes |
|
|
|||||||||||||||||||||||||
![]() |
Ultrashock Member Comments:
17 Creative Assets
|
2007-12-14
#2 |
||
|
|
2007-12-14
#3 |
||
|
Last edited by cooper10 : 2008-05-09 at 12:36.
Nutrox, Thanks for your reply - I've tried what you recommended but I still get the same results. The link just appears as text |
|
17 Creative Assets
|
2007-12-14
#4 |
||
|
Are you using the proper syntax for the links, i.e. < " > or are you using < and > etc? It should be the former.
|
|
|
2007-12-14
#5 |
||
|
Nutrox, I've tried both ways but I still get the same results. PHP Code:
PHP Code:
|
|
17 Creative Assets
|
2007-12-14
#6 |
||
|
D'oh! I have just spotted what you are doing wrong. Ok, use the syntax in the second block of XML you have just posted there^ and also replace this line of ActionScript code...ActionScript Code:
ActionScript Code:
|
|
|
2007-12-14
#7 |
||
|
Sorry inbetween posts, I spotted that and changed it but it's still not working ActionScript Code:
|
|
17 Creative Assets
|
2007-12-14
#8 |
||
|
Uncomment this line... ActionScript Code:
|
|
|
2007-12-14
#9 |
||
|
Last edited by cooper10 : 2008-05-09 at 12:36.
Still no luck sorry. Just to make sure I'm not confusing you I wanted say a word in the text field to be a link to another page as in normal html. So in the image 'newbook.com' would be the link - that is possible is'nt it ? If anyone could see where I'm going wrong I've attached the fla. Any help would be greatly appericated. |
|
17 Creative Assets
|
2007-12-14
#10 |
||
|
Run the following code in a new movie... ActionScript Code:
You will see that the link works fine. If you are setting the TextField's html property to true, and you are using the TextField's htmlText property to set the HTML text, then the problem must be the XML data or the way you are parsing it. Can you post a link to the actual XML file you are loading into Flash? |
|
|
2007-12-14
#11 |
||
|
This is the xml I'm loading into Flash - it's just dummy text at the moment but the structure is correct. PHP Code:
ActionScript Code:
Again thanks for all the help. |
|
|
2007-12-14
#12 |
||
|
wow that was killing me but got it working but without the CDATA tags, just using PHP Code:
|
|
17 Creative Assets
|
2007-12-14
#13 |
||
|
CSS. ![]() ActionScript 2.0 Code:
You could also load an external CSS file if you wanted to instead of defining it in the code. |
|
|
2007-12-14
#14 |
||
|
Last edited by cooper10 : 2008-05-09 at 12:36.
I think I might have spoken a little too soon. The link seem to work in the display but it puts in a comma before the link as shown in the image, the word with the link is "here". here is the xml PHP Code:
|
|
|
2007-12-17
#15 |
||
|
Check the replies in my thread here: XML and CDATA not formatting as HTML text I got mine working by redefining the parsing code for the XML - I had excactly the same problems as you did. |
|
|
2008-11-18
#16 |
||
|
hmmm.. nutrox I can get your css proporties to work well in a runtime created textfield feeded tru xml like above. But if I ty to set font-family it dosn't change a thing.. any idea?
|
|
4 Creative Assets
|
2008-11-19
#17 |
||
|
if you wanna set a font-family in your css you´ll have to embed the font into your library and then choose the font manually for the textfield, your embeded font will have an * infront of the name of the font. As below: MeTooPixie *MyFont Myriad Pro |
|
|
2008-11-20
#18 |
||
|
Thanks.. I found that you can ad the font to library and then you can call it from css. But I belive thats also what your saying.. Thankss
|
|
4 Creative Assets
|
2008-11-20
#19 |
||
|
no problem |
|
17 Creative Assets
|
2008-11-20
#20 |
||
|
If you just want to use device fonts make sure the TextField isn't embedding fonts (default value is false anyway), the CSS font-family rule should work the same as it does in regular CSS then. Code:
import TextField.StyleSheet;
var css:String = "span { font-size:13px; }"
+ ".arial { font-family:arial,sans-serif; }"
+ ".verdana { font-family:verdana,sans-serif; }";
var style:StyleSheet = new StyleSheet();
style.parseCSS( css );
var textField:TextField = createTextField( "textField", 0, 0, 0, 200, 200 );
textField.multiline = true;
textField.html = true;
textField.styleSheet = style;
textField.htmlText = "<span class=\"arial\">Arial @ 13px</span>\n"
+ "<span class=\"verdana\">Verdana @ 13px</span>";
|
|
|
2009-07-24
#21 |
||
|
Hello everyone, I am having a similar issue putting html in my text box. I am using a carousel style template http://www.chivrak.com I think part of the issue is how the structure in the xml is written and the other is something I must be missing in the AS. Please help. I will give you a bunch of links on my main site (once it is completed) to show my appreciation. XML: DOES WORK: <content> <sitio imagen="icon4.png" titleA="music" contentA= "This boring font unlinked text works fine."/> </Content> DOES NOT WORK: <content> <sitio imagen="icon4.png" titleA="music" contentA= "I would really like to put a link here and I have tried <link><![CDATA[<a href="www.vinyljockeys.com">VJ</a>]]></link>"/> </Content> ALSO DOES NOT WORK: <content> <sitio imagen="icon4.png" titleA="music" contentA= "I would really like to put a link here and I have tried link=![CDATA[<a href="www.vinyljockeys.com">VJ</a>]] I am totally <b>confused.</b> Please help." /> </Content> AS: var xml:XML = new XML(); xml.load("content.xml"); xml.ignoreWhite = true; xml.onLoad = function() { var nodes = this.firstChild.childNodes; numOfItems = nodes.length; for (var i = 0; i<numOfItems; i++) { var t = home.attachMovie("item", "item"+i, i+1); t.angle = i*((Math.PI*2)/numOfItems); t.onEnterFrame = mover; t.toolText = nodes[i].attributes.titleA; t.contenido = nodes[i].attributes.contentA; t.content = nodes[i].attributes.content; t.icon.inner.loadMovie(nodes[i].attributes.imagen); t.icon2.inner.loadMovie(nodes[i].attributes.imagen); t.r.inner.loadMovie(nodes[i].attributes.imagen); t.icon.onRollOver = over; t.icon.onRollOut = out; t.icon.onRelease = released; |
|
|
2009-07-29
#22 |
||
|
Go to http://blog.vamapaull.com/?page_id=12 and you will get a great solution, just download and compare the .XML and .Fla to your carousel make the AS and XMl changes and voi la, you get CDATA in your text boxes. Even tho my site is carousel based I cannot make it work for me unless I change the action of my icons. My icons fall thru the floor instead of going to the side, as they do in carousel, unfortunately I do not know flash well enough to make it work for me with out a direct expample So I am still lookiing for a solution...
|
|
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|


21 comments
| 3546 views


17 Creative Assets
I have just spotted what you are doing wrong. Ok, use the syntax in the second block of XML you have just posted there^ and also replace this line of ActionScript code...

So I am still lookiing for a solution...
Linear Mode
It would be worthwhile enclosing the text for every <news> node in CDATA (as shown) because you will know exactly how to handle/parse each node then. Hope that helps.