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








Convert The Value Of This To A String?


I need to be able to get sub strings of This.. but when I try, it says undefined...

If you trace(this) you get like _level0.container1

I need to substring it so i can read the last character.. the 1... but it won't let me

how can i do this?




FlashKit > Flash Help > Flash ActionScript
Posted on: 08-25-2006, 11:27 PM


View Complete Forum Thread with Replies

Sponsored Links:

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
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
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
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.

View Replies !    View Related
Convert To String?
I load variables from a text file named :

&first1=John
&first2=Mark
&first3=Tim
&first4=Mike

I am evaluating them in a loop by constructing the variable I want to test and assigning it the value of first1, first2, etc. based on the current loop iteration

For Example, during iteration start_num=1 :

test_first = "first";
test_first = test_first.concat(start_num);
run_first = eval (test_first);

This makes the variable I want to test, run_test, and assigns it the value of, first1, which is John. So :

run_test=John

However, I am comparing, run_test, to a input from a text box, text_input. text_input is type string, but run_test is type undefined.

How do I convert the variable run_test to a string so I can evaluate it in an IF statement?

View Replies !    View Related
Convert To String
I load variables from a text file named :

&first1=John
&first2=Mark
&first3=Tim
&first4=Mike

I am evaluating them in a loop by constructing the variable I want to test and assigning it the value of first1, first2, etc. based on the current loop iteration

For Example, during iteration start_num=1 :

test_first = "first";
test_first = test_first.concat(start_num);
run_first = eval (test_first);

This makes the variable I want to test, run_test, and assigns it the value of, first1, which is John. So :

run_test=John

However, I am comparing, run_test, to a input from a text box, text_input. text_input is type string, but run_test is type undefined.

How do I convert the variable run_test to a string so I can evaluate it in an IF statement?

View Replies !    View Related
How To Convert 'this' To A String
I want to take the keyword this and convert it to a string to use later in my function does anyone know how to do it?

if I trace(this) - I get the string that I want to use but it doesn't seem to be a string.

this.toString(); traces as [object Object]

I may be getting close but I though this might be easy for someone with more experience.

thanks!

View Replies !    View Related
How Can I Convert A Value Into A String?
this code is inside a instance called clip1:

someval = this._name;
trace(someval);


how can I get the output to be: "clip1"? because now the output is just: clip
And I really need to get thous darn "" there.

big thanks im really stuck here.

yours in faith Neptunesnectar.

View Replies !    View Related
How To Convert XML Value To String
distdata.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue

The above line returns me a value, i want to convert this in to string value.
how can i do this ?

View Replies !    View Related
Convert String To Int
Been searching for a simple way to do this but it's not out there, or is it?

I simply need to convert a sting to an int. The string will be a number, that is a given.

View Replies !    View Related
Convert This To String
Hi everybody,

I duplicate lot of mc

ActionScript Code:
for (var i:Number; i < n; i++)
{
empty.mc0.duplicateMovieClip("mc"+i, this.getNextHightsDepth());
empty["mc"+i].onRelease = function()
{
//now i wont when i release that start script which depends on i
//my idea is that i use trace(this)
//_level0.empty.mc0
//_level0.empty.mc1
//_level0.empty.mc2
//.....
//when i add
test_txt.text = this;
//i can see path
//but i dont know how to convert him to string
//because I wont to separate only number at the end with .substr(-1,1)

}}
this is my idea can anyboy help me???

thanks in advance

View Replies !    View Related
Convert String To Hex
I'm trying to convert a string value to a hex value so the user can specify a custom color that will be used to draw a line. Is there any way I can do this?

I don't want to have buttons that supply preset colors. I want it to be completely customizable.

Thanks

View Replies !    View Related
Convert Int IP To String
Hello, i'm trying to make a IRC client, but when the server send me the PING command, i can't respond because i think it s IP is coded in integer and i think i need to convert it so i could open a connection and sent it the PONG command back without being kicked, thanks.

View Replies !    View Related
Convert Asp String To UTF-8?
Hello,

I have a plain text file with special charset like ' ëèé'
I finally got it to work. But now i am trying to use a asp file to write out the text. But i don't
know how to convert to UTF-8 in ASP.

