Parsing String To Add Newline As Needed
ok. me not so good with the actionscript. I tend to get my languages confused.
I've got an XML nodevalue that needs to be put in a label component. Its working great until the text is longer than 58 chars. So I'm trying to write a little scipt to parse the string and add "newlines" as needed.
The script should check if the string is longer than 58 chars, if not just put the string in the labelcontrol.text. It does this great.
If the string is longer than 58 chars it should start looking for a space character at the 58th character and look backwards one character until it finds a space. Then it should slice the front half of the string off and put it in a new string variable. If the remaining string is more than 58 chars, it should repeat this process to find a break between lines 2 and 3. Recurssion stops there as there isn't enough room for more than 3 lines. <aside>Would a scroll box have been a better component choice? <end aside>
script so far.
//take care of linefeeds for stepDescription.text field rawText = newSlideNode.firstChild.nodeValue; rawTextLength = rawText.length; breakpoint = 58; if (rawTextLength > breakpoint) { while(charat(breakpoint) != " "){ breakpoint--; } substring1 = rawText.slice(0,breakpoint); substring2 = rawText.slice(breakpoint++); stepDescription.text = substring1 + newline + substring2; } else { stepDescription.text = rawText; }
Flash hangs if the string is longer than 58 chars. Does anyone see something obvious or not so obvious?
Thanks bj
FlashKit > Flash Help > Flash ActionScript
Posted on: 05-18-2004, 11:23 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
A Tini Bit Of Help Needed Parsing This String In Array
hi there....
im having trouble parsing this data in my array:
mainfoldernames[1] = ,banner,web
each mainfoldernames[X] = have "," in front
how can i remove the first "," i tried this:
mainfoldernames[1] = mainfoldernames[1].substr(1,mainfoldernames[1].length-1);
but it didn't work
any help?
Danny
Split A String At Each Newline
I have a text file which I import into a variable called text.
This text file is 5KB or 107 lines, so if I use:
text = text.split('
');
I should get a text array of 107 : text[0]...text[106] .
Now, my problem is that it works fine for small files (like 20 lines), but any bigger files, and you'll get the "A script in this movie is causing Flash Player to run slowly..." and basically you have to abort the whole thing.
Is it unreasonable to expect Flash to handle 100+ of text lines to look for
? Or am I doing something wrong ? Any better ways of making an array containing each lines of text ?
Thanks
Split String On Newline
I want to split a string on the newline since XMLsocket send(), which i am using, doesn't like newlines.
arr = new Array();
arr = box_text.split(chr(14));
//doesn't work, places the string into arr[0]
arr = box_text.split("
");
// doesn't work either, also places the string into arr[0]
Anyone have any idea of stuff that would work?
TextArea To String With Newline
I have a TextArea full with text, click in a button and i tranfer to a String...
There is a way to transfer to the string with the NEWLINEs that are in the TextArea without using HTML properties?
tnks in advance...
sorry by the bad english
String Parsing Help...
Is it possible to detect a carriage return in a string? I've tried using substring, looking for "
" (with one char and two), but I can't get it to work. Any ideas?
B
Parsing An <a> Tag In A String.
I want to take a string that will be in a dynamic text field that looks something like:
Code:
This is <b>my</b> text.<br /> Here is a <a href="some.htm">link</a>.
I want to take and parse the string and make it look like this:
Code:
This is <b>my</b> text.<br /> Here is a <font color="#FF0000"><a href="some.htm">link</a></font>.
As you can see I just want to wrap a font tag around the <a> tag to make the link a different color in the text field. I have a javascript that does something like this but not quite and I am having some issues. Can anyone help?
Oh and an off the subject question (that can't seem to be fully answered anywhere) can you make a a link change color on rollover in a dynamic text field? Got a url or fla? Thanks!
Parsing An <a> Tag In A String.
I want to take a string that will be in a dynamic text field that looks something like:
NOTE: *'s to keep the tags from not showing - ignore them please.
Code:
This is <*b*>my<*/b*> text.<*br /*> Here is a <*a href="some.htm"*>link<*/a*>.
I want to take and parse the string and make it look like this:
Code:
This is <*b*>my<*/b*> text.<*br /*> Here is a <*font color="#FF0000"*><*a href="some.htm"*>link<*/a*><*/font*>.
As you can see I just want to wrap a font tag around the <a> tag to make the link a different color in the text field. I have a javascript that does something like this but not quite and I am having some issues. Can anyone help?
Oh and an off the subject question (that can't seem to be fully answered anywhere) can you make a a link change color on rollover in a dynamic text field? Got a url or fla? Thanks!
String Parsing
Hi, I am having some problems with String parsing in flash. I know quite a few programming langauges, but have always had difficulty with actionscript...
Here is what I am trying to do
Load a file into a string
Read that string line by line
On each line there are 3 parts seperate by commas, I either want to put those 3 parts into an object (class student for example) or ill just put them into 3 seperate arrays...
Here is what I have so far.
var mytext = new XML();
mytext.onLoad = function() {textBox.text = mytext; }
mytext.load('http://swc.lakeheadschools.ca/coding/CommentGetter/COMMENT.bnk');
Problems
Why XML? this isnt an XML file... *shrug
I can get substring to work on mytext but I cant go line by line.... I want to do something like this
i=0
while(i<lines in mytexT)
{
var line = mytext.readline
part1[1] = line.substring (I know how to do this)
part2[2] = line.substring (I know how to do this)
part3[3] = line.substring (I know how to do this)
}
I guess what I am saying is I dont know how to read line by line Help?
Parsing A String
Hi,
We are researching how to do this, however on the offchance that someone knows, we thought we would post it here.
We want to read from a txt file that looks as follows:
2DAY-today
2MORO-tomorrow
2NITE-to night
We want to read the information into the follow two arrays:
such that:
arrQuestion[0] = 2DAY
arrQuestion[1] = 2MORO
arrQuestion[2] = 2NITE
arrAnswer[0] = today
arrAnswer[1] = tomorrow
arrAnswer[2] = to night
Does anyone have any code that they could offer.
Thanks,
Peter.
String Parsing
I was wondering if there is a built in function to check if a character is a symbol or an alpha character. I have been looking all around, but I haven't found anything.
String Parsing Help
Is there a way to parse the contents of a dynamic text field to see if it contains a certain word? I currently have a text field being watched for certain strings, but I'd like to get into those strings and pull out certain words.
For instance, instead of watching for "user error" or "proc error" or "error in movie", I'd like to watch for all instances of the word "error" and deal with them all the same.
Parsing Variables In A String
hi,
i have a string like "returnPath=keys&score=1" this string comes from a server through a xmlsocket and is an attribute of a certain element.
now i have the following problem:
i want to parse the variables in this string.
so that returnpath = "keys" and score = 1
at first i did it this way:
str = new String(unescape(e[i].attributes.actionString));
//str is "returnPath=keys&score=1"
varArray = str.split("&");
for (j=0; j<varArray.length; j++) {
tmpArray = varArray[j].split("=");
if (tmpArray[0] == "score") {
score = parseInt(tmpArray[1]);
}
else if (tmpArray[0] == "returnPath") {
returnPath = tmpArray[1];
}
}
this worked very good. but i want to make this parsing code more general, so i changed this into the following:
str = new String(unescape(e[i].attributes.actionString));
//str is "returnPath=keys&score=1"
varArray = str.split("&");
for (j=0; j<varArray.length; j++) {
tmpArray = varArray[j].split("=");
set(eval("_root" + tmpArray[0]),eval(tmpArray[1]));
//also tried: eval("_root."+tmpArray[0]+"="+tmpArray[1]+";");
trace ("score: "+_root.score);
}
the problem is that these variables score and returnpath are never created & filled...
Parsing String From A Movie To Another...
I have a movie called moviewindow.swf, that, "opens" a white window in the screen when the user clicks any button of the site. Well, depending on the button that was clicked, another movie should be loaded over the white window.
The deal is that I have several movies (one for each button), and would like to load the right movie. At first sight, I tried to do the following in the OnRelease event of the buttons:
on (release) {
loadMovie("moviewindow.swf",1);
loadMovie("content1.swf",2);
}
The problem is that the loading is so fast that the content1.swf is being loaded before "moviewindow.swf" performs its last frame.
Then, I would like to load the "content1.swf" from within "moviewindow.swf", from its last frame. That is, when, "moviewindow.swf" reached its last frame, it will find a loadmovie action to load the "content1.swf".
Well, it's not so simple as can seem. Because I have several different movies (content1.swf, content2.swf, content3.swf, etc) the "moviewindow.swf" dont knows how movie to load. Then I tried to do the following (that not worked) in the main movie:
on (release) {
_root.contentmovie = "content1.swf";
loadMovie("moviewindow.swf",1);
}
Then, in "moviewindow.swf" I put in the last frame:
loadMovieNum (_root.contentmovie,2);
What I tried to do was to parse the movie name using a global var, but it not worked. How could I do that????
Thanks!
Parsing A Variable String?
I am taking a long html string, and putting it into a text field. Nice and simple.
However, is there a way i can parse it for more complicated text?
Like is it possible, INSIDE a text field mind you, to parse "[fade]text i want to fade[/fade]" from the string, and replace it with "text i want to fade"(<- pretend that is fading text, like 100% to 0% alhpa).
String Operations In AS3 - Parsing
Ok, hello AGAIN! I'm sure you all will get to know me soon if you havent already - im the AS3 newbie.
Anyway I have some variables with strings in them. I need to be able to tell if a string has a certain type of character in it. Like for example
"no,yes"
I want to detect the "," and split that string up at that point and assign the "no" and the "yes" to variables.
Similarly if I have the string
"1-100"
I want to detect the "-" and split that string up at that point and assign the "1" and the "100" to variables.
I have noticed that somethings are called differently in AS and have had trouble searching for a certain section because I dont know how its refered to in AS (for example 'function' as opposed to 'method')
Thanks in advance.
String Parsing Question
I am new to AS3 and was wondering if anyone could point me in the right direction of how to split a string after so many characters. In other words, if I have a string that is 500 characters long and wanted to split it at 250 characters, what function would I use to accomplish this? Thanks for any tips!
Parsing String Into Array
I am working on a program that reads in a list of procedures to be performed. In some cases, a number of steps must be performed before the user may go on to the next procedure. These steps are written in an array format as: [step1a, step2a, step3a]I am trying to figure out how to parse this string into an array. I think I want to use the split function, but I don't want the brackets to be included. I also have other, more difficult, strings to parse in which there are arrays within the array:
[[step1a,step2a,step3a],[step1b,step2b,step3b]]Does anyone know of an algorithm for parsing these strings?
Chris
Parsing String Values
Hello. I have a variable:
var myString:String = "811,812";
What I want to be able to do is have code that goes through myString and parses the numbers in between the commas. This value would then be passed to my switch function where I assign methods based on the outcome.
As I'm new to AS3.0, I just don't know where to begin.
Thank you for any help.
-dE
Parsing String To Boolean
Is there are any build-in function that is able to parse a string into Boolean ?
I've checked the livedocs, doesn't seems it has Boolean.parse() method or something similar to do the job
Suggestions For Parsing ASP String
I'm trying to build an image gallery with a backend connection. My ASP is returning the following string format;
Code:
uniqueid=1,mm_name=bluehills.jpg,mm_path=img/req1,mm_keywords=keyword1&uniqueid=2,mm_name=satellite_map.jpg,mm_path=img/req2,mm_keywords=map satellite&uniqueid=3,mm_name=robot.jpg,mm_path=img/req2,mm_keywords=robot black and white
i'm not sure of the best way to parse the string in AS3? I'm looking for suggestions. I imagine a custom XML parsing class? I'd like to bind certain variable to repeater and I need to concatenate things like image path from the string (i.e. "mm_path + mm_name = img/req1/bluehills.jpg").
I'm looking for any suggestions on what road to take and perhaps any links for previous examples? Preemptive double-thank you!
Parsing A String To An Xml In ActionScript
Hi,
I've been looking for a way to parse a string to an xml in ActionScript. What I have for the moment is a string, generated by PHP and put into a variable in javascript. I use the ExternalInterface-class to get that string from the javascript variable and when I have it into flash, I want to make that string into an xml-file.
The content of the variable is as followed:
<files><d i="1" file="./media/imageviewer/home/demo_pre.jpg" /><d i="2" file="./media/imageviewer/home/header.swf" /><d i="3" file="./media/imageviewer/home/8_augustus_1999.jpg" /><d i="4" file="./media/imageviewer/home/block11.jpg" /></files>
I can get that value into flash without a problem, and after that I try to run parse it to an xml like this:
files_arr = new Array()
//****************************
// PARSE XML
//****************************
function parse(ixemel){
var xmlString = ixemel
var data_XML: XML = new(xmlString)
data_XML.onLoad = function(){
data = this.firstChild
for(var i= 0; i<data.childNodes.length; i++){
trace(i)
temp = new Object;
temp.id=Number(data.childNodes[i].attributes.i)
temp.file=data.childNodes[i].attributes.file
trace(temp.file)
files_arr.push(temp)
}
build()
}
}
function getPage(){
paxe = ExternalInterface.call("SendDataToFlash");
varTXT.text = paxe;
parse(paxe)
}
I can't just use "data_XML.load(someScript.php)" that runs a specific script, because I use the same swf that has to load different images according to the page you're on.
What doesn't happen is that the XML gets parsed, so I don't come to the point that I put the elements into the array.
Thanks for the help!
Driehoek
Problems With XML Parsing UTF-8 & String.indexOf
Hello,
Can anyone help me? I've got a problem using the String.indexOf(). I am parsing an RSS feed (mxl) document and I am sure that feed is orginially written in a foriegn character set (Japanese). The xml file gets to me it has been encoded into UTF-8 so I am able to parse it, no problemo. However, I am unable to use the String.indexOf operator to abstract information from the String...
Thus an item may be retrieved such as...
<item>"www.youtube.com/movies/902348o2u423o4u.swf"<item>
parsed
myItem:String ="www.youtube.com/movies/902348o2u423o4u.swf";
Using myItem.indexOf("youtube").. does not yield any result... it evaluates to -1. Now what is quite strange is that I am able to parse this string by the individual characters...
So thus....
for( var i:Number = 0; i < myItem.length; ++i){
if(myItem.charAt(i) == 'y'){
trace("Y character found at "+i);
}
}
yields
Y character found at 4
Has anyone every encountered a problems using the String.indexOf parser with XML RSS, possible in a foriegn character set?
If so could some one tell me why this does not work and what they did for a work around?
(I am pretty sure I could build my own string parser, but for some reason the boss man who is paying me, wants an explaination as to why this is not working ... and what other people have done....) YEAH me too!
Thank YOu
Moozungu....
String Parsing / Character Counting / Value Passing
hi, everyone -- i DESPERATELY need help with what is for me a pretty esoteric AS 3 task. i need to:
1.) get a string (for context purposes, a URL) from an input field;
2.) count the amount of times a certain character shows up in that string (in my case, and as above, a backslash or "/") ;
3.) after counting a specific number of instances of a character in the string -- say 4 "/"s -- the string is split up at that exact spot and the first half is sent to one parameter (say, nc.connect) + a dynamic text field, and the second half is sent to another parameter (say, ns.play) + a second dynamic text field.
i'm no coding expert under the best of circumstances, but AS 3 seems to be even tougher for me, more strongly typed, and less likely to respond to deprecated kinds of events like onRelease for buttons. i'm sure some for loop "where i<4, i++" or its like would be invoked, but trying to count the amount of characters and populate different kinds of parameters is pretty well beyond me.
thanks for any help you all might be able to provide!
ActionScript XML Parsing Troubles.. Help Needed
I have this function in Flash MX 2004 with some instructions to parse an XML file and then put the strings into five menu points. Looks like this:
Code:
function processXMLData(success) {
if (success) {
var rootNode = this.firstChild;
//
var lesenNode = findNode(rootNode, "p1");
menupunkt1.xmltext.text = getValue(lesenNode);
menupunkt1.anpassen();
var lesenNode = findNode(rootNode, "p2");
menupunkt2.xmltext.text = getValue(lesenNode);
menupunkt2.anpassen();
var lesenNode = findNode(rootNode, "p3");
menupunkt3.xmltext.text = getValue(lesenNode);
menupunkt3.anpassen();
var lesenNode = findNode(rootNode, "p4");
menupunkt4.xmltext.text = getValue(lesenNode);
menupunkt4.anpassen();
var lesenNode = findNode(rootNode, "p5");
menupunkt5.xmltext.text = getValue(lesenNode);
menupunkt5.anpassen();
//
fadeIn(100, 5);
//
menupunkt1.balken.fadeIn(100, 10);
_root.hmp_aktiv = "menupunkt1";
_root.attachMovie("inhalt_menupunkt1", "menupunkt1", 1);
_root.menupunkt1._alpha = 0;
_root.menupunkt1._x = 122;
_root.menupunkt1._y = 102;
_root.menupunkt1.fadeIn(100, 10);
} else {
menupunkt1.xmltext.text = "error";
}
}
So I want to do the repeating task with a loop, and IMO it should look like this:
Code:
function processXMLData(success) {
if (success) {
var rootNode = this.firstChild;
//
f = 1;
do {
var zielobj = "menupunkt"+f;
//
var lesenNode = findNode(rootNode, "p"+f);
this[zielobj].xmltext.text = getValue(lesenNode);
this[zielobj].anpassen();
f++;
} while (f<=5);
//
fadeIn(100, 5);
//
menupunkt1.balken.fadeIn(100, 10);
_root.hmp_aktiv = "menupunkt1";
_root.attachMovie("inhalt_menupunkt1", "menupunkt1", 1);
_root.menupunkt1._alpha = 0;
_root.menupunkt1._x = 122;
_root.menupunkt1._y = 102;
_root.menupunkt1.fadeIn(100, 10);
} else {
menupunkt1.xmltext.text = "error";
}
}
SHould work, but doesn't - any ideas? The targets in the loop are put together just right, I checked the Variables window.. so, what could be wrong?
[F8] XML, Array Parsing, Assistance Needed
Hi all,
need help with this ticker Im working on. It has 2 scrolling tickers top and bottom. I want to modify it so I can pull in a live xml Feed from a url coming off a server http://mydomain.com:2221/Feed/ListingData
My swf file will be located at a diff. url.
currently it pulls 1 xml file that sets the ticker's font style, roll-over effect, look and feel, etc. Plus it has the news element that sets the text and url for the text. I want to substatute the news element with my listing element. I tryed pulling in the xml feed and the current xml file (current file to keep the look and feel) the feed for the new info data. but I only get the 1st to fields/nodes <idNumber> & <date>.
this is the code that pulls in the text for the ticker:
code:
stop();
this._lockroot = true;
_root.topPlay = true;
_root.botPlay = true;
newsTopText = new Array();
newsTopUrl = new Array();
newsBotText = new Array();
newsBotUrl = new Array();
// Declare xml newConfig file for ticker layout and design
xmlStr = new String(xml);
if(xmlStr == "undefined")
xml = "newConfig.xml";
// xml parser
xmlData = new XML();
xmlData.ignoreWhite = true;
// xmlData.load(xml+"?"+(new Date()).getTime());
xmlData.load(xml);
//xmlData.load(xml);
xmlData.onLoad = function(success) {
// get newConfiguration string
newConfig = this.firstChild.firstChild.childNodes[0];
_root.fontTopFace = newConfig.childNodes[0].childNodes[0].firstChild.nodeValue;
_root.fontTopSize = newConfig.childNodes[0].childNodes[1].firstChild.nodeValue;
_root.fontTopColor = "0x"+newConfig.childNodes[0].childNodes[2].firstChild.nodeValue;
// target window of the url
_root.targetTop = newConfig.childNodes[1].childNodes[0].firstChild.nodeValue;
// font color when the mouse is over the link
_root.aFontTopColor = "0x"+newConfig.childNodes[1].childNodes[1].firstChild.nodeValue;
_root.bgTopHeight = newConfig.childNodes[2].childNodes[0].firstChild.nodeValue;
_root.bgTopColor = "0x"+newConfig.childNodes[2].childNodes[1].firstChild.nodeValue;
_root.barTopHeight = newConfig.childNodes[2].childNodes[2].firstChild.nodeValue;
_root.barTopColor = "0x"+newConfig.childNodes[2].childNodes[3].firstChild.nodeValue;
// speed
_root.speedTop = (newConfig.childNodes[3].firstChild.nodeValue)*0.2;
if(_root.speedTop>2)
_root.speedTop=2;
else if(_root.speedTop<0.2)
_root.speedTop=0.2;
// space between items
_root.spacingTop = newConfig.childNodes[4].firstChild.nodeValue;
/////////////////////////////////
// top bar news
// I think this is the part that needs to get updated
/////////////////////////////////
newsTop = newConfig.childNodes[5];
for(i=0;i<newsTop.childNodes.length;i++) {
newsTopText[i] = newsTop.childNodes[i].childNodes[0].firstChild.nodeValue;
newsTopUrl[i] = newsTop.childNodes[i].childNodes[1].firstChild.nodeValue;
if(newsTopUrl[i].indexOf("@") != -1)
newsTopUrl[i] = "mailto:"+newsTopUrl[i];
}
//////////////////////////////////////////////////////////
// then the code repeats itself for the bottom news
// bottom
newConfig = this.firstChild.firstChild.childNodes[1];
_root.fontBotFace = newConfig.childNodes[0].childNodes[0].firstChild.nodeValue;
_root.fontBotSize = newConfig.childNodes[0].childNodes[1].firstChild.nodeValue;
_root.fontBotColor = "0x"+newConfig.childNodes[0].childNodes[2].firstChild.nodeValue;
////////////// continues like the top news ticker
//////////////////////////////////////////////////////////
play();
}
This is the xml feed coming in:
code:
<? xml version="1.0" encoding="UTF-16" ?>
<!ELEMENT ticker(config)>
<!ELEMENT config(top,bottom)>
<!ELEMENT top(font,url,bgTop,speed,spacing,news)>
<!ELEMENT bottom(font,url,bgBot,speed,spacing,news)>
<!ELEMENT font(fontFace,fontSize,fontColor)>
<!ELEMENT fontFace(#PCDATA)>
<!ELEMENT fontSize(#PCDATA)>
<!ELEMENT fontColor(#PCDATA)>
<!ELEMENT url(target,aFontColor)>
<!ELEMENT target(#PCDATA)>
<!ELEMENT aFontColor(#PCDATA)>
<!ELEMENT bgTop(bgTopHeight,bgTopColor,barTopHeight,barTopCo lor)>
<!ELEMENT bgTopHeight(#PCDATA)>
<!ELEMENT bgTopColor(#PCDATA)>
<!ELEMENT barTopHeight(#PCDATA)>
<!ELEMENT barTopColor(#PCDATA)>
<!ELEMENT bgBot(bgBotColor,barBotHeight,barBotColor)>
<!ELEMENT bgBotColor(#PCDATA)>
<!ELEMENT barBotHeight(#PCDATA)>
<!ELEMENT barBotColor(#PCDATA)>
<!ELEMENT speed(#PCDATA)>
<!ELEMENT spacing(#PCDATA)>
<!ELEMENT news(item+)>
<!ELEMENT item(text,link)>
<!ELEMENT text(#PCDATA)>
<!ELEMENT link(#PCDATA)>
My New xml feed comes in like this displaying over 100 listings a day:
code:
<listing>
<new>
<idNumber>listing #303 </idNumber>
<date>04/06/2007</date>
<time>08:26</time>
<address>111 mayberry place</address>
<zipCode>11033</zipCode>
<primaryDescription>Large one bedroom apartment</primaryDescription>
<secondaryDescription>fresh paint</secondaryDescription>
<phonenum>1-212-988-3333</phonenum>
<Borough>new york city</Borough>
<severity>none</severity>
</new>
<new>
<idNumber>listing #306 </idNumber>
<date>04/06/2007</date>
<time>08:26</time>
<address>111 mayberry place</address>
<zipCode>11033</zipCode>
<primaryDescription>Large one bedroom apartment</primaryDescription>
<secondaryDescription>fresh paint</secondaryDescription>
<phonenum>1-212-988-3333</phonenum>
<Borough>new york city</Borough>
<severity>none</severity>
</new>
and so on.....
</listing>
What I want to try to do is pull in another xml file the feed above. and parse it into a string and substatute it for the news element where text is?
please any assitance on this will be very appreciated.
Help Needed: Parsing Data From Php-mysql To Exmaple
Hey guys.. ive downloaded following example from this site..
http://www.flashkit.com/movies/Scrip...6783/index.php
its a very good example for me...the only thing is..i would like this to fetch data from a actual mySQL database..
in this example..theres manually "pushed" some data into the array...
i'm not sure how i make a interface that reads data from and how to parse it so it fits this format..
any help would be great , thnx
note: i've created the database..and i know little about how setting up acces to yo9ur db...the only thing is to make the right query, and format the array in the "right" way..(what actually may be the main question for me here"..
Parsing " ' " Character In A String?
Im not sure what this is called... URL encoding or parsing problem...
anyways...
when I try to pass a string as a textNode (value of a node)..
[code]
var linkText:XMLNode = newNode.createTextNode("javascript:NewWindow=windo w.open('image1.jpg','Detailed_Image','width=85,hei ght=100,left=100,top=100,screenX=100,screenY=100') ;NewWindow.focus();void(0);");
[code]
I get this as a result...:
Code:
javascript:NewWindow=window.open('image1.jpg','Detailed_Image','width=85,height=100,left=100,top=100,screenX=100,screenY=100');NewWindow.focus();void(0);
it is basically stripping my apostorphies out...and replacing them with the "&apos" alternative.
If I keep it like this...and write out my XML file...when flash reads it..it actually wats to put in &...
I tired this:
[code]
var linkText:XMLNode = newNode.createTextNode("javascript:NewWindow=windo w.open('image1.jpg','Detailed_Image','width=85,hei ght=100,left=100,top=100,screenX=100,screenY=100') ;NewWindow.focus();void(0);");
var linkText = linkTest.split("<").join("<").split(""").j oin('"').split(">").join(">");
[code]
but then NO textNODE (value) showed up in the element.. any ideas?
String + Split.Help Needed
Hi
I have string being passed like
desc = "<a><b><c>9198865000241e482764-1fba-4049-848f-365de63e7f2d</
c>".
I have a As which will use split function & retrieve value:
"9198865000241e482764-1fba-4049-848f-365de63e7f2d".
It works fine till the num of tags is same.as soon as i insert one
more tag like <d>.i wont get the result.
My code is as follows:
public function getToken(desc:String):void{
var result:Array = new Array(desc.split(/</));
desc = result[0];
result= desc.split(/>/);
desc = result[3];
result= desc.split(/:/);
desc = result[0];
result= desc.split(/,+/);
desc = result[0];
Alert.show("4:"+desc);
}
What changes should i make so that the function retireves the value
even when many tags are inserted
Thanx in advance
Sheetal
String Wizard Needed
Is anyone smart enough to make a code that will take a string that is to be put into a dynamic textfield, and if the string is longer than 11 character make the textfield start a new line every time it sees a space in the string, unless the space is followed by ony one character?
i believe it will involve a
if(string.length > 11){
for(i=0; i <string.length; i++){if(string.charAt(i) == " " && string.charAt(i+2) != " "){make the textfield start a new line!
also set _y -= 12
break;
}
}
}
How do i make it start a new line when all these conditions are satisfied? There must be a way!
Help Needed: French Characters In AS Text String..
Can anyone tell me why I cannot get Flash 8 to display the accented characters in the example below - I have tried cutting & pasting the copy from a UTF8 textfile, entering the characters directly using the windows alt commands, replacing characters with escaped unicode, stating usecodepage true etc.. none of which have worked?
Also the code needs to remain inline, so I am not looking to import the copy from an external source?
Code:
onClipEvent(load) {
this.myString = "Vous êtes le seul à le savoir.";
}
Thanks.
HELP NEEDED With Sorting Query String Into Variable Array?
Hi,
I need to sort a query string with a number of variables into an array of variables..
Here is the query string being sent to the swf file:
order.swf&LOCT0=bedroom&LOCT1=dwelling&LOCT2=kitch en&LOCT3=landing
Below is the script im using:
Location = new Array;
for (i=0; i<"LOCT"; i++) {
Location[i] = eval("LOCT"+i);
It doesnt work! what is wrong in my script??? Please help!
thanks,
Shahid
Help Needed: Convert String To Number Not Working In .as File
Hi, Please anyone here to help me out?
I have this code in my loadxml.as file:
==================================================
function readXML(){
var origInvestment:String = "";
var origInvestmentUSD:String = "";
var TempNum:Number= 0;
origInvestment = String(arrCDN[0]);
//origInvestmentUSD = origInvestment;
TempNum = Number(origInvestment);
if (isNaN(TempNum))
{
origInvestmentUSD ="Has to Be a Number";
}else if (TempNum == undefined )
{
origInvestmentUSD ="Not Defined";
}else if (TempNum == 0)
{
origInvestmentUSD = origInvestment;
}
else
{
origInvestmentUSD = String(TempNum*0.86);
}
}
========================================================
After the input entered, say 100000 through the flash, I can get the output for "origInvestment" alright, but not the USD. Instead, I kept getting the NaN .
When I tried to used var TempNum:Number= Number(origInvestment); , I got "Not defined".
What did I do worng?
Your help is greatly appreciated.
Newline
I have a problem...
i have written some actionscipt to be activated upon release of a submit button on a form, that launches thre user's e-mail program, and puts in the variables they have entered.
The only problem I'm having is that when i put in add newline, it doesn't, but adds a sapce (found by %20 in the address bar of the new window) (you'll c)
Can anybody help me?
Here is the script btw:
on (release) {
getURL (mailto add name add "?subject=" add subject add "&body=" add "Name: " add Naam add newline add "Surname: " add Achternaam add newline add "Adress: " add Adres add newline add "Zipcode: " add Postcode add newline add "City: " add Woonplaats add newline add "Tel: " add Telefoon add newline add "Fax: " add Fax add newline add "E-mail: " add Emailadres add newline add newline add "Remarks:" add Newline add Opmerking add Newline add Newline add "Options:" add Newline add Options add Newline add Newline add "Mailtype:" add Mailtype);
}
on (release) {
gotoAndPlay ("done");
}
Newline
hello,
I am parsing data from a Flash MX form into a mailto tag. I have subject and body where the body is made up of several fields. I want each field to start on a new line but cannot get it to do so in the email (Eudora), ie,
GetURL("mailto:" add email add "?subject=Restaurant Booking&body=Restaurant: " add rest_name
add newline add "No. of People: " add number
add newline add "Booking Date: " add date
add newline add "Booking Time: " add time
add newline add "Booking Name: " add name
add newline add "Email address: " add email
add newline add "Ph number: " add phone);
I have tried
and
also to no avail.
It formats well when run using Ctrl-Enter within Flash but doesn't work when it's published and run through a browser.
Any suggestions? Is there abetter way of doing the same thing?
cheers,
Andy
Newline
hello,
I am parsing data from a Flash MX form into a mailto tag. I have subject and body where the body is made up of several fields. I want each field to start on a new line but cannot get it to do so in the email (Eudora), ie,
GetURL("mailto:" add email add "?subject=Restaurant Booking&body=Restaurant: " add rest_name
add newline add "No. of People: " add number
add newline add "Booking Date: " add date
add newline add "Booking Time: " add time
add newline add "Booking Name: " add name
add newline add "Email address: " add email
add newline add "Ph number: " add phone);
I have tried
and
also to no avail.
It formats well when run using Ctrl-Enter within Flash but doesn't work when it's published and run through a browser.
Any suggestions? Is there abetter way of doing the same thing?
cheers,
Andy
Newline
I am using actionscript to open someones mail from which they would send me info retrieved from a form that they have just filled in. It all works good apart from the fact that all the info is jumbled together ie I can't get each piece of information to be on a separate line using 'newline'. The code is below...any ideas?
on (press) {
getURL(mailto add name add "?subject=" add subject add "&body=" add "Name: " add name add newline add "Surname: " add surname add newline add "Address: " add Address add newline add "City: " add city add newline add "Tel: " add Telephone add newline add "Fax: " add Fax add newline add "E-mail: " add Email);
}
Newline...?
Ok...does the command newline actually work in MX? really, cause It seems ignore completelly its existence
what happens is that the file is supposed to generate a text that adds the contents of several input textfields
When I put + newline + between each variable name, it does send the text in the fields, but ignores newline
just to make sure, I even added + newline inside the textfield variable, and still...
to illustrate better, here it goes part of it
code:
incluir_excluir1 = "Que assuntos podem ser incluídos e/ou excluídos neste Curso? "+incluir_excluir+newline;
sugestoes1 = "Apresente suas sugestões e/ou comentários para o aperfeiçoamento do Curso de Direção Defensiva: "+sugestoes;
body =incluir_excluir1+newline+sugestoes1;
Am I using newline wrong, is there another way to do it or is my computer really adquiring Artificial Intelligence and decided to try to make me insane as part of its evil plot to control the Earth?
Newline
how do i create a newline when i post an E-mail in flash?
I've got this:
getURL("mailto:adress?subject=" + company + "&body=" + name + newline + surname + newline + function + ... );
Newline
I usually use HTML tags to format external text but since I`m using XML this time I can`t use tags so I wanted to format text using "
"
to create breaks! But
is shown within the text and no break (newline) is created! What is the catch?
Newline
hello. im using flash effects downloaded from fk. i want to know how can i break a line of text, without using newline. i tried
but didnt work.
tnxs
Newline?
Alright i have a textbox that is sort of like a console that displays stuff that happened. like if i press "cool" then it plays a thing called cool and at the end of the movie theres a keyframe with
Code:
_level0.instance4.text += "fip=false";
i need it it so everytime the action plays, it adds a newline to text box with whatever it is..
so instead of in the textbox
Code:
"fip=falsefip=truebuttonhasbeenpress"
it will be
Code:
"fip=false
fip=true
buttonhasbeenpress"
so instead of
Add 'newline', '
' With Php
I need to append a 'newline' onto the end of a string sent to flash. I send data from flash to the php using post, then I append '
' onto the end of the data sent from flash, then I send it to a txt file. The contents of the file are then read into another flash doc, but I want to add a new line between the data. However my method does not work, because in flash it just displays the '
' as part of the string. Any thoughts as to how to fix this? THANKS
HERE IS MY PHP FILE:
PHP Code:
<?php
$sendText = $_POST['sendText'];
$sText = $sendText . '
';
$open = fopen('text.txt', 'a');
$write = fwrite($open, $sText);
if($write) {
echo "&verify=success&";
}
else {
echo "&verify=fail&";
}
?>
Xml Newline
Hi
I have a small xml-file that is inserted in some flash-site. Is it possible to divide that text over severeal lines with some kind of newline-command in the xml.
thanx in advance
scarlac
Newline Problems
basically i have chat thing.
in the fisrt scene i ask for the users name (variable is name)
then in the next scene i have the area to write a comment or what not. (variable is comment)
then i have an add button. after it is click it adds the text to a large window with the other comments in them (varible is done) this is my script
done = done + newline + "[" + name + comment + "]"
what i want to happen in this
[name comment]
but instead it does
[name
comment]
it does this no matter where i place the newline command
can anyone tell me what i am doing wrong
Building Txt With Newline
i want in a text field to write to each line something else!
is it possible to access eac line say with :
myTextField.line[1]="bla blo";
if not what else can i do?is there a possibility to access line and letters in each line?
is there a way to build a string that when i i replace a space with "newline" or something like that it will show :
"abc def"
and after it
"abc
def"
is this possible?then how?
thanks
Peleg
+newline + In An External TXT
Hi, I am loading in an external txt file using _root.loadVariables("text/content_english.txt");
is there any way I can put the line brake in the string in the text file, for example;
&Compliant_body_txt= Hello +newline + world
Thanks in advance!
Kaan.
Newline In HTML
Have a niggly problem can ayone help please
I reading an external html text file and displaying the
formatted text in a dynamically created text field (createTextField).
My problem is that carriage returns are not working.
below is an example:
This works fine-used on a dynamic text field on stage with html option on.
Code:
TEST.htmlText="<p><b>line one</b>
</p><p>line two</p>"
This does not and I cant figure why...
Code:
this.createTextField("my_txt", 1, 100, 100, 300, 100);
my_txt.html = true;
my_txt.htmlText="<p><b>line one</b>
</p><p>line two</p>"
I know that I could put in "/n"
Any help Greatly appreciated
Newline Command Ignored
I have the following actionscript;
_root.getURL(mailto add "?subject=" add subject add "&body=" add "Name: " add Name add newline add "E-mail: " add ViewerEmail add newline add newline add "Comments:" add newline add Comments add newline add newline);
It produces an email from data in the flash form. When I export the swf the newline operator works fine, but when I embed the swf in the main swf the newline characters are ignored and the data all comes out on one line. Does anyone know why this is and what the fix might be?
Cheers
mrpaully
|