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








String Length Of A String


how do I type like

set X = strlen(myvar);

to get how many characters are in it




ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 03-10-2007, 03:04 AM


View Complete Forum Thread with Replies

Sponsored Links:

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,

View Replies !    View Related
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.

View Replies !    View Related
String Length
Does anybody know the maximum length of a string? If there is one, are there any ways of getting around it?

View Replies !    View Related
String Length Limit?
I'm using remoting to connect to a server and request data. It works great with small result strings, and I've gotten one at a length of 65479. But anything bigger (my next result size is: 65882) and it craps out and just returns a single, seemingly random, character. It looks like another instance of the infamous 65k limit. Although, using a simple loop, I've created a 100k string. So I know Flash can handle it. Maybe it's just the remoting that can't. Is there a way around this? Anyone with ideas that might help?

View Replies !    View Related
Getting Xml Array.length Using A String
Hi all,

I'm trying to pull the length of an array using a string with a variable. If I replace the variable with the value of it, I get my number. However, if I just use the variable, I just get the string. Perhaps I need to convert the string somehow?

this.loadXML("XML_loads/options1.xml", "list1");
function loadXML(path:String, objName) {
this[objName] = new XML();
this[objName].ignoreWhite = true;
this[objName].onLoad = function(success:Boolean) {
// When the data arrives, pass it to the menu.
if (success) {
//trace("list1 = "+list1);
olength = objName+".firstChild.childNodes.length";
trace("olength = "+olength);
} else {
trace("xml failed to load");
}
};
//insert path to the xml file for the menu
this[objName].load(path);
}

View Replies !    View Related
String.length() & Mp3s
Hi,

Im building an mp3 player to be used with Flash Comm 1.5, and Im looking to display the time (current/total) of the mp3. I would also like to use this information to adance frames (ie: if current time = total time).

Im using the following code so far, I can get the mp3 to load and stream:


ActionScript Code:
#include "NetDebug.as"
stop();
connection_nc = new NetConnection();
connection_nc.connect("rtmp:/player/defstream");
A_ns = new NetStream(connection_nc);
speakers.attachAudio(A_ns);
A_ns.play("mp3:1");

Ive read I can obtain the mp3 length, in seconds, using the Stream.length() method but Ive also read this can only be used when streaming .flvs.

If someone could provide some further info/clarification I would greatly appreciate it.

thanks!

View Replies !    View Related
String.Length Methods
Hi all,

Im trying to make a movie clip detect a mouse hit, which I have done, but after the mouse has been hit, I want an object that has been made invisible to be placed into this area. The problem is that there are multiple instances of this clip. In theory one of the movie clips is selected then an object should be made visible.

I have been told that I could take a word length of the instance names of the movie symbol (which are all the same length) and use this in the IF statment in the movie clip.

Just wondered if anyone had any hints or tips, or places that I might find useful.

View Replies !    View Related
Length Of A String In Flash Script
I feel quite confident in Visual Basic. But When trying to determain the Length of a string in Flash Script, and then picking up the letters (not numbers), i have fallen short.

The Variables are "Table12" or "Chair2"

What i need is an algorithm that will pick up the Word "Table" out of the string. Or "Chair".

I see that there is a "Length" Object Action, which i can use to find the length for the amount of passes i make. But that is all i know how to do.

Can one of you please help me.

Kind regards

DogGoneIT

View Replies !    View Related
GetURL(' Limited String Length? ')
I'm throwing in a whole bunch of Javascript into a getURL() function:

var js = "a very long string of javascript...etc, etc";
getURL("Javascript:" + js);

And I'm reaching size limit where Flash just doesn't do anything with it any more. Has anyone else run into this problem? Know of any possible solutions? Thanks.

Kory

View Replies !    View Related
How To Calculate String Length In Flash
Hello
How can I calculate length of entererd string .....like I have got the string from user in some variable string how can I calculate its length ........is there any loop instruction ?

View Replies !    View Related
Array.sortOn(String.length)?
Very simple test to do the sortOn method using the length property of the strings, which doesn't seem to do anything.

this.words = ["abc","a","bc","ab"];
trace(this.words);
this.words.sortOn("length", Array.NUMERIC);
trace(this.words);

//TRACE REULTS
abc,a,bc,ab
abc,a,bc,ab

I found a couple of examples that use the y property of MovieClips to sortOn, which appear to work.
http://labs.bigspaceship.com/2007/10/16/array-sorting/
http://www.senocular.com/flash/tutorials/as3withflashcs3/?page=2

Any ideas?

View Replies !    View Related
String Length? (Textfield.htmlText)
I've done some research in Moock's Actionscript for Flash MX, but still running into issues.

