Adding Info To A String
Okay, I have a string of info I am importing into Flash and need to know how to add additional info to a specific string from the XML with AS3. Does anyone know how to use RegExp? I can't seem to get it to work. I need to add a file extension, height and width to an image that lacks this info. Thanks for any help or suggestions.
David
Code from main timeline with failed RegExp code (no errors, just does not work):
ActionScript Code: import com.me.xml.*;import com.me.php.*;import fl.controls.*;import fl.data.*;var info_txt:TextArea = panel_mc.main_mc.info_txt;var episode_cb:ComboBox = panel_mc.main_mc.episode_cb;var date_txt:TextField = panel_mc.main_mc.date_txt;var view_btn:Button = panel_mc.main_mc.view_btn;var grabber:Grabber = new Grabber();var reader:RSSReader = new RSSReader();function dataGrabbed(event:Event):void{ info_txt.text = "processing xml data"; reader.addEventListener(Event.COMPLETE, rssProcessed); reader.processXML(new XML(grabber.data)); } function RegExpExample():void { var formalGreeting:String = 'img src="http://image.shopzilla.com/resize?sq=100&uid=\d{9}"';}function informalizeGreeting(str:String):String { var pattern:RegExp = new RegExp('img src="http://image.shopzilla.com/resize?sq=100&uid=\d{9}"', "gim"); return str.replace(pattern, 'img src="http://image.shopzilla.com/resize?sq=100&uid=/d{9}/.jpg" width="100" height="50"');}function rssProcessed(event:Event):void{ var episodeDP:DataProvider = new DataProvider(); for each(var item:XML in reader.episodes) { episodeDP.addItem({label:item.title}); } episode_cb.dataProvider = episodeDP; episode_cb.addEventListener(Event.CHANGE, changeSelection); episode_cb.selectedIndex = 0; updateText(); view_btn.addEventListener(MouseEvent.CLICK, viewOnline);}function viewOnline(event:MouseEvent):void{ navigateToURL(new URLRequest(reader.episodes[episode_cb.selectedIndex].link));}function changeSelection(event:Event):void{ updateText();}function updateText():void{ var date:String = reader.episodes[episode_cb.selectedIndex].pubDate; date = date.substr(0, date.length-14); info_txt.htmlText = reader.episodes[episode_cb.selectedIndex].description; date_txt.text = date; }grabber.load("grabber.php", "http://www.shopzilla.com/14G_-_feed_id--4/rss.xml");grabber.addEventListener(Event.COMPLETE, dataGrabbed);
ActionScript.org Forums > ActionScript Forums Group > ActionScript 3.0
Posted on: 04-03-2008, 08:32 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Getting String Info From Php Into Flash
Hi, I've got a form in flash that sends the information filled in the textboxes to a php which then sends out emails to the respective address' that have been filled in, the problem is that if the email is already in the database it does nothing, which is making testing it difficult as I keep having to use new emails. I've added this string to the php-
}
else
{
echo("<fail>This user has already been referred for this game</fail>");
}
}
But don't know how to reference it from my flash so the message comes up, at the moment my flash button has this actionscript on it-
on (release) {
if (!email.length || email.indexOf("@") == -1 || email.indexOf(".") == -1) {
EmailStatus = "Please enter a valid E-mail address";
} else if (!referrer.length || referrer.indexOf("@") == -1 || referrer.indexOf(".") == -1) {
EmailStatus = "Please enter a valid E-mail address";
} else if (!Name.length) {
EmailStatus = "Please Enter their name to complete the referral";
} else if (!MyName.length) {
EmailStatus = "Please enter your name to complete the referral";
} else if (!gameid == 4) {
} else {
loadVariablesNum("http://www.winability.co.uk/winability/refer/makereferral.php", "0", "POST");
EmailStatus = "Thank you for referring your friend. We have sent them this email";
}
}
Does anyone have any idea how to make this work, I've got a deadline to get it fixed and I seem to be going in circles at the moment? Any help or suggestions would really be appreciated.
Tom
Getting String Info From Php Into Flash
Hi, I've got a form in flash that sends the information filled in the textboxes to a php which then sends out emails to the respective address' that have been filled in, the problem is that if the email is already in the database it does nothing, which is making testing it difficult as I keep having to use new emails. I've added this string to the php-
}
else
{
echo("<fail>This user has already been referred for this game</fail>");
}
}
But don't know how to reference it from my flash so the message comes up, at the moment my flash button has this actionscript on it-
on (release) {
if (!email.length || email.indexOf("@") == -1 || email.indexOf(".") == -1) {
EmailStatus = "Please enter a valid E-mail address";
} else if (!referrer.length || referrer.indexOf("@") == -1 || referrer.indexOf(".") == -1) {
EmailStatus = "Please enter a valid E-mail address";
} else if (!Name.length) {
EmailStatus = "Please Enter their name to complete the referral";
} else if (!MyName.length) {
EmailStatus = "Please enter your name to complete the referral";
} else if (!gameid == 4) {
} else {
loadVariablesNum("http://www.winability.co.uk/winability/refer/makereferral.php", "0", "POST");
EmailStatus = "Thank you for referring your friend. We have sent them this email";
}
}
Does anyone have any idea how to make this work, I've got a deadline to get it fixed and I seem to be going in circles at the moment? Any help or suggestions would really be appreciated.
Tom
Passing String Info Via MovieClip?
Hello.
I'll try to explain what I'm looking for, I haven't started coding yet so have nothing to show.
I have 190 movieclips which display various types of information. When a user clicks on a movieclip, it has to tween larger but also send a string to a method. I'll probably e.currentTarget to use one function which contains a tween and I wondered if there was a quick way to pass string info in a similar way?
So, each movieclip has it's own value which can be passed to a method which will use that value. The only way I can think of so far is to have 190 functions which send the string data to the appropriate place. I'm trying to avoid that if I can.
Thank you.
Storing And Adding Info
Whats up ActionScript community I need some ideas on how to simply store info from data components and add data while a flash application is active. I am working on a custom workorder program to detail specifications of job assignments. They are alot of comboboxes, list and text input fields with info i want to save and store. I want the the ability to add customers and keep them on the harddrive and to add extra items such as manufacturers and model types on the fly while the application is active. What kinda of scripting should I look into using that is easy to store all this info. Can XML do the trick or maybe some Java or maybe another flash file ? This program will not need any online resources. I know how to retrieve info from theses components but don't know how to keep it indefinite. Thanks for any ideas.
Adding Info To A Swf Scroll Box
i was wondering how i can make a scroll box, that you can put data into AFTER the flash file is made.... with javascript or whatever.... weather.com does it all the time.
anyhelp would be great, thanks.
Adding Info The The Reference Panel
I add some new methods to the XML object.
To help my co-worker I also added some quick tips into the actionspanel xml files.
Now I want to also update the Reference panel, but I can't find the file where the info is located.
Adding User Info Into Array-how?
Hey guys- I need help on making a phone book in FMX. I have the main priciple down from a book, but it doesn't explain how to add entries. This example uses an array to call data into dynamic text boxes. Based on this principle, would I use a push function to add info into the existing array or SharedObject and getLocal(); ? I'm new to both of these methods so please go easy on me. TIA.
[F8] Html Links -reload The Page And Get Info From Query String
I need a proof of concept or a simple way if there is one of allowing authors to create INTERNAL links to pages in my flash application.
The application is a learning resource which uses a string notation such as 02030004 to navigate to that resource page. This is internal to the application.
If I can get authors to put in a html <a href="... link then set this number in the query string can I get flash to read this if it runs off of a CD rom.
Is this going to work? and can I get the query string value if it runs from the cd rom. I dont like this way personally, I dont want to reinstantiate the movie and all the variables etc it will raise all kind of bugs to my mind. But how can I do it otherwise ?
Adding More String
I am creating a program that has a Output Box . A Input Box, and a Send Button. I created a Script that allows the user to put some string into the Input Box, and once they press send, it will display on the output box. I want to have it where once they press send. They can type in some different text and instead of the different text replacing the previous text displayed in the box, it only adds on . For example
send.OnPress = function() {
outputbox.text = inputbox.text;
}
Say I typed in Hello into the inputbox.text. Then the string "Hello" will display in the output box. Now say I typed World the second time. Then the word "World" will replace "hello". I want it to instead say "Hello World" once I type in the word world the second time.
Edited: 03/14/2007 at 12:51:48 PM by numerical07
Adding Numbers To A String
How do I add a number to a string . Here is what I have
Code:
on (rollOver) {
isOver+="b"+1;
I want it to show in a variable as b1 and when you roll over it again it will show b2 . As is now it just keeps adding it like b1b21b12 or something like that .
Adding Javascript To A String?
on (release) {
var strURL = "http://207.21.247.39/html/seriespop.asp?seriesid="+id;
getURL (strURL, "_blank");
trace ("URL "+strURL);
}
I have this script to pull up a URL - how to I a [javascript: openWindow] command to this string???
I would be grateful for any suggestions!
Cheers
Adding "'s To An XML String
I have in my AS an HTML string sent from javascript.
The string in Firefox works great, but in IE the class names and other parameters loose thor "'s ... example class="test" is now class=test
so what is the easiest way to put the quotes BACK in attributes of this XHTML XML string?
Adding Spaces To A String
Hi, I have a simple question... hope you can help me...
I have a string like this: "a b". As you can see, it has a lot of space between the two letters. Now, when I assign that string to a TextField, it crops all the spaces in the middle leaving just 1 simple space like so: "a b".
What I need, is a way to put lots of spaces between two characters in a TextField. In other words, I need the TextField to show the real content of the string... does anyone knows how to do that?
Thanks
EDIT: Ok, even the forum trimmed my question... the real string has a lot of blank spaces between the letters "a" and "b", that's what I want the TextField to show...
Adding To A String Based On A Count
I have a text fields with var names line1, line2....etc
When buttons are pressed I want to add to the existing string (in the case below 'tr') of one of the text boxs dependant my lineNum variable.
i = "line"+lineCount;
i+="tr ";
I cannot get this to work when I use the lineCount to target the text box, if I just put in line1 += "tr" it works fine.
Hope someone can help
Cheers
Oll
Adding String Items In Arrays?
This is probably simple enough, just can't figure it out:
I have 4 buttons. When they are chosen they replace
newMix = [0,0,0,0]
to
newMix = ["a","b", "c","d"]
(of course some buttons may not be chosen)
what I want to happen is to ad the elements of newMix
so if someone picked a b and d, newMix = ["a","b",0,"d"] would return a value of "abd"
esentially, I'm searching for how to get rid of the commas in the array listing.
Anyone have any ideas?
Adding A Property To A Variable String
Hi there, trying to write a little code, I have it working up to the trace but I cant work out how to get the second function to work.
I want to access the following button:
'_root.mapBig.map.shanghaiButton' with a '.onRollOver' trigger, however I cant figure out how to make the sCityPath work with the .onRollOver.
function cityLoader(sCurrentCity:String):Void {
var sCurrentCityButtonName:String = sCurrentCity+"Button";
var sCityPath:String = "_root.mapBig.map."+sCurrentCityButtonName;
trace (sCityPath);
sCityPath.onRollOver = function() {
....
};
};
cityLoader("Shanghai");
Any ideas would be great.
Trouble Adding Commas To String
I'm using code I found on this site to add commas to a large number (so that a number like 1000000 appears as 1,000,000). Below is the actionscript I'm using.
When I define the variable debt as any number, the script works perfectly. But if I define debt as a variable passed to the movie from a PHP file, then the script puts the commas in the wrong places (i.e., 10,000,00). Can anyone explain to me why this would happen, and how to fix it?
var input = debt;
var inputString = input.toString();
var finalString = "$";
var count = 0;
var tempString = "";
for (var i = inputString.length-1; i>=0; i--) {
count++;
tempString += inputString.charAt(i);
if ((count%3 == 0) && (i - 1 >= 0)) {
tempString += ",";
}
}
for (var k = tempString.length; k>=0; k--) {
finalString += tempString.charAt(k);
}
return(finalString);
AS2:: Adding String Values To An Array
I'm not too sure how to go about this or if it is possible. But is it possible to add the values from a string to an array?
For example my string looks like this:
var bookmarks:String = "book1, book2, book3";
And I need to add these values to the end of an array?
Thanks for any advice or help.
Adding Commas To Turn String Into Dollars
Hi all,
I have a dynamic textfield that is bringing in a number from a txt file.
the number is displaying like this:
1853600
I want it to look like this:
$1,853,600
I can have it display as dollars in another field if that's how this gets done.
oh...How would I adjust it to deal with a number in the tens of millions?
Thanks
-Lemorris
Dynamically Adding Custom Classes Via String
I have a bunch of MC's in my library, each with custom classes, base class MovieClip.
Normally, I would add them like this:
var myMovieA:MovieClip = new CustomMCa();
var myMovieB:MovieClip = new CustomMCb();
var myMovieC:MovieClip = new CustomMCc();
...but what if the "CustomMC" needs to dynamic? i.e. perhaps based on a string variable? Other than a long switch/case or if/then checking against the string, is there any way to achieve that?
Problems Adding Methods To String Class
I'm trying to add some new methods to the built in String class. I've tried two new methods so far. One of them (entitiesConvert, which is by far the most complex) seems to work OK (at least, it doesn't give any compiler errors). The other (pad, which is just a few lines of code) doesn't. Whenever I use the new pad() method, either inside the entitiesConvert method, or elsewhere in my code, I get a "no such method" error.
My code is below. Can anyone see what's wrong with the pad() method?
Thanks - Rowan
// String pad method.
// If len is negative, pads on the left, if positive, to the right.
// Pads to length abs(len) with the first character of str.
// str defaults to " ".
String.prototype.pad = function(len:Number, str:String):String
{
var abslen:Number = Math.abs(len);
var s = abslen-this.length;
if (s <= 0) return this;
if (!str.length)
{
str = " ";
}
else
{
str = str.substring(0,1);
}
var p = "";
while (s > 0)
{
p += str;
s--;
}
if (len >= 0)
{
return (this + p);
}
else
{
return (p + this);
}
}
// Convert HTML entities into their corresponding Unicode characters
String.prototype.entitiesConvert = function():String
{
var str:String = this;
// create the entity mapping array
// which allows decoding html entities into their unicode equivalents
var aryEntities:Object = new Object();
aryEntities[" "] = "u00A0"; // non-breaking space
aryEntities["¡"] = "u00A1"; // inverted exclamation mark
aryEntities["¢"] = "u00A2"; // cent sign
aryEntities["£"] = "u00A3"; // pound sign
// Lots more entities go here...
for(var entity:String in aryEntities)
{
str = str.split(entity).join(aryEntities[entity]);
}
var strptr:Number = 0;
var begnum:Number;
var endnum:Number;
var numstr:String;
var numtyp:String;
var num:Number;
while ((begnum = str.indexOf("&#", strptr)) > -1)
{
if ((endnum = str.indexOf(";", begnum + 2)) > -1)
{
numstr = str.substring(begnum + 2, endnum);
numtyp = numstr.substring(0, 1);
if (numtyp == "x" || numtyp == "X")// Hex number.
{
if ((num = parseInt(numstr.substring(1), 16)) == NaN)// Not a valid hex number.
{
strptr = endnum + 1;
continue;
}
}
else// Decimal number.
{
if ((num = parseInt(numstr)) == NaN)// Not a valid decimal number.
{
strptr = endnum + 1;
continue;
}
}
// The first version of this line causes a "no such method" error
// str = str.substring(0, begnum) + "u" + num.toString(16).toUpperCase().pad(-4,"0") + str.substring(endnum + 1);
// The second version of this line compiles without error.
str = str.substring(0, begnum) + "u" + num.toString(16).toUpperCase() + str.substring(endnum + 1);
}
else
{
strptr = begnum + 2;
}
}
return str;
}
Adding String Data To An Expression For Evaluation
Hi, I have the following function:
Code:
getInfo = function (input, arrayData, desiredResult)
{
for (i = 0; i < arrayData.length; i++)
{
if (arrayData[i].button == input)
{
return arrayData[i].desiredResult;
}
}
};
arrayData is a multidimensional array containing objects.
What I need returned is arrayData[i].desiredResult, where desiredResult is a string passed to the function. For example:
test("dogs", theArray, "color") needs to return the evaluated value of arrayData[i].color. How can I achieve this? Thanks!
Grabbing Correct Array And Placing Adding To String
Hey yall I am trying to grab a movie clip instance which is amongst an array and attach it to a string.
I am trying this:
Code:
stateArray = new Array(AL,AK,AZ, ect....);//names of mc instances
for (var i = 0; i<stateArray.length; i++) {
stateArray[i].onRelease = function() {
getURL("/pagoso/browsestate.aspx?cat="+cat+"&state="+stateArray[i], "_self");
};//each mc onRelease will grab "cat" from string and add its respective state Array to String
}
Results in state being undefined state;
Have tried this:
Code:
stateArray[i].onRelease = function() {
getURL("/pagoso/browsestate.aspx?cat="+cat+"&state="+stateArray[0], "_self");
};
}
Resulting in:
/pagoso/browsestate.aspx?cat=8&state=_level0.AL
and if I do just stateArray it adds all the states with _level0.AL, _level0.AK ect....
How come I cant get it to just grab MC instance?
Top 5 Maker: Merging Two Arrays And Adding The Values Of Matching String Entries
Hello All,
I've searched a bit and not found any discussions regarding what I'm looking for. I'm not looking for coded answers but would rather hear opinions on best approach.
I am creating a topFive Application using custom classes.
The simplest way to describe this is that two people can enter 5 strings and two top 5 lists are made, merged and a new top 5 is displayed.
Basically, I want to compare two multi-dimensional arrays that both contain a string with a value attached to it. I want to combine these arrays, and while doing so when a common string is found, I need it to add the two values and remove the two duplicates. (i'll get into an example below).
currently, multiple users (1 & 2 for now), can enter a string and a value is given to it. The strings are then made into a displayed list (outputting the multi-dimensional array into a text box "String:Value"). I plan on merging these two muli-dimensional arrays, and sorting by Value of the entry. When a duplicate entry is found, the values are added together and one entry is made with the new value and the other two entries are discarded.
I need advice on three steps:
1. Merging two MD arrays with a string and a value in each.
2. Finding duplicates by comparing the strings.
3. merging the duplicates and adding their value (creating a new entry and deleting the other two)?
Currently this is whats going on:
User 1 --->makes 5 string(str) entries ----->descending (nameValue) value added to each entry ------> entry and value make an array called u1_names. That is entered into a nameEntryClass that holds s:String and v:value
ActionScript Code:
u1_names.push(new nameEntry(str, nameValue));
trace in the app outputs User1 entries like this;
ActionScript Code:
trace(cmi.u1_names);
User1 entry 1:5,
User1 entry 2:4,
User1 entry 3:3,
User1 entry 4:2,
User1 entry 5:1
(This would be repeated for User 2)
Now before I collect the data from User 2 I want to know the best way about doing this.
So I need the App to merge, compare, add and delete redundant entries (see three steps above) from User 1 and User 2.
Is this possible?
Can anyone point me in the direction of a tutorial or a key word (I found recursive trace post in AS2 that looked close to what I'd need) that I could find more information regarding any of this..
Thanks in advance,
Info Needed On Passing Info To SQL DB
I'm trying to write a Flash message board, and would like to know how to get Flash 5 to chat to a SQL Database.
I understand this needs to be done via ASP, not a problem, but how do I pass the variables to the ASP page for storage?
I've seen mention of loadVariables, but would like to know exactly how this communicates to the ASP page.
Many thanks
Wydget.
Error 2101: The String Passed To UrlVariables.decode() Must Be Url-encoded Query String
I am trying to make a flash contact form which will submit the firstname, lastname, email and comments to an asp.net page.
I am have having the following error:
Error #2101: The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs
I am using the following action script code as pasted below. This action script is communicating with an asp.net file to send the email out. In the end it responds back with response=passed or failed.
I have already spent around 3 hours figuring it out.. and looking through the internet for resolution but no luck. Any help will be appreciated.
stop();
submit_btn.addEventListener(MouseEvent.CLICK, submit);
function submit(e:MouseEvent):void
{
var variables:URLVariables = new URLVariables();
variables.firstname = firstname_txt.text;
variables.lastname = lastname_txt.text;
variables.email = email_txt.text;
variables.comments2 = comments_txt.text;
var req:URLRequest = new URLRequest(”emailacount.aspx”);
req.method = URLRequestMethod.POST;
req.data = variables;
var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.addEventListener(Event.COMPLETE, sent);
loader.addEventListener(IOErrorEvent.IO_ERROR, error);
loader.load(req);
status_txt.text = “Sending…”;
}
function sent(e:Event):void
{
status_txt.text = “Your email has been sent.”;
firstname_txt.text = “”;
lastname_txt.text = “”;
email_txt.text = “”;
comments_txt.text = “”;
}
function error(e:IOErrorEvent):void
{
status_txt.text = “There was an error. Please try again later.”;
}
and the following asp.net code:
<%@ Page Language="VB" %>
<%@ Import Namespace="System.Net.Mail" %>
<script language="VB" runat="server">
Sub Page_Load(Sender As Object, E As EventArgs)
Try
Dim fromEmailAddress = "paul@lancierinc.com"
Dim toEmailAddress = "rizwandar@gmail.com"
Dim firstName = Request.QueryString("firstname_txt")
Dim lastName = Request.QueryString("lastname_txt")
Dim comments = Request.QueryString("comments_txt")
Dim userEmail = Request.QueryString("email_txt")
'create the mail message
Dim mail As New MailMessage()
'set the addresses
mail.From = New MailAddress(fromEmailAddress)
mail.To.Add(toEmailAddress)
'set the content
mail.Subject = "Email from" & firstName & " " & lastName
mail.IsBodyHtml = True
Dim strBody As String = "<b>Email from</b>" & " " & firstName & " " & lastName & "<br><b>Email Address:</b> " & userEmail & "<br><b>Comments:</b> " & comments
mail.Body = strBody
'send the message
Dim smtp As New SmtpClient("mail.lancierinc.com")
smtp.Send(mail)
Dim urltoencodestring2 = "response=passed&err=0"
'Response.Write(urltoencodestring2)
Catch smtpEx As SmtpException
'A problem occurred when sending the email message
'ClientScript.RegisterStartupScript(Me.GetType(), "OhCrap", String.Format("alert('There was a problem in sending the email: {0}');", smtpEx.Message.Replace("'", "'")), True)
Response.Write(smtpEx.Message)
Dim urltoencodestring = "response=failed&err=1"
'Response.Write(urltoencodestring)
Catch generalEx As Exception
'Some other problem occurred
'ClientScript.RegisterStartupScript(Me.GetType(), "OhCrap", String.Format("alert('There was a general problem: {0}');", generalEx.Message.Replace("'", "'")), True)
Dim urltoencodestring3 = "response=failed&err=1"
'Response.Write(urltoencodestring3)
End Try
End Sub
</script>
String Passed To URLVariables.decode() Must Be A URL-encoded Query String...
I really don't understand why this won't work? I've made a test which sends some POST data to a script on my page which works fine. But why does not this work?
Code:
var mapsize = _cmap.fieldx.toString(16) + _cmap.fieldy.toString(16);
var names = "Zomis_AI6";
var description = "descr";
var result = "gameresult";
var upldata: String = "mapsize="+mapsize+"&names="+names+"&description="+description+"&result="+result;
trace(upldata);
var variables:URLVariables = new URLVariables(upldata);
var request2:URLRequest = new URLRequest();
request2.url = "http://www.zomis.net/record.php";
request2.method = URLRequestMethod.POST;
request2.data = variables;
var loader2:URLLoader = new URLLoader();
loader2.dataFormat = URLLoaderDataFormat.VARIABLES;
loader2.addEventListener(Event.COMPLETE, uploadcomplete);
try {
loader2.load(request2);
trace("Loaded");
}
catch (error:Error) {
trace("Unable to load URL");
}
Tracing gets:
Code:
mapsize=1010&names=Zomis_AI6&description=descr&result=gameresult
Loaded
Error: Error #2101: The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs.
at Error$/throwError()
at flash.net::URLVariables/decode()
at flash.net::URLVariables$iinit()
at flash.net::URLLoader/flash.net:URLLoader::onComplete()
Randomize String And Create Textfields With String Txts
Hi,
is there some easy method to randomize elements of an array (to randomize index numbers) and create textfields with name of these elements ?
I had no problem making a photo gallery with strings but now I have to do a menu , with spacing (there should be same space between all the words of an array generated textfields)...How can this be accomplished ?Thanx in advance, Meerah
Convert Multiline String To A One Line String With RegExp
better get my own thread for that
How can I convert a multiline String to a one line String?
EX:
PHP Code:
Testing is always full of man made bugs.
<a href="http://www.betterthannothing.com" title="betterthannothing" target="_blank">
<font color="#22229C">Believe</font>
</a>
me when times comes that you have to
<a href="http://www.vreate.com" target="_blank">create</a>
useless stuff to test some other useless stuff to have
<a href="http://www.vreate.com">some</a>
real results.. its a pain.
<img src="http://www.markval.com/deerPack.jpg" height="484" width="352"/>
<em>Got to try that stuff to eventually love it one day.</em>
and should result in
Code:
Testing is always full of man made bugs.<a href="http://www.betterthannothing.com" title="betterthannothing" target="_blank"> <font color="#22229C">Believe</font></a>me when times comes that you have to<a href="http://www.vreate.com" target="_blank">create</a>useless stuff to test some other useless stuff to have<a href="http://www.vreate.com">some</a>real results.. its a pain.<img src="http://www.markval.com/deerPack.jpg" height="484" width="352"/><em>Got to try that stuff to eventually love it one day.</em>
I think it have to play with the ^ (caret) and m (multiline) ... just need to put the puzzle together.
String.as (Fishing Line Or Kite String)
Hello everyone. After reading the article on Glen Rhodes (Proud Canadian) I was wondering exactly how to insert the string.as file. I have been having huuuuuuge speed issues with my code. My file sizes are quite small (40 - 60 k)but they are very sluggish.
Thank you......
Please help
http://www.moodvibe.com
Trouble With String.indexOf And String.lastIndexOf
Hi,
I have an input text field used for time. I'm trying to set it up so the user has to enter a valid time into the box.
I set the box to be only 5 characters in length and to only use numbers and the ":" character.
I thought this code would insure there wouldn't be two ":" characters and the ":" would be at lease one character from the begining and at least two from the end.
But the if you enter 2:321 it comes back as a valid time.
Thanks in advance,
thurston
Code:
if(string.indexOf(":", 1) == string.lastIndexOf(":", string.length-3) ){
trace("Valid Time");
}else{
trace("Invalid Time!!!");
}
Changing A String Name In A Loop / Concatonating String Name?
Hey all,
Does anybody know of a way to change a string name as a loop proceeds?
This is the main piece of code that I wish to loop with i incrementing, so that whilst i=0 then:
_root.barARed._visible=barRed[i];
_root.barARed._width=barLength[i];
_root.barAYellow._visible=barYellow[i];
_root.barAYellow._width=barLength[i];
_root.barAGreen._visible=barGreen[i];
_root.barAGreen._width=barLength[i];
infoA.text=info[i];
and i=2 then:
_root.barBRed._visible=barRed[i];
_root.barBRed._width=barLength[i];
_root.barBYellow._visible=barYellow[i];
_root.barBYellow._width=barLength[i];
_root.barBGreen._visible=barGreen[i];
_root.barBGreen._width=barLength[i];
infoB.text=info[i];
and so on...I would use _root.barRedInstanceName[i]._visible=barRed[i]; but I can't give the movie clip (the bar) an instance name such as redBar[1], redBar[2] etc. (system reserved I'm told)
I guess what I am trying to ask in a roundabout way: is how do you concatonate the name, rather than the contents of a string?
Hope you'll forgive me if this is something really simple that I am overlooking, but I only have a very short experience of flash.
Thanks
Al
Ball Bouncing On String: Getting The String To Be Bigger?
I have a black line which is simply a movie clip and a yellow circle which is also a movie script. The ball works great, it bounces on the bottom of the movie, and you can pick it up and throw it around. So now I want to attach the ball to the black line. So:
1. How can I make it so that the top part of the line will stay in one position, and so that a bottom part of it will move around? Is there any way I can link the two at a certain point so that wherever the ball goes the line will stay attached to it at that point?
2. In an attempt to try and reach this point I came up with this script in the ball for when it is not being dragged anywhere. The most important bit is really the bottom:
ActionScript Code:
} else {
old.x = pos.x;
old.y = pos.y;
pos.x = _x;
pos.y = _y;
vel.x = (pos.x-old.x)*2;
vel.y = (pos.y-old.y)*2;
//Finds the change in position and adds that as an extention to the line:
_root.ballstring.height += (old.y - pos.y);
Anyone reckon they could help me out? Thanks!
Keeping A String A String With Dynamic Text
I've got some dynamic text (from MYSQL & ColdFusion) that needs to be kept as a string and is (i think) being converted into a number.
The recordset is returning 8'6" (eight feet, six inches)
and my dyn text box displays 86.
Anyway around this from within Flash? I know you can strict data type in AS 2.0 but no chance of migrating this project to 2.0!
What's The Best Way To Parse Out A Url String Using The String Object In Flash
I'm creating a CMS(Content Management System) tool so that users can change text and the changes be reflected in a text window in flash . The text that the user enters in the CMS tool will be stored in the database.
In flash I want to parse the string that I get from the database and look for URL strings that start with http "http://www.someurl.com" and parse out that substring.
For example the string could be "Please vist my site at http://www.site.com". I would want to parse out the http://www.site.com
If I find this url string I want to pre-pend the a href tag <a> and append the closing </a> tag to the string so that this link will be clickable from the textfield.
Does flash have an object that deals with Regular Expressions?
I've looked at the String object in flash but not sure how to achieve this task
I'm currently working on this so any ideas?
Convert Html String To Xhtml String
Anyone know of a great way to convert an html string format from flash into a resembalnce of xhtml for outputing to a server or a direction i could go in to do this.
Thanks
Randomize String And Create Textfields With String
Hi,
is there some easy method to randomize elements of an array (to randomize index numbers) and create textfields with name of these elements ?
I had no problem making a photo gallery with strings but now I have to do a menu , with spacing (there should be same space between all the words of an array generated textfields)...How can this be accomplished ?Thanx in advance, Meerah
Pass A String, Return Object With Name String
I feel like this should be pretty easy, but I 'm not quite sure how to do this...
I've got a string that is the name of a movieclip which is on the stage. I'd like to write a function which I can pass that string and have it return the object which has the instance name of that string.
Any hints?
Thanks.
John
What's The Best Way To Parse Out A Url String Using The String Object In Flash
I'm creating a CMS(Content Management System) tool so that users can change text and the changes be reflected in a text window in flash . The text that the user enters in the CMS tool will be stored in the database.
In flash I want to parse the string that I get from the database and look for URL strings that start with http "http://www.someurl.com" and parse out that substring.
For example the string could be "Please vist my site at http://www.site.com". I would want to parse out the http://www.site.com
If I find this url string I want to pre-pend the a href tag <a> and append the closing </a> tag to the string so that this link will be clickable from the textfield.
Does flash have an object that deals with Regular Expressions?
I've looked at the String object in flash but not sure how to achieve this task
I'm currently working on this so any ideas?
Convert Html String To Xhtml String
Anyone know of a great way to convert an html string format from flash into a resembalnce of xhtml for outputing to a server or a direction i could go in to do this.
Thanks
Randomize String And Create Textfields With String
Hi,
is there some easy method to randomize elements of an array (to randomize index numbers) and create textfields with name of these elements ?
I had no problem making a photo gallery with strings but now I have to do a menu , with spacing (there should be same space between all the words of an array generated textfields)...How can this be accomplished ?Thanx in advance, Meerah
Complex String.split And String.substring
Hey, Im an actionscript newbie and am having a little tourble with a string.
I have a string variable containing the value:
myString = "Johnny Lewis, Danny Lopez, Alex Prince, Sandro Lee, Nick Salvage"
What I want to do is trim their last name so it only shows their first initial, so it would be converted to:
myStringTrimmed = "Johnny L, Danny L, Alex P, Sandro L, Nick S"
So im guessing I need to split it by the commas, then split those again by the blank space.
The only problem is that this variable will be dynamic and the number of people in the variable will always be different. Sometimes there will only be one name, sometimes as many as five.
Any help would be much appreciated.
String = String + If(string.length) ... + String
A few languages have an IIf() statement, which works like the if statement, but is good for use inside of strings.
Flash 8 apparently doesn't have it, but I tried something similar to this..
Code:
_global.mStruct.mString = "My first name is " +
mf.text + if(mi.text.length > 0) { ". My middle initial is " + mi.text} +
". My last name is " + ml.text + "."
And I get
"Operator '+' must be followed by an operand", referring to the red + above.
Is there a way to do this, or do I need to just break into seperate if statements and appending the value to the value of the textbox?
Thanks for any help.
String Manipulation : Pad A String.length
hi,
i have an array of track/artist titles
_level0.trkList = [object #218, class 'Array'] [
0:[object #219, class 'Object'] {
label:"Jeff Beck - Space for the Papa",
data:"spacepapa.mp3",
__ID__:0
},
1:[object #220, class 'Object'] {
label:"Jeff Beck - Another Place",
data:"anotherplace.mp3",
__ID__:1
},
i wish to add the array to a track info listbox component,
in such a way that the individual items in the array are
padded with spaces -" ", so as the length of the shortest
string equals the length of the longest string,
my listbox output is now -
Jeff Beck - Space for the Papa| * from time array
Jeff Beck - Another Place| * from time array
by adding spaces i would like it to be-
Jeff Beck - Space for the Papa| * from time array
Jeff Beck - Another Place"""""""| * from time array
does anyone know how to do this ?
many thanks for any help,
LoadMovie - Target String Or Not String?
I'm trying to figure out what the major differences and/or uses for using a target as a string with double quotes or without quotes...
For example whats the difference between the following 2 lines?
1. loadMovie("products.swf",_root.dropZone);
2. loadMovie("products.swf","_root.dropZone");
I know the target in the second line is a string and the target in the first line is a MC object(?). Any other major uses for these 2 variations?
Can Trace String But Cannot Set String To Variable
Hi,
I am importing a some text values from a text file and then trying to pass this value via a function
I can TRACE the text value successfully but cannot set it to a variable.
************************************************** **************
function test(){
var aTestVariable
myData = new LoadVars()
myData.load("thenews.html")
myData.onLoad= function(success){
if(success){
trace(myData.Title); //THIS WORKS
aTestVariable = (myData.Title);
}
}
return aTestVariable
}
function testFunction() {
trace(test()); //THIS DOES NOT WORK!
}
************************************************** **************
Can someone please tell me what is wrong with this:
trace(myData.Title); //THIS WORKS
aTestVariable = (myData.Title);
HELP!
Rich
Trouble Finding A String Is A String
I'm trying to find a certain string I provide in another string, I know that in JavaScript you can use indexOf to find it:
myString = "hello world";
findString = "world";
if(myString.indexOf(findString) >= 0) {
alert("found");
}
I tried that in flash (replacing alert with trace) and it doesn't work
can anyone help???
|