Why Does This String Not Work?
Hello,
If I delcare This variable in flash: myString="Todays Company,Tommorrow's Company,American's Comapany,bigtest,tom,Hello,Today,Wee";
>>The Below code works fine!!!
autoEntries=myString.split(","); trace (autoEntries[1]);
But if I Pass the variable into the movie like: myString=Todays Company,Tommorrow's Company,American's Comapany,bigtest,tom,Hello,Today,Wee&Loaded=True
The code does not work, I have the Loaded = True to make sure it is loaded with code in flash so, I know the varaible is being loaded into flash. I am doing all of this on _root
Please give me any ideas of why this is not working!!!! Thanks!!
FlashKit > Flash Help > Flash ActionScript
Posted on: 05-03-2002, 09:01 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Can't Get String.slice To Work Right
I'm just doing this simple test to try and get an array made of individual letters from what once used to be a whole word, i.e:
Code:
onClipEvent(load){
test = new String("work")
var chopped = test.split("");
trace(chopped[])
}
according to Flash help if you have an empty string as the delimiter it puts each character into its own element, but this wont work for me. Whenever it's traced all I get is 'work' rather than the expected 'o'.
Anyonw know why I am FAILING
String Names? How Can I Get This To Work?...
i want to set variables named word1, word2 ect in first frame, then later i want to have a text box and be able to get the word2 and stuff to show by saying
text=word add i then have i be a number so if i was 1 i could get word1, which lets say in the first frame word1="hello";
anyone know how to do this? and do you get what im saying?
How To Make '<' Work In A String?
I want to be able to put "<img src='" in a strong, so that I can add a url and so forth later on... when I put in the '<' character, it doesn't work. Any suggestions?
Update String Won't Work
Hi guys,
I have a problem with updating my database in flash remoting mx. Whenever i try to update the table using a new value, the error below is thrown:
Operation must use an updateable query
Below's my code for updating the table called "poll.mdb". It is written in asp.net with VB.NET:
Code:
Dim dbConn as OleDbConnection
Dim sqlStr as String
Dim objCmd as OleDbCommand
dbConn = new OleDbConnection( _
"Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=" _
& Server.Mappath("poll.mdb"))
sqlStr = "UPDATE tblPoll " _
& "SET votes = '" & lblVote.Text & "'" _
& " WHERE name = '" & lblName.Text & "'"
objCmd = New OleDbCommand(sqlStr, dbConn)
objCmd.Connection.Open()
objCmd.ExecuteNonQuery()
flash.Result = sqlStr
objCmd.Connection.close()
The strange thing is that when I try to run the same code in asp.net(the web server that I'm using with flash remoting mx), it works! I've tried to substitute the new values with some hard-coded values but they didn't work either. I've also tried to modify the sql string by using the 'Insert' and 'Delete' query instead but the same error is thrown. Has any1 encountered the same problem b4 and knows how to solve it? Any help is greatly appreciated.
Function Call From String (cannot Get It To Work)
I have got this small problem. For example I ve got the following code:
function test()
{
trace("it works");
}
y = "test()"; // y is a string containing the name of the test() function
Now I want to call the function test from the string y.
test(); //does work
eval(y); //does not work
x = test();
x; //does work
How can I call the function test() from the string y???
Thank you in advance,
GD
How To Work With Query String Or Flashvar Using Xml
Hi everyone,
I am trying to get variable from explorer bar query string method and load into flash. Then load selected node from xml file.
For example:
ratingsystem.html?skuid=400
if skuid=400 it will load only that selected node and display rating and link in a text box.
<?xml version='1.0' encoding='UTF-8'?>
<myrating>
<item skuid="200">
<rating>5</rating>
<links>10</links>
</item>
<item skuid="400">
<rating>3</rating>
<links>20</links>
</item>
</myrating>
Can please someone post flash action script here to get this working?
Thanks in advance.
TechM
How To Work With A String Named Object?
...so, I have the following code
for (i=1; i<=n; i++) {
duplicateMovieClip(_root.object, "object"+i, i);
//how can I choose the position of the new MovieClip?
//"object"+i_x = random(100) - this should work if I had a different name of variable, but in this case it doesn't.
//set("object"+i_x, random(300)); - this doesn't work neither
}
String Panel - How To Make It Work?
Hallo,
I'm playing with the string panel, but can't get it to work.
I have a loader.swf 6,0,79,0, loading this file 2languages.swf on level 2.
How do I have to export? 2languages in 7/2.0? There's a checkbox in the panel (Add actionscript to check language?), but once exported I can't see where the code is.
Should I export the loader too in 7-2?
ty very much
m.
Setting A Var. From A HTML String... Doesn't Work :((
Hi,
I am trying to get some variables from html.Here is the tutorial, I am following;
Macromedia tutorial
But I can't see the variables in the movie.
Do I have to add some actionscript to the main timeline or where ever?
Dynamic text box is on the main timeline in frame200 and I didn't forget to give it a Var name, "text".
What am I doing wrong?
Please help, thanks for your time.
GetUrl And A Query String Wont Work Together
hi people,
i am making a menu where it uses a gotoAndPlay action to go to a certain position in the menu, it uses a query string passed into the movie to get that position,
this works fine until i insert a getUrl script into the menu and it wont go to the position when the movie loads even though it def sees the viarable passed by the html,
any help would great
thanks
shaun
String Replace Via Actionscript, Doesn't Work...
Since there is no built-in string replace function for flash and actionscript, so I did the user defined function to take care of that. The user defined function is what I found from the the google search.
Code:
function strReplace(thisStr,what,byWhat) {
while (thisStr.indexOf(what)>-1) {
var tmp = thisStr.split(what);
thisStr = tmp.join(byWhat);
}
return (thisStr);
}
It was working great until it goes into an infinite loop when the parameters was used in strReplace() function like this...
Code:
test = strReplace(strData,"McDonald","<a href='blah blah'>McDonald</a>");
Then I found that in the function code above which showed that the loop that never reached the end of the string as it would start a new loop again once it is finished. So, I did a different function instead..
Code:
function strReplace(thisStr,what,byWhat){
var counter=0;
while (counter<thisStr.length) {
var startPos = thisStr.indexOf(what, counter);
if (startPos == -1) {
break;
} else {
var before=thisStr.substr(0,startPos)
var after=thisStr.substr(startPos+what.length,thisStr.length)
thisStr=before+byWhat+after
var counter=before.length+replace.length
}
}
return thisStr;
}
So, I tried it again and it still go into an infiinite loop. So, what did I do wrong? Need someone with a fresh eyes to see the codes...
Thanks,
FletchSOD
Function Menu(variable:string):void - Dosent Work
What am i trying to do?
i have 4 buttons, and all are animated, onRollOver, onRollOut, onPress..
So have created this function that i call from each button and set the value of variables that i use...
i have this code on level0
ActionScript Code:
var menuNo = (0);
gumb;
function menuTest(gumb:String):Void {
if (menuNo == 0) //if no button have been pressed before
{
trace(gumb);
this.gumb.gotoAndPlay("press");
delete this.onEnterFrame;
trace("ok");
}//added this, thought was not the case!
};//the code is only for 1 button
then i have a code like this on a button the button instance name is 'web_1';
ActionScript Code:
on(rollOver){this.gotoAndPlay("over");}
on(rollOut){this.gotoAndPlay("out");}
on(press){
_root.gumb = "web_1";
_root.menuTest(_root.gumb);
}
on the time line of 'web_1'; i have on frame X when is reached, after the button is pressed, the code like this
ActionScript Code:
_level0.menuNo = (1);//so with this, i know whitc button have been pressed last
its strange...cos trace is ok but the button wont start to play keyframe "press"
String.fromCharCode(thisString.split(",")); Won't Work
Hi All!
I'm new here and stuck on this bit of code:
mytest = String.fromCharCode(thisString.split(","));
thisString is a lengthy batch of numbers coming from dynamic text via loadVars.
Tried many variations but can't seem to pass a group of numbers as a single parameter to String.fromCharCode. Clue me in, please.
Thx,
Tom
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???
Can't Pass String To Nc.connect(string)
hey guys. fairly new to flash, but I've managed to throw together a player with info and tutorials from here and other places. I've got everything just how I want it save for one problem. I've got an XML file that I get the URL for my server from and also get the names of videos to populate a list. Here's the problem:
I can get the URL into a string in my program (it traces fine). However, when i try to pass that string in my nc.connect(string) it doesn't work. Everything loads fine, but when you click a video, it can't connect to it. If I manually enter the URL into the connect field like this: nc.connect("rtmp://url") it works fine.
So am I missing something? Why can it take the URL manually entered and not from a string?
Find A String In A String Chaine
Hi, I need a function that detects if a string was found inside another string:
here's an example:
string1 = "ABC"
string2 = "FGABCJHG"
in this case, the function would return true...
any ideas on how to make this? i m being lazy, i could try to do it by myself but sometimes this kind of functions were already made by someone and they are in internet or whatever.
thanks!
Need To Parse String But Not Literal String...
Once again I have run into something....
Here is the start of the code:
CODEvar target = this.onStage.allNotesOnStage.easyArray
var randomNum = Math.floor(Math.random() * (max - min + 1)) + min;
var showNote = target[randomNum];
Remove String (string Var - String Var )
hi guys ,
i need to remove a string to an other string
here a simple example
ActionScript Code:
var test1 = "test.allo255"
var test2 = "test.allo"
trace(test1)
trace(test2)
trace(eval(test1-test2))
i need to catch the number at the end
or remove the string part
(or even just a part , like if i can remove "test." and hang up with "allo255" its ok too)
here what i got ,
my output is
ActionScript Code:
_level0.my_sp.spContentHolder.img_mc5
i need to grab only "img_mc5" or only the # "5"
plz and a big tnx in advance
Save Object To String -> Load String And Convert Back To Object?
Wondering if anyone knows if this is possible. First a little explanation:
1. I have container grid where you can add and position MC's
2. The MC's x,y and other data is stored in a 3d object
3. The object is setup like this: matrix (object) -> levels (objects) -> profiles (objects). So basically a grid which mirrors what you see on screen.
This all works great; however, the application needs to have a save feature. My first thought was decode the matrix into an XML and save that.
Then I thought maybe you can just convert the matrix object to one big string and save that.
Questions: when the string is loaded back into the movie how do you (or can you even) covert it back in a object that flash can read?
Any help/input is greatly appreciated.
Problem On Eval ( String) , String Is "myArray[1]"
I have an array like this:
myArray = ["a", "b"]
I have a function with argument y like this:
x = eval (y + "[0]")
if I call the function with y="myArray"
I am expecting "a", but get nothing.
what is wrong here?
Number Or String => String
Hello people,
I have a function wich gets a number, this could be like 12.5(=number) or like "12.4"(=string).
I want the variable always to be a string;
function to_string(a_getal) {
// This is where the code should be
// if (a_number = [a number]) {
// a_number = string(a_number)
// }
trace(a_number.length); // This won't work if it's a number
trace(a_number);
}
to_string(12.4);
to_string("12.4");
Please, help!
Mzzl, Chris
Finding A String Within A String
Is there a simple way to find whether a string contains a string?
I'm looping through some xml and I want to have a search that finds whether the "description" attribute at each node contains the searched for term.
I'd like to do this without having to split the whole description at white spaces and turn the words into array elements. I thought there was some way to test whether a string occurred within a string....
Search String For String
Is it possible to search a string of text for a particular word?
I thought i could use indexOf() but it's not doing what i thought it would.
i am building a chat app and would like to incorperate some effects like quick alpha fades, elastic effect on the chat app when a word is found in the msg sent.
I have the effects in place just trying to figure out how to trigger them.
Effects:
(flasher)
(squiggy)
(happy snapping)
Thanks
Paul
[CS3] Cut A Piece Of A String Into Another String...
Hi people!
What's wrong with this code??
Code:
function Kopie():void {
var tmp2:String = get text(Textbox)
var tmp:String = new String()
tmp = tmp2.Substr(1,1)
}
With "Textbox" being a dynamic textfield...
Cheers, Jasper
|