I have text variables being passed into my flash movie that need to be in the same paragraph but can be one of 3 types: title, url, blank. Each one goes on a separate line.

My problem happens when I create the html string to be displayed. When I debug, the string cuts off right in the middle of a variable. Normally, if there was a problem with how I programmed the function, it would cut off before or after displaying the contents of the variable, but it cuts off right in the center of it. This happens around 250 characters into the string, which leads me to believe that something is limiting the length of the string????

Make the text string:

Code:
function makeText(){
for(i=1; i<=13; i++){ //13 is the number of lines available for display
if(_root["linksAkey_"+i] == 0){ //blank line
_root.Astring += '<BR>';
}else if(_root["linksAkey_"+i] == 1){ //title line
_root.Astring += '<FONT COLOR=#B5BD8E>';
_root.Astring += _root["linksAname_"+i];
_root.Astring += '</FONT><BR>';
}else if(_root["linksAkey_"+i] == 2){ //url line
_root.Astring += '<FONT COLOR=#FFFFFF><U><A HREF=http://';
_root.Astring += _root["linksAurl_"+i];
_root.Astring += '>';
_root.Astring += _root["linksAname_"+i];
_root.Astring += '</A></U></FONT><BR>';
}
}
}
Make the textbox and display _root.Astring:

Code:
this.createTextField("linksA", 10, 10, 162, 150, 209);
this.linksA.html = true;
this.linksA.htmlText = _root.Astring;
this.linksA.type = "dynamic";
this.linksA.embedFonts = true;
this.linksA.setTextFormat(_root.typewriter12);
this.linksA.multiline = true;
this.linksA.wordWrap = true;

View Replies !    View Related
How To Determine Length Of A String [renamed]
Sorry about that, but its obvious that while scanning a forum, the eye will be drawn to threads that are titled in caps and Ill hopefully hit the jackpot ....anyway, Im using variables pulled in from a .cfm, and have split them into an array using .split("|"), so I can dynamically populate a nav bar...so now Ive got an Array of all the menu button names stored in the file...SOOOoooo...Say Ive got a button called "Home", and the other "The Dysfunctional Properties of the Human Mind", obviously I need the duplicate buttons to scale in width. Is there a way of finding out the number of letters in a string that is part of my array?

To reposition my duplicate buttons I used this -
setProperty("cats_clip"+i, _x, xstart+i*_root.cats_clip._width);

