Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Why Am I Getting An Extra Line Break On My P Tags?



I've got a text field into which I'm displaying html formatted text held between CDATA tags in an XML file.

If I arrange the text in the XML file like this:


Code:
<p>My first paragraph</p><p>My second paragraph</p>
Then the text renders in Flash like this:

My first paragraph
My second paragraph

But I want an extra line break in between the two paragraphs, as you'd expect to see in a normal HTML page in a browser. Also, I don't want to have to have the data in the XML doc all bunched up with no returns, as this makes it a nightmare to edit. My problem is that if I arrange the XML data like this:


Code:
<p>My first paragraph</p>
<p>My second paragraph</p>
Then the text renders in Flash like this:

My first paragraph


My second paragraph


With three line breaks!

Can anyone explain why this happens, or what I can do to get it how I want?

My textField is using Trebuchet MS as the font, unembedded, with html rendering, multiline and word wrap turned on. I have tried various different configurations and fonts with no real change in results.



ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 05-26-2007, 12:51 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

HtmlText + <img> Tag + Extra Line Break
I'm trying to show an image movieclip in the same line as that of the text in a TextArea Component but it seems that you cannot use <img> tag without preceding <p> tag. I tried numerous workarounds for that but couldn't help.

plz help guys.....

Note : "htmltext_problem_" is the name of my mxml.