I have this, but it still does not work:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>TEST</title>
</head>
<%

'set output character set
Response.CharSet = "utf-8"

Response.Write("This is a test éèè")

%>
</body>
</html>

Does anyone has knowledge of how this could be done?

Regards,

Micheal.

View Replies !    View Related
How To Convert A String Into A Value ?
guys , is there any way to convert a string into a value ?! like the user will enter something like this in a textbox (5 + 7^5 * 3) and i wanna calculate the value. it there anyway to do this other than studying the expression char by char and analyse the operations ?!!!

View Replies !    View Related
Convert String To Array
Hi!!!!

i have a big trouble, I read a variable from mysql database, just like this:

posH=123,432,34,345....

But whe I read the variable in flash it comes in form of string and not like array.

I try with the funtion eval(); but dont work fine =[

Jus I like convert this:

x = "1,2,3"
// to
x = [1,2,3]

thx .... =]

View Replies !    View Related
How To Convert String To Funtion?
hi all.
does anybody know how to convert a string to a function?
say i import the string "myfunction()". is there any way to make flash execute myfunction()? nothing i have tried works. please let me know!
thanks,
larry armstrong

View Replies !    View Related
I Need To Convert A String To A Number
Hello all,

I have a value stored in a variable called "numba"

I get the value like this:
numba=this._name.substring(6,this._name.length);

the value is a string, when I trace(numba) I get something like this:
0
1
2
3
4

I want to add a value of 1 to the variable called numba.
The problem is that the value of the variable numba IS A STRING. so when I try to add 1 to it like this:
newNumba=numba+1;
the trace looks like this:
01
11
12
13
14
I want it to simple return 1,2,3,4,5
how can I convert my string(numba) into a real number?
I have tried turning the string into an object but it didnt work out.
Much thanks to any takers,
~Apolo

View Replies !    View Related
Convert String To Expression
im trying to diplay the contents of the different variables (named proj...1,2,3,4,5,6" in a dynamic text box. Although i can get the target correct concaternating the string "_root.proj" with variable _root.b the dynamic text box (t) will not read the resultant code as an expression and therfore diplays _root.proj1.

the expression box is checked on the value of variable this.t

anybody help please. The answer is probably simple

here's the code
james


onClipEvent (load) {
x = "_root.proj" + _root.b;
this.t = x;
}

View Replies !    View Related
Convert String To Number
Hello if anyone can help with this probably simple issue....

I load some variables from a database or textfile and some of those are numbers. Now I tried to convert them using parseInt() and that works fine, however if I try to convert an integer value, for example 1.33 it goes wrong!

Any suggestions?

View Replies !    View Related
Convert String To Number
Hello,

i have this: "01". How to convert to this number: 1?

Thanks,
Miguel

View Replies !    View Related
Convert Integer To String
edit ----

sorry all, didn't notice the 30 trillion other posts explaining this issue.

oops!

View Replies !    View Related
Convert String To Referenc3
hi

i have a string that i want to convert to reference the object, if u know wat i mean.

///////////////// this is my string ////////////
trackTopNum = 5;
return Object("_root.game_mc.track" + trackTopNum);
////////////////////////////////////

but i want to perform hitTest with it.

///////////////// this doesn't work////////////
_root.game_mc.track5.hitTest(something);
/////////////////////////////////////////////////

is there a way?

thanks.

View Replies !    View Related
Convert String To Integer
Is there a way (function) to convert a string to an integer?

Thanks!

View Replies !    View Related
How Do I Convert A String To An Array?
myArray = "[ [1,1,1,1,1,1,1,1],
[1,0,0,0,0,0,0,1],
[1,0,1,0,0,0,0,1],
[1,0,0,0,0,1,0,1],
[1,0,0,0,0,0,0,1],
[1,1,1,1,1,1,1,1] ];

View Replies !    View Related
Convert String To Array
is there some way to convert a string to an array?

let's say I have a variable which contains a string:

mystring = "[20,546,60]"

and I want actionscript to pass this data to an array, and the result would be for example this.