To change the width I want to use this
setProperty("cats_clip"+i, _width, widthstart+i*((number of characters in current string*width of one letter)+a buffer to allow for space on the sides);

or something to that effect
So could anyone tell me what to use to replace the bit in red?

View Replies !    View Related
Maximum Length Of An Array? Or String?
what is the maximum lenght of an array? or at least of a string?
thanks!

View Replies !    View Related
Length Of An Array With String Index
You can find the length of an array through the property length (e.g. arrayInstance.length)

But I realize that I cannot use this property if I specify the array index through strings
for example:


Code:

var arrayInstance = new Array();
arrayInstance["cat"] = "Garfield";
arrayInstance["dog"] = Jazzy Dog";
arrayInstance["mouse"] = "Mickey Mouse";
trace(arrayInstance.length) //returns 0 !!

View Replies !    View Related
String Length? (Textfield.htmlText)
I've done some research in Moock's Actionscript for Flash MX, but still running into issues.

I have text variables being passed into my flash movie that need to be in the same paragraph but can be one of 3 types: title, url, blank. Each one goes on a separate line.

My problem happens when I create the html string to be displayed. When I debug, the string cuts off right in the middle of a variable. Normally, if there was a problem with how I programmed the function, it would cut off before or after displaying the contents of the variable, but it cuts off right in the center of it. This happens around 250 characters into the string, which leads me to believe that something is limiting the length of the string????

Make the text string:

Code:
function makeText(){
for(i=1; i<=13; i++){ //13 is the number of lines available for display
if(_root["linksAkey_"+i] == 0){ //blank line
_root.Astring += '<BR>';
}else if(_root["linksAkey_"+i] == 1){ //title line
_root.Astring += '<FONT COLOR=#B5BD8E>';
_root.Astring += _root["linksAname_"+i];
_root.Astring += '</FONT><BR>';
}else if(_root["linksAkey_"+i] == 2){ //url line
_root.Astring += '<FONT COLOR=#FFFFFF><U><A HREF=http://';
_root.Astring += _root["linksAurl_"+i];
_root.Astring += '>';
_root.Astring += _root["linksAname_"+i];
_root.Astring += '</A></U></FONT><BR>';
}
}
}
Make the textbox and display _root.Astring:

Code:
this.createTextField("linksA", 10, 10, 162, 150, 209);
this.linksA.html = true;
this.linksA.htmlText = _root.Astring;
this.linksA.type = "dynamic";
this.linksA.embedFonts = true;
this.linksA.setTextFormat(_root.typewriter12);
this.linksA.multiline = true;
this.linksA.wordWrap = true;

View Replies !    View Related
How To Determine Length Of A String [renamed]
Sorry about that, but its obvious that while scanning a forum, the eye will be drawn to threads that are titled in caps and Ill hopefully hit the jackpot ....anyway, Im using variables pulled in from a .cfm, and have split them into an array using .split("|"), so I can dynamically populate a nav bar...so now Ive got an Array of all the menu button names stored in the file...SOOOoooo...Say Ive got a button called "Home", and the other "The Dysfunctional Properties of the Human Mind", obviously I need the duplicate buttons to scale in width. Is there a way of finding out the number of letters in a string that is part of my array?

To reposition my duplicate buttons I used this -
setProperty("cats_clip"+i, _x, xstart+i*_root.cats_clip._width);

To change the width I want to use this
setProperty("cats_clip"+i, _width, widthstart+i*((number of characters in current string*width of one letter)+a buffer to allow for space on the sides);

or something to that effect
So could anyone tell me what to use to replace the bit in red?

View Replies !    View Related
Convert String Length To Pixel Based Value?
Hi all,

I can obtain the number of characters in a string using the 'length' action script command.

However, I need to know the pixel width of this 'length' - is their some magic formula for this - or better still a conversion tool out their somewhere?

Any ideas?

MacLemming.

View Replies !    View Related
[CS3] Measure Data Length Of Query String
Hi there

I have a variable named formError which is applied to a dynamic text box which displays query string values.

I want to write some code which basically says:

if formError's data length is more than 0,
goto and play frame labelled 'register'.

is there any way of doing this?

Many thanks

View Replies !    View Related
Limiting Variable Text String Length
I have a Flash app that uses a lot of variable text. Due to the layout of the page, it is sometimes necessary to trucate certain strings. I know I could trucate the string at X number of characters, but that doesn't always work and you have to assume worst case-scenario to be sure it doesn't override anything. Is there a way to calculate the physical length of a string (number of pixels, for example) in order to maximize the available space for a string? I imagine I could determine the number of pixels for each letter in the alphabet and perform a calculation each time I populate the string, but I'm hoping there is an easier way.

View Replies !    View Related
Check String Length Server-side
Hi guys,

how do i check the string length server-side?

I am using the date object to gather the current date.

quote:
var d = new Date();
var mm = d.getMonth()+1;
var yy = d.getFullYear();
var dd = d.getDate();

month is returned as "2" which is correct
but i need to be able to check for a single char so that i can add a leading zero before it is submitted to the database. This is also required for day.

thanks
Paul

View Replies !    View Related
[FMX] Measuring Real Pixel Length Of String
Hi everyone!

I'd like to know a way to measure the real length of a text string in pixels. The problem is that every character has a different width.
The length property informs us of how many characters does the string have...but how do we measure the pixels (x space) in a precise way?

thanks!!!

View Replies !    View Related
Array Length, When Index Is String-based
Hi everyone

just a simple example:

var a = new Array()
a["apple"] = "red"
a["orange"] = "orange"
a["banana"] = "yellow"


trace(a.length) //returns 0



Why on earth does that happen? Anyone knows a way to get it work?

I should try something with for(var item in a)

View Replies !    View Related
[FMX] Measuring Real Pixel Length Of String
Hi everyone!

I'd like to know a way to measure the real length of a text string in pixels. The problem is that every character has a different width.
The length property informs us of how many characters does the string have...but how do we measure the pixels (x space) in a precise way?

thanks!!!

View Replies !    View Related
[F8] Dynamic Height Rescale (based On String.length)
Hi there...


Okay what I after is how to detect the length of the string populated from array...then auto rescale the height of the title_mc as shown in my AS as well as the dynamic created textfield ..so the textfield will display long string + "newline" for long string...(autowrapper)..

eg:


// for short text keep remain the standard size of height
mc.title_mc.tf.text = "short text";

//for long string it will expandable the title_mc.height as well...dynamically
mc.title_mc.tf.text = "standard width title_mc"+newline;
//by the time string move to newline the title_mc.height also will increase

so how to determines the long string and auto rescale the title_mc.height

here's the code currently I'm using...

Code:

stop();

var sometesttext:Array = new Array("super super super longggggggg textttttttt iiiiiiiii guesssssssssss","intermediate text","short text");
var len:Number = sometesttext.length;

this.createEmptyMovieClip("mc",this.getNextHighestDepth());

for(var i=0;i<len;i++){
var mc = mc.attachMovie("bubbles","bubbles"+i,mc.getNextHighestDepth());
mc._y = 50;
mc._x = 20+mc._width*i;
mc.ivar = i;
mc.title_mc.createTextField("tf",100,mc.title_mc._x,mc.title_mc._y,mc.title_mc._width,mc.title_mc._height);
mc.title_mc.wordWrap = true;
mc.title_mc.multiline = true;
////////////////////////////////////////////
mc.title_mc.tf.text = sometesttext[mc.ivar];

//******** this portion how to determines in order to display
short text and long text..

///////////////////////////////////////////

//setting txtfield format
myformat = new TextFormat();
myformat.color = 0xffffff;

mc.title_mc.tf.setTextFormat(myformat);

}


thanks in advanced

View Replies !    View Related
ExternalInterface.call String Parameter Length Limit?
Is there a String length limit to the amount of chars a String can contain when passed as a parameter to ExternalInterface.call()?

Also, are there any chars that ExternalInterface.call() cannot serialize in a string?? Like
, ...etc.

The livedocs don't answer these questions.

View Replies !    View Related
CreateTextField Setting Width Based On String Length
I wonder if there is a way to easily calculate how wide to make a textfield that you create dynamically with createTextField based on the length of a string that is passed as an argument. In other words, if you know the font size you plan on using, is there a way to figure out how many pixels you need? Thanks in advance to anyone who can offer some assistance.

View Replies !    View Related
Dynamic Height Rescale (based On String.length)
Hi there...


Okay what I after is how to detect the length of the string populated from array...then auto rescale the height of the title_mc as shown in my AS as well as the dynamic created textfield ..so the textfield will display long string + "newline" for long string...(autowrapper)..

eg:


// for short text keep remain the standard size of height
mc.title_mc.tf.text = "short text";

//for long string it will expandable the title_mc.height as well...dynamically
mc.title_mc.tf.text = "standard width title_mc"+newline;
//by the time string move to newline the title_mc.height also will increase

so how to determines the long string and auto rescale the title_mc.height

here's the code currently I'm using...

Code:
stop();

var sometesttext:Array = new Array("super super super longggggggg textttttttt iiiiiiiii guesssssssssss","intermediate text","short text");
var len:Number = sometesttext.length;

this.createEmptyMovieClip("mc",this.getNextHighestDepth());

for(var i=0;i<len;i++){
var mc = mc.attachMovie("bubbles","bubbles"+i,mc.getNextHighestDepth());
mc._y = 50;
mc._x = 20+mc._width*i;
mc.ivar = i;
mc.title_mc.createTextField("tf",100,mc.title_mc._x,mc.title_mc._y,mc.title_mc._width,mc.title_mc._height);
mc.title_mc.wordWrap = true;
mc.title_mc.multiline = true;
////////////////////////////////////////////
mc.title_mc.tf.text = sometesttext[mc.ivar];

//******** this portion how to determines in order to display
short text and long text..

////////////////////////////////////////////
//setting txtfield format
myformat = new TextFormat();
myformat.color = 0xffffff;

mc.title_mc.tf.setTextFormat(myformat);

}

thanks in advanced

View Replies !    View Related
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>

View Replies !    View Related
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()

View Replies !    View Related
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

View Replies !    View Related
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.

View Replies !    View Related
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

View Replies !    View Related
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!!!");
}

View Replies !    View Related
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

View Replies !    View Related
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!

View Replies !    View Related
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!

View Replies !    View Related
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?

View Replies !    View Related
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

View Replies !    View Related
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

View Replies !    View Related
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

View Replies !    View Related
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?

View Replies !    View Related
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

View Replies !    View Related
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

View Replies !    View Related
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.

View Replies !    View Related
How Can I Put A Number And A String Together So It Ends Up Being A String ?
How can I put a number and a string together so it ends up being a string ?


This doesn't work:
----------------------

somenumber=1;
somestring="File";

combination=somestring + somenumber;

----------------------

At the end i want to have this:

combination="File1";

Can anyone help ?

View Replies !    View Related
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?

View Replies !    View Related
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

View Replies !    View Related
How Do I Insert A String Into The Middle Of Another String?
I'm going round and round in ciccles trying to figure out how to use the string functions.

All I want to do is insert a string into the middle of another one!

How do I do this?

Any help would be appreciated.

Thanks.


OM

View Replies !    View Related
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???

View Replies !    View Related
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?

View Replies !    View Related
Copyright 2005-08 www.BigResource.com, All rights reserved