Code:

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" backgroundGradientColors="[#FFFFFF, #FFFFFF]" width="300" height="300">
<mx:Script>
<![CDATA[

[Embed(source="../assets/smCofee.swf" , symbol='cofee1')]
public var cofee1:Class;

public function loadText():void
{
var path:String = "htmltext_problem_" + "cofee1";
var str:String = "<p><img width='14' height='14' hspace='10' vspace='10' src='" + path + "'/></p>";
var html:String = txt.htmlText;
//following line replaces (A) with str
txt.htmlText = html.split("(A)").join(str);
}
]]>
</mx:Script>

<mx:TextArea id="txt" width="268" height="223" htmlText="Hi. whats (A) up? Am well "
creationComplete="loadText()" />

</mx:Application>

HtmlText + <img> Tag + Extra Line Break
I'm trying to show an image movieclip in the same line as that of the text in a TextArea Component but it seems that you cannot use <img> tag without preceding <p> tag. I tried numerous workarounds for that but couldn't help.

plz help guys.....

Note : "htmltext_problem_" is the name of my mxml.


Code:

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" backgroundGradientColors="[#FFFFFF, #FFFFFF]" width="300" height="300">
<mx:Script>
<![CDATA[

[Embed(source="../assets/smCofee.swf" , symbol='cofee1')]
public var cofee1:Class;

public function loadText():void
{
var path:String = "htmltext_problem_" + "cofee1";
var str:String = "<p><img width='14' height='14' hspace='10' vspace='10' src='" + path + "'/></p>";
var html:String = txt.htmlText;
//following line replaces (A) with str
txt.htmlText = html.split("(A)").join(str);
}
]]>
</mx:Script>

<mx:TextArea id="txt" width="268" height="223" htmlText="Hi. whats (A) up? Am well "
creationComplete="loadText()" />

</mx:Application>

How Would I Make These Extra Cool Tags?
I was just on the rapper E-40s website, and noticed on the bottom a really cool navigation menu shaped like dog tags. when you roll over them, they follow the mouse, then when you move the mouse, they jiggle back and forth until they stop. here is the website: http://www.e-40.com/ . Can someone tell me how to do this? I know it would be hard, but think this will add a little flava to my site. Thanks :D

Multi-line Text Field Auto Line Break
When a Dynamic Multiple line text field is used in Flash CS3, it has a very annoying feature that auto inserts a line break at the end of inserted text. It also auto inserts a line break if no text is entered too.

I'm having a problem with this because the text is being saved from flash to a text file on the desktop. With every multi-line text field there's a nasty looking line break.

Any way of "turning off" this auto-line-break-at-the-end feature?

XML Break Tags
hey guys,
how do you add a break tag to the xml so that when it is loaded into flash it will display it properly?
i used [br] tags, and it worked fine, but then when i made a new entry into the XML the entry after, would not display. Because the XML is thinking that the [br] tags are XML tags.
is there any other way to have a line break in XML?
bLIndchILd

Line Break Or Line Feed For Dynamic Text
I am usin a textArea so now it is different than the last post about styles.
This text is dynamic and is assigned from within the Flash file it resides.
It comes from a list selection listener and I want to pre-format it with line breaks.

Since it resides in the file I will be using a textArea with HTML on to get the line breaks.
But now I can't Style it the same way with the setStyle methos

Currently I have one line is like this.

myNotes.text = "This is Line one<br>This is another Line<br>and another line";



Any help would be appreciated.

Thank you,
WBell





























Edited: 01/24/2009 at 12:49:08 AM by W_Bell

Multi-line Text Box Line Break?
I am trying to make a multiline text box do a line break. a quick example:

You run into a tree.
You found something!
It glows with a blue aura.

It is just for a simple break, if I try to do it normally, it ends up like this:

You run into a tree. You found something! It glows with a blue aura.

without a line break. Can someone please tell me what the line break command is?

String Manipulations, Replacing Newlines With Break Tags
Can someone suggest a bit of actionscript that will parse a string and replace the newline characters with <br> tags?

Thanks!
Ap

Extra Line Space
I have a flash movie, published in version 6/actionscript 1, that is producing extra line spaces after each carriage return. I saw a few examples for actionscript 2 files (where it would do something like this.body = this.body.split("\n").join("
");, and that didn't work, so I guess actionscript 1 must not recognize it. What can I do to the following code to fix the issue?


Code:
theNews = new XML();
theNews.ignoreWhite = true;
var fadeTime = 1000// in milliseconds;
var defaultHex = 0x0066CC;
theNews.load('/flash_news/xml.php'+"?cK="+random(9999)+1);
function Article( id, title, date, author, body){
this.id = id;
this.title = title;
this.date = date;
this.author = author;
this.body = body;
};
Article.prototype.putOut = function(titletxt, datetxt, authortxt, bodytxt){
_root[titletxt].text = this.title;
_root[datetxt].text = "On: "+this.date;
_root[authortxt].text = "By: "+this.author;
_root.newsScroller[bodytxt].htmlText = this.body;
};
function articleOut(xml){
_global.numArts = xml.firstChild.childNodes.length-1;
info = xml.firstChild.childNodes[at].attributes;
body = xml.firstChild.childNodes[at].firstChild.firstChild.nodeValue;
currArticle = new Article(info.id, info.title, info.date, info.author, body);
currArticle.putOut("titletxt","datetxt","authortxt","bodytxt");
delete currArticle;
delete info;
}
trace(_root._width);
theNews.onLoad = function(){
articleOut(this);
at = numArts;
articleOut(this);
_root.createEmptyMovieClip("menu", 10);
items = this.firstChild.childNodes;
to = Number(items.length-1);
for(a = 0; a>= -to; a--){
_root.menu.attachMovie( "menuItem", "item"+a, a);
_root.menu["item"+a].datetxt.text = items[to-(-a)].attributes.date;
_root.menu["item"+a].nametxt.text = items[to-(-a)].attributes.title;
_root.menu["item"+a]._y = -28*a;
_root.menu["item"+a]._y += 253;
_root.menu["item"+a]._x = 780-702;
_root.menu["item"+a].itemConst = Number(items[0].attributes.id)-1;
_root.menu["item"+a].itemNum = to-(-a);
_root.menu["item"+a].onRelease = function(){
gotoAndPlay("story");
at = this.itemNum;
_root.articleOut(theNews);
}
}
_root.textmovie.myScroller.scrollTarget = _root.menu;
}
articleOut(theNews);

CSS Adds Extra Line?
I'm having a problem with extra lines being added to my text anytime the stylesheet is applied?? Check this out and please let me know what the problem is.

Here's the actionscript:

this.createTextField("bodytxt", 0, 50, 30, 430, 200);
bodytxt.html = true;
bodytxt.border = true;
bodytxt.wordWrap = true;
bodytxt.multiline = true;
var format = new TextField.StyleSheet();
var path = "stylesheet.css";
var quick = "<p align='center'>TESTING CENTER<br /><strong>TESTING BOLD</strong><br /><u><font color='#ff0000'>TESTING RED UNDERLINE</font></u><br /><em>TESTING ITALIC</em><br />Just regular text</p>";
format.load(path);
format.onLoad = function(loaded) {
if (loaded) {
trace("css loaded");
bodytxt.styleSheet = format;
bodytxt.htmlText = quick;
} else {
bodytxt.htmlText = "Error loading CSS file!";
}
};

Here's the css:
b, strong {font-weight: bold; color: #396780;}
i, em {font-style: italic;}

Add "-" To Break A Word At Line Break
is it posslbe to add a "-" to break a word at the end of the line, if the word is longer and need to be broken?

TextField AutoSize Extra Line
Hello,
If I copy a text in htmlText textfield, that is set to autoSize, an extra line is created. How can I avoid that this extra line is created?


HTML Code:
import fl.controls.Button;
var myText:TextField=new TextField();
var storeText:String;
addChild(myText);
myText.border=true;
myText.width=200;
myText.autoSize=TextFieldAutoSize.LEFT;
myText.type=TextFieldType.INPUT;
myText.multiline=true;
var myButton:Button=new Button;
addChild(myButton);
myButton.x=300;
myButton.y=100;
myButton.addEventListener(MouseEvent.CLICK, myButtonF);
function myButtonF(event:MouseEvent){
storeText=myText.htmlText;
myText.htmlText="";
myText.htmlText=storeText;
}

Using XML And HtmlText How Do I Get Rid Of Extra Line Returns?
I'm using XML to put text into the htmlText property of a textfield. But I'm seeing extra line returns. How do I get rid of the extra line returns?

Extra Line Breaks In Text Loaded From XML
Hello all,
So I am loading some text from an XML file. It is a couple of lines, and it loads fine. But, the line breaks show up as more than one break. Actually, it seems like Flash sees it as one large line break or something. For example ...

<?xml version="1.0" encoding="utf-8"?>
<myData>
First Line
Second Line
Third Line
</myData>

... would show up as what looks like triple spaced lines. I was messing around with the ignore white space, but in AS3 that is supposed to be off by default I think. Plus I am not sure that even applys to what I am doing. Ideas?

- B

PHP/XML/Flash Combo (extra Line-breaks)
Hey all,

I'm having some problems when calling in data from a MySql database.
I use PHP to generate an XML file, wich then gets called into flash.

any help would be highly appreciated.

What happens is that an extra line-break (or newlin or br or whatever) is added in Flash.

I have put my example here :
http://www.indewulf.be/test/keuken.swf

My xml file is here (doesn't work in IE, works in mozilla) :
http://www.indewulf.be/php/keuken.php

All my text fields have HTML enabled in flash,
this is my main chunk of code :


Code:
var add_next_here = 30;

function GenerateMenu(menu_xml){

var menus = menu_xml.firstChild.childNodes;

var prijs = menus[0].firstChild;
prijs_txt.html = true;
prijs_txt.autoSize = true;
prijs_txt.htmlText = prijs;

for (var i = 1; i < menus.length; i++){
this_menu = menus[i].childNodes;

for (var i = 1; i < this_menu.length; i++){
gerecht = this_menu[i];
gerecht_oms = gerecht.childNodes[0].firstChild.nodeValue;
gerecht_wijn = gerecht.childNodes[1].firstChild.nodeValue;
if(gerecht_wijn == undefined){gerecht_wijn = '()';}

this_gerecht_mc = main_mc.attachMovie("gerecht_mc","gerecht" add i,i);

// set up shortcuts
gerecht_txt = this_gerecht_mc.gerecht_txt;
wijn_txt = this_gerecht_mc.wijn_txt;
//
gerecht_txt.autoSize = true;
// set text
gerecht_txt.html = true;
gerecht_txt.htmlText = gerecht_oms;
wijn_txt.text = gerecht_wijn;

wijn_txt._y = gerecht_txt._height;

this_gerecht_mc._y = add_next_here;

add_next_here += this_gerecht_mc._height + 10;

}
}

bottom = main_mc._y+mask_mc._height-main_mc._height-50;
}

///////////////////////////////////////////////////////////////////////
// Read in XML, run some functions
//////////////////////////////////////////////////////////////////////

var k_xml = new XML ();
k_xml.ignoreWhite = true;
System.useCodepage = false;
k_xml.onLoad = function(success){
if (success){
GenerateMenu(this)
}
else{
trace ("Error loading XML file");
}
};

k_xml.load("http://www.indewulf.be/php/keuken.php");

Whats This Extra Line For 2points Of LineTo()
hello fellows!!
well i was experimenting on the lineTo() function to make 3d cube, but unfortunately something is troubling!!! i expect the following figure:-

i made eight points...

1 +------------------+
/| /|
/ | / |
/ | / |
+-------------------+ 2 |
| | | |
| | | |
| | | |
| 3 +-------------|--- +
| / | /
+-------------------+4
but a line from (1 to 2) and (3 to 4) is automatically drawn.. how should remove those lines!!! Plz help

Line Break
let's say I want to enter this into a variable:

hello,
I'm em00guy

How to I tell flash to recognize the line break?

example:

variable="hello (what goes here?)I'm em00guy"

Thanx ahead of time.

Line Break
How can send a line break to textbox *without* using <br>

For example,

_root.myTextbox = "Line1<br>Line2"


The reason why I can't use <br> is because I'm using XML...

Line Break Help Please
hello,

I have a problem. Its probably really really simple.

I have a dynamic, multi-line text box, that keeps adding text to it. How can i create a line break after every bit of text added. I tell it what to write so its probably as simple as i dont know the code for a line break.

help???

is there a way for it to understand <br>?

Line Break In XML?
Hi
I have some thumbnails that are loaded into a movieclip from an XML.
They load in fine but they all load in a horizontal line.
I want to have 4 thumbnails then a line break.

Heres my xml:


Code:
<?xml version="1.0" encoding="UTF-8"?>
<gallery>
<image title="Title 1" main="images/age.jpg" thmb="thumbnails/age.jpg"/>
<image title="Title 2" main="images/bars.jpg" thmb="thumbnails/bars.jpg"/>
<image title="Title 3" main="images/beams.jpg" thmb="thumbnails/beams.jpg"/>
<image title="Title 4" main="images/begin.jpg" thmb="thumbnails/begin.jpg"/>
<image title="Title 5" main="images/found.jpg" thmb="thumbnails/found.jpg"/>
<image title="Title 6" main="images/helm.jpg" thmb="thumbnails/helm.jpg"/>
<image title="Title 7" main="images/knight.jpg" thmb="thumbnails/knight.jpg"/>
<image title="Title 8" main="images/lost.jpg" thmb="thumbnails/lost.jpg"/>
<image title="Title 9" main="images/newwings.jpg" thmb="thumbnails/newwings.jpg"/>
<image title="Title 10" main="images/primate.jpg" thmb="thumbnails/primate.jpg"/>
<image title="Title 11" main="images/quartz.jpg" thmb="thumbnails/quartz.jpg"/>
<image title="Title 12" main="images/sanc.jpg" thmb="thumbnails/sanc.jpg"/>
</gallery>


I tried putting in <BR> every 4 but it just doesn't show any of the images after the <BR>

Any ideas?

Xml Line Break
Hi, i'm learning this tutorial here on how to load xml and format text using css. I've done everything that's on here so far but still a little confused on how i can add line breaking. Can anyone give me an idea?

http://www.actionscript.org/tutorial...nt/index.shtml

Line Break
Hi,

Just a simple question really, but what is the syntax for a line break in flash. I have an array with a large amount of text and within the text i want to insert a break to make it go to the next line.

Thanks In Advance

How Do I Line Break In XML
I need help as I want to have some line breaks in my XML. I have a the code for ignore white spaces which is eliminating my line breaks. someone pls help. i have tried <br> which doesnot work.

Why This Line Break?
Code:
myTextField.htmlText = "First line! ";
myTextField.htmlText += "Still first line?!";
Why does this output:

Quote:




First line!
Still first line?!




Instead of:

Quote:




First line! Still first line?!




And how do I eliminate the line break?

How To Break A Line In XML?
Here is a node in my XML file:

<note>Sample Text Tel: (444) 444.4444</note>

I want to add a line break like <br> after the "Sample Text" so the phone number would appear on the new line.

Thanks in advance!

TextFX Line Break?
My problem may semm handy to some, but i do not understand a thing of actionscripting even at this point, were I have worked with flash for 1˝ years now.
I have downloaded a FX from flashkit.com, and the text and all is working properly.
However, It(the fx) only writes the text on one line. I would like after a certain amount of characters on one line to make a new line right below as in a txt-document, and begin writing there? Is it possible, and if so how?
The variable is just text.

Thx

How Do I Insert A Line Break?
Actionscript Experts,

I downloaded a flash movie from here to create the appearance of typewriter text and it works great! Now I'd like to put a space between two lines. Any ideas?

Here's the three frame script (which begins on frame 15) - of course the textbox (titled "screen") is on the layer below it:

Frame 1:
text = "Text goes here.";
max = length(text);
i = "1";

Frame 2:
i = Number(i)+5;
screen = substring(text, 1, i);

Frame 3:
if (Number(i)>Number(max)) {
stop ();
} else {
gotoAndPlay (16);
}


Currently the text looks like this where it just goes on and on and wraps over to the next line. I'd like the look of this next example so that I could create the illusion of bullet points:

-Example 1

-Example 2

-Example 3

Your help would be greatly apprciated Flashkit moderators and members.

Quiason

Inserting A Line Break
here's m code:


Code:
function manualHandler() {
manual = _root.partNumber.getSelectedItem().label;
trace (manual);
if (manual == "15107") {
engDescription = "8HP GX240; 9HP GX270QA2; 11HP GX340K1QA; 11HP GX340K1QA; 13HP GX390K1QA";
}
}
in the part where the variable engDescription gets filled with text, how can i insert a line break? I have tried "/n", but it just gets printed onscreen.


thanks,
-myk

How To: Line Break In Value Text
I'm displaying a value as text, but need to create a line break in the text. How do i write that into the value?

variable= "line (insert line break) break";

Line Break (+ Newline)
Hi, I'm doing an email form in flash which uses mailto to send the fields to an email address using the viewers email client.

I'm using + newline to create line breaks between fields ,
so that when the information inputed into the form fields is seen on the email window, the fields are separated by a line break.
It all works fine when the submit button is pressed from the standalone flash player and It works fine on the Netscape/communicator front .,but when the flash movie is within Explorer and the email client is outlook express, the fields appear with no line break between them.

Any clues greatly appreciated.

Cheers.

Line Break Woes
Hello Flash gurus!

I am having a problem with my returned variables not appearing on the same line in my text box. They always have a line break between them. I have tried many different ways of organizing it but nothing seems to keep the two variables where I want them.


The fla is pretty self-explanitory. This is part of a much larger project. If anyone has a better method of making it work (I still want to call the variables from an external source) please let me know.

Thanks

FlashMX2004 btw

Aaron

Is There A Char For Line Break?
or some other method of adding a new line to text on an existing text box

Text Box Break Line
i want when the user type in a text box
and he have reached the end of the line the line will autometiclly break and go to next line!
is it possible?
how?
thanks inadvance
peleg

How Do I Break A Line In A Text Box
how do i break a line in a text box using code?
thanks in advance
peleg

Get Rid Of Line Break In Actionscript?
I have an input called sourceURL.

I have it put together a string in a button like so, to make a url:


Code:
on (release) {
generatedCode = "<img src='"+sourceURL+"'>"
}


The dynamic text field that i have that spits it out works fine, except that it always includes a line break just after where the sourceURL inserts. WHats up?

Email Line Break
Hi,

I'm trying to create a line break in the body of an email. It works fine in the flash development environment, but when I publish the file and run it in an html page the line break has no effect.

Does anyone know why? The only code I'm using is below.
Thanks
Robin.


Code:
var subject_txt:String = "Email subject here";
var body_txt:String = "First line of body text";


var request:URLRequest=new URLRequest();
request.url="mailto:?subject="+subject_txt+"&body="+body_txt + "
" + "this is on a new line";
navigateToURL(request,"_self");

Line Break Not Working
Using the following to create text. Why won't the line break after 'Family'?


Code:
var theText:TextField = new TextField();
theText.htmlText = "A Family<br>Dog is good to have";
theText.wordWrap = true;
addChild(theText);


I've also used:

Code:
theText.htmlText = "A Family<br>Dog is good to have";

and

Code:
theText.htmlText = "A Family<br />Dog is good to have";


I've taken wordWrap out and have used:

Code:
theText.autoSize = TextFieldAutoSize.CENTER;


But nothing seems to be working. What am I missing?

Break A Txt Line Into Many Lines
Code:
_root.levelText = "As. Nor. Óss *estuary*. Icel. Óss *one of the Aesir, Odin*. AS Os *mouth*. ASĆsc *ash*: one of the additional runes, with both shape and sound similar to the Older Futhark As rune.";
I have this line to place a text on a dynamic text box... is there a way in whic I can break this line into many lines??? I mean: how may I insert an Intro?

thanks

XML, HtmlText And Line Break
I have a simple XML file with 10 articles. I would like to insert them inside a textfield. After each insert, I want a break line.

It seems that I can't do that... Flash doesn't do the break line. I have tried the CDATA method inside the XML, the <br> tag and the
inside the XML and inside the flash. Nothing works. It's like I have to create a textfield for every articles I want to insert...

here is my XML:

Code:
<?xml version="1.0" encoding="utf-8"?>
<root>
<article>article 1</article>
<article>article 2</article>
<article>article 3</article>
<article>article 4</article>
<article>article 5</article>
<article>article 6</article>
<article>article 7</article>
<article>article 8</article>
<article>article 9</article>
<article>article 10</article>
</root>
here is my actionscript code

Code:
for(var i:Number=0;i<faqXML.firstChild.childNodes.length; i++){
container.mc_xmlDisplay.txt.htmlText += faqXML.firstChild.childNodes[i].firstChild.nodeValue;
}

Need Line Break, Formatting Help
Hi,

Found this site googling my problem.

I've been learning Flash 8 for about 30 days now, and am currently deconstructing/customizing a prefab website template.

I've managed to discover various dynamic text boxes that allow me to format font, color, etc.

From there I've dug deeper into ActionScripts and their included formatting commands, and I've hit a snag.

There's a scrolling list box of topics, whose formatting script looks like this:

var myStyleFormat = new FStyleFormat();
myStyleFormat.textColor = 0x00427C;
myStyleFormat.textSize = 12;
myStyleFormat.textSelected = 0xCC0000;
myStyleFormat.selection = 0xFFFFFF;
myStyleFormat.addListener(List);

It took me days to find, and here is where I've been able to change the list font color. However, I can't change the font weight to bold no matter how many variations of the bold=true syntax I try. And I cannot get the text in the scroll box to wrap or line break to additional lines when I want to write a topic whose length is longer than the width of the list box.

I suspect there's another batch of formatting commands somewhere, but I can't find them.

Help!

You can view the template here:
http://www.morningsidekick.com/morni...nterior-3.html

The text I cannot change is in the left hand column after you click "WHAT YOU GET" and starts with the words "Huge Daily Prep".

The fla file is http://www.morningsidekick.com/morni...interior-3.fla

The list box formatting script noted above is in "Actions for Frame 9" under mcTOPICS in MovieExplorer.

Thanks!

How To Do A Line Break When Using RadioButtonGroup?
EDIT2: Ok Both problems solved since I just found out how to randomize the array It took me three days to solve these problems lol At the third day I posted here but I got with the solutions by myself as well xD Sorry and Thanks!

EDIT: lol ok Silly me.. I've just found out how to do that... Just adding a n in the answer texts solves this issue... I feel silly now =P ... However, I got another doubt, since I need to randomize the questions... Let's say I'd need 20 questions in total (with its respective answers). From those, I only need 10 to show... Ok, no problem here. The thing is, from those 20 possible questions, I need any 10 to appear randomly. I still can't found out how to randomize the items inside an array. Can anyone help me here about how to do that?

Thanks in advance again!!


----------
Hello everyone!! I need to do a quiz and I'm following Jody Hall's tutorial here for that.


ActionScript Code:
public function QuizQuestion(theQuestion:String, theAnswer:int, ...answers) {
    //store the supplied arguments in the private variables:
    question = theQuestion;
    theCorrectAnswer = theAnswer;
    choices = answers;

    //create and position the textfield (question):
    questionField = new TextField();
    questionField.text = question;
    questionField.multiline = true;
    questionField.htmlText = "<font face='verdana'>"+question+"</font>";
    questionField.textColor = 0xC21759;
    questionField.autoSize = TextFieldAutoSize.LEFT;
    questionField.x = questionX;
    questionField.y = questionY;
    addChild(questionField);

    //create and position the radio buttons (answers):
    var myGroup:RadioButtonGroup = new RadioButtonGroup("group1");
    myGroup.addEventListener(Event.CHANGE, changeHandler);

    //Formatting the text for the RadioButtonGroup:
    var rbTxtFormat:TextFormat = new TextFormat();
    rbTxtFormat.color = 0xC21759;
    rbTxtFormat.font = "Verdana";
    rbTxtFormat.size = 12;

    for (var i:int = 0; i < choices.length; i++) {
        var rb:RadioButton = new RadioButton();
        rb.setStyle("textFormat",rbTxtFormat);
        rb.textField.autoSize = TextFieldAutoSize.LEFT;

        rb.label = choices[i];
        rb.group = myGroup;
        rb.value = i + 1;
        rb.x = answerX;
        rb.y = answerY + (i * spacing);
        addChild(rb);
    } //for Condition
} //public function QuizQuestion

I'm attaching the AS files in case you need them, however, I coudn't attach the FLA since it's larger than 500kb... But it's attached at the end of the Jody Hall's tutorial here, it's exactly the same file just in case you need it.

Thanks in advance!!

Line Break Issues
First off. I'd like to say the ability to have html in flash is awesome. For the work that is done, I love it. I've been using a CMS to with a wysiwyg editor to update text in their sites. However, I have two big issues with the rendering of html in flash.

1. Line breaks ( <br> ) that have no content between themselves and the end of a tag (EG: <br></p> ) still creates a line break where as HTML / XHTML does not. Issue is the same with list items, divs, etc...

2. Hyphens break to the second line as opposed to staying on the first line.
(EG: There are fourty
-five boxes in the back.

Where it should look like this:
There are fourty-
five boxes in the back. )

If anybody has any suggestions. This has really become an issue I'm going nuts over. I have done work trying to use regex in coldfusion to make it work correctly, but that has turned into a nightmare as well. Any help?

Line Break In Combo Box?
Is there a way to put a line break in a Combo Box?

With a line break, I mean add two lines of text in one cell.

Detect Line Break
Hi I wondered if anyone could help. As my deadline is looming to a dangerous point and im stuck:|


I have a dynamic text field in flash that is populated by an input box.

The dynamic text field has a maxmium width it can be. So i have it as multiline WITH wodrwap on.

My problem is that I have to send this data to server and for the php to be able to text the text and output the text as it is displayed in flash.

There seems to be no way of finding the linebreaks and passing them in the string as far as I can see? Does anyone have any ideas on this or a workaround?

The noose is tightening.

thx in advance

ade

How To Represent Break Line In Xml?
if i get the infomation from an xml file and display it in a textfield..
how can i represent a breakline in the xml file so that the textfield also have a new line?

Xml Line Break Problem
Hi,

I searched the forums but nothing solved this..

I have a multiline dynamic text field in flash, loading text from a XML file.

The first lines of XML looks this:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<image>
<pic>
<image>http://www.webdesignpt.com/dakar.jpg</image>
<decription>first line nsecond line</decription >
</pic>
...

Flash reads the "
" like regular text... like this:

first line nsecond line

can you please help me?

thanks

XML Line Break In Flash
Hey'a,

Using the http://www.kirupa.com/developer/acti...ldataflash.htm tutorial I'm just curious..

How do I create line breaks with the XML file?

Eg: I may have paragraphs or want to layout the text with gaps inbetween and the text startin on a new line of the Dynamic Text box..

I'm not sure if this is easy or not as I'm new to the XML side of Flash.

Cheers!

Line Break In XML File?
I've searched all over and I can't seem to find an answer that works. I have the following XML file:


Code:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<news>
<item>
<news><![CDATA[test<br />test1]]></news>
<url>http://www.mysite.com</url>
</item>
</news>
I'm trying to find a way to break a line in the <news> section. I've tried the following:
<news><![CDATA[test<br />test1]]></news>
<news>test<![CDATA[<br />]]>test</news>
<news>test
test</news>
<news>test
test</news>
<news><![CDATA[

None of these methods work, any help would be most appreciated.

XML To FLASH Line Break
I've been battling with this for a few hours: how to get a line break in a flash text field from an external xml file.

my xml looks like this:

Code:
<gallery>
<image path="some_path" title="some_title" subtitle="some subtitle" />
</gallery>
Attributes for the "image" node are used to address individual image path, title and description.

So let's say you want to insert a line break in the image's subtitles. You have to use an ASCII character reference. check Senocular XML article for character reference.

The xml would look like this:

Code:
<gallery>
<image path="some_path" title="some_title" subtitle="some subtitle & #13; some more subtitle" />
</gallery>
Note there should be no space between the ampersand "&" and the character reference number "#13;" above.


Additionally, the flash text field displaying the "subtitle" attribute must be set to html and htmlText, as shown below.


Code:
my_text.html = true;
my_text.htmlText = this.firstChild.childNodes.attributes.subtitle;
Hope this will make it easier for someone to nail linebreaks in xml text than it was for me...

Searching in the forum I learned that best practice for this would be CDATA, specially if you are going to use html tags in your text field. This is a little beyond what I needed, so the character reference and text field html method really seems the best answer for simple line breaks, html symbols and special characters.

Cheers!

Copyright © 2005-08 www.BigResource.com, All rights reserved