mylist = [20,546,60]

like:

mylist[1] = 20
mylist[2] = 546
mylist[3] = 60



thanks

View Replies !    View Related
How To Convert String To Number?
I have an external text file and it's content is simply "quantity=3".
Then I loadVariablesNum to load this external text file into flash.
As expected the variable called quantity will be a string of "3".
I want to change this string to a number.
So I put in this statement "var newquantity = Number(quantity)".
Unfortunately this doesn't convert the variable quatity from a string to a number?!!

I know that the above statement will work if the variable "quantity" is defined internally, instead of loaded externally.

My question is how should I load a number into flash ... instead of loading a string. Thanks

View Replies !    View Related
How To Convert String To Number?
all Mc's are named object1, object2 ect. From there I split the the name to get the number at the end of the Mc's name. From there I will be running a function that controlls all the MC's with numbers above the selected MC.

ie click on object2 there fore object3, object4 and object 5 will animate.

The problem is with activating only those above the selected target. I thought I could use ObjectNumber (in this case 2) and add one to that varaible - hoping that it becomes "3" but instead I get "21"

var objectNumber:Number = this._name.slice (6);
var objectNext:Number = objectNumber+1;
trace ("Next object number is "+objectNext)

OUTPUT is :" 21" (2&1 not 2+1??)

View Replies !    View Related
Convert String To Mc Instance
hello

code :
// this bit goes into a TextField prototype

function validate(obj:Object) {
wrongArray.push(obj + "error")
}

// this is my func

if (wrongArray.length<=0) {
sendMail();
} else {
for (i=0; i<wrongArray.length; i++) {
var themc:MovieClip = wrongArray[i];
//trace(typeof(themc) + " / " + i + " // " + wrongArray[i]);
showError(themc)
}
}
}
function showError(mc:MovieClip):Void {
trace(typeof(mc))
}

the output is always String how do i convert this to MovieClip instance

View Replies !    View Related
How To Convert Droptarget Value To String?
low guyz...

i would like to know how to convert the return value of the droptarget into string.. so that i can split it..

this is the code that i made but it didnt work:

ActionScript Code:
on (press) {
    startDrag(this, true);
}
on (release) {
    stopDrag();
    dropTar = eval(this._droptarget);
    var target_Array:Array = dropTar.split("_");
    for (var i = 1; i<target_Array.length; i++) {
        trace("splitted ["+i+"]:"+target_Array[i]);
    }
}

i need ur help guyz.. thankz!

View Replies !    View Related
Convert String To Number
i have a string and want it to covert to a number...how ?

for the live of me why does this not work !

temp_name = "Folder_name" + (number + c) ; //number is 1 , c = 0
trace("tempname = " + temp_name ); //gives me Folder_name10

i want it to ADD and make it 1 eg. Folder_name1

View Replies !    View Related
How Can I Convert A String To Another Code?
how can I convert a string to another code?

var str:String = "العربية";

how to convert it to a hex code or to UTF32 or UTF8???

any help?
thank you.

View Replies !    View Related
Convert String To Number
hey,

I am trying to convert a number in an external text file from a string into number... sounds simple but it just doesnt work...

Code:
var externalData:LoadVars = new LoadVars();
externalData.onLoad = function() {
color_txt.text = externalData.colorCode;
}
externalData.load("colorCode.txt");
var myNumber:Number = Number(color_txt.text);
trace (myNumber);
when I trace the "myNumber" it outputs 'NaN'

View Replies !    View Related
Convert A String To A Number
Hello,

I have a problem which is annoying me, is there anyway of converting a string to a number!? I know its not a normal thing to do but i need to!!

Can anyone please help that would be great.

View Replies !    View Related
How To Convert A String To A Instance Name?
Hello!

Im new to coding and ActionScript. I have a problem where I have a String that contains an instance name of a button (lets say the instance name is _level0.application.form1.A1 ), the problem is that I dont know what to do to get to use the buttons instance name ( what i have to do is to make some changes to _level0.application.form1.A1._x and _level0.application.form1.A1._y )

See the code below.

Thanks for the help


PHP Code:



//myNode.firstChild.nodeValue=<msg>_level0.application.form1.A1,100,100</msg>

var myString:String=myNode.firstChild.nodeValue;

//myString= "_level0.application.form1.A1,100,100"
var myArray:Array = myString.split(",");

//myArray[0] = _level0.application.form1.A1 -> toDrag = _level0.application.form1.A1

var toDrag_btn = myArray[0];

// NOW I NEED TO USE THE BUTTON _level0.application.form1.A1
// IT IS NOT DONE LIKE THIS BUT MAYBY YOU GET THE IDEA BELOW
toDrag_btn._x=100;
toDrag_btn._y=100; 

View Replies !    View Related
Convert String To Number
Hi, ppl

I'm a newby in flash 8, and I have a big problem:
Why this script dont work in flash 8, and work in flash 7 ??

on (release) {
var results:Number = Number(ca)/(Number(cb)*Number(cb))*10000;
result = Math.ceil(result);
}


Please anyone can help me to make this work in flash 8

Thanks

View Replies !    View Related
Convert String To A Number
Hi everybody.. I need some help with Flash8,

My intention is to read a number from a txt file, I did it with that code:
-> loadVariables("amount.txt", totalAmount), //amount=100 in the txt file
and then I transfer the txt file content to a variable "outputAmount" :
-> outputAmount = totalAmount;
if I trace(outputAmount); I can see the amount 100

... is working but the problem is, flash consider "ouputAmount" as a string not as a number even if I put this code :
-> outputAmount = Number(totalAmount); (working on flashMX not on flash 8)
Then I can't make any '+ * / -' so HOW can I convert my outputAmount content to a number... to have the opportunity to make an '+ - * /'


Your help wil be APPRECIATE

Thank you

Jzeel

View Replies !    View Related
Convert HEX To String Literally
Simple question I guess,

How can I convert hexadecimal values like 0xff0000

to a string with the same symbols like this:

"ff0000"

View Replies !    View Related
Convert String To Type
Hi,

How do you convert a String to a Type?
Like being able to create a "Some String" object?

var something:"Some String" = new "Some String";

View Replies !    View Related
How To Convert A String To An Object?
Hi all,

I have a problem I ws hoping someone could help me with. I am trying to build a generic function that takes in an event object from a mouseover event, renames the target name (ex. old target=h1 , new target name=b1) with regexp then calls that new object instance to play a frame (b1.gotoAndPlay(2)). This is so I can have h1, h2, h3 event activate target play on b1, b2, b3 with regexp.

Code below:
// events
h1.addEventListener(MouseEvent.ROLL_OVER, over);
h2.addEventListener(MouseEvent.ROLL_OVER, over);


function over(evt:MouseEvent):void
{

var newTarget:String;
var oldTarget:String = evt.target.name;
newTarget = oldTarget.replace('h','b');

//??? this doesn't work because its not an object but string currently
newTarget.gotoAndPlay(2);

}


Any thoughts? I could always do a if loop (if h1 then b1.gotoAndplay, if h2 then b2.gotoAndPlay etc.. but seems like bad practice... )

PLease let me know if you need more information, this is my first time posting to a technical forum

Thanks in advance.

View Replies !    View Related
Convert String To Variable
Probably a real simple problem, but it is driving me nuts! I have a list of variables that serves as a script for a text-based game (line1, line2, etc.) I also have a number variable that grows by 1 with each line. But I can't figure out how to convert a string into a variable:


Code:
var line1:String = "This is the line.";

var currentLineNumber:Number = 1;

trace("line" + currentLineNumber);
This (as I'm sure you know) is returning "line1", instead of what I want, which is "This is the line."

Any suggestions? Thanks!

View Replies !    View Related
Convert String To Instance Name
I'm trying to write a function where I can use a string variable to reference a movieclip already on the stage.

Specifically what I want to be able to do is:
-get the name of the MovieClip clicked
-convert the name to a string
-change the string to the name of the next movieclip.
-get the x and y position of the "next movieclip"

I've succeeded up to the point where I need to get the x and y position. Everything I've tried only returns null or undefined.

Here's the relevant code:


ActionScript Code:
var counter:Number = 1;

mc1.addEventListener(MouseEvent.CLICK, onClick);

            function onClick(event:MouseEvent) {
                var mcname:String = event.target.name;
//returns "mc1"
                mcname = mc.substr(0,-1);
//returns "mc"
                counter ++;
                mcname = mcname += counter;
//returns "mc2"
                var mcX = mcname.x;
var mcY = mcname.y;
//that last part doesn't work. I'm trying to get the position of mc2 which is already on the stage.

View Replies !    View Related
Convert String To A Number
I am trying to compare two items for equivalency - one is a string in a text box, and the other is a number held in a variable. I can't seem to get an if statement like

ActionScript Code:
if (_root["guess"] == totalCash){
do something
}
to work. Do I have to convert the string to a number to do this? I keep getting negative results eventhough the string and the number match. If I have to convert to a number, how would I do that (ie "123" converted to 123)?

I tried Number() but that didn't seem to work. I searched the forums without success. Please help.

View Replies !    View Related
How To Convert A Number Into A String?
here is my situation

i want to read a number from a string "boxn"
then i want to add ine value to the variable n (n+1)
finally i want to create a new string called "img'n+1'"

but how i convert the (n+1) into a string? what is the function ?


PHP Code:



texto = "box5";

n=texto.charAt(3);
    v=Number(n);
    f=v+1;
    imgn=new Array();
    
    imgn="img"+f; 

View Replies !    View Related
Please Help Me .. String Convert To Field
Can anyone Pleassssse help ...

I am trying to save a field name into a variable such as:

var a:String = "city";

var rec_array:Array = new Array();

rec_array.push({name: "john", city: "omaha", zip: 68144});

rec_array.push({name: "john", city: "kansas city", zip: 72345});

for(i=0; i<rec_array.length; i++){

trace(rec_array.name + ", " + rec_array.a);

}

and I get undefined since I am using a instead of city.

Can anyone help me ?

Thank you for all the help,

Sean.

View Replies !    View Related
Please Help Me .. String Convert To Field
Can anyone Pleassssse help ...

I am trying to save a field name into a variable such as:

var a:String = "city";

var rec_array:Array = new Array();

rec_array.push({name: "john", city: "omaha", zip: 68144});

rec_array.push({name: "john", city: "kansas city", zip: 72345});

for(i=0; i<rec_array.length; i++){

trace(rec_array.name + ", " + rec_array.a);

}

and I get undefined since I am using a instead of city.

Can anyone help me ?

Thank you for all the help,

Sean.

View Replies !    View Related
Convert String To Number
Hi,
How to convert a string to a number. Suppose

var str:String = new String("4");

I want to convert that (str) into number, Is it possible?

can anybody help on this?

Thanks
Rajesh K.

View Replies !    View Related
Convert String To ByteArray?
Hello,

How does one go about converting a String into a ByteArray? I was hoping the String class would have a method called "GetBytes() or toBytes()", but this doesn't seem to be the case.

Thanks,
Mike

View Replies !    View Related
Convert String To Displayobject
I have displayObjects named "project1_example1", "project1_example2", "project1_example3", etc. I have a function that adds the displayObject to the stage, with params defining which one to add. This is the only way I can think but I know it doesn't work..

function openProjExample(a,b)
{
var mc = "proj"+a+"_example"+b;
addChild(mc);
}

Doing it this way defines mc as a string, and I'm not even sure if this is the right direction.

View Replies !    View Related
Convert String To Array
Is there a nifty function that will convert a String to an Array in AS(1 or 2)?

Something like:

myString = "1, 2, 4, 3";
myArray = myString;

..and then myArray ends up like:

myArray = [1, 2, 4, 3];

Im trying to add the content of a loaded textfile into an array, thats why. Maby there is some other workaround?

View Replies !    View Related
How To Convert String To Number?
i have two strings
a = 11 b =12
i want their sum,

i wrote

var sum:Number = a + b ;

its giving me 1112 as oppsed to 23.

how do i do it ???

i tried

sum = new Number(a ) + new Number (b )

its undefined here.
plz help.

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