Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using variable as String

Status
Not open for further replies.

fusionboy

Programmer
Jul 14, 2003
27
US
Hi,

I'm trying to use a function that accepts a String as an argument. The string I need to send this function has been assigned to a variable: theText. The function works fine if I type a String (i.e."hi there" works fine), but not if I pass it the variable name. I tried eval(theText) which would work in Javascript, but seems I read somewhere that eval works differently in Flash. Anyway, I'm out of ideas. Can anyone please help me!???

Thanks!
 
i amy be missing something from your post but

function what(vars){
trace(vars)
}
the_text = "monday";
what(the_text);
the_text = 123;
what(the_text);

_______________________________________
You know you're old if you can remember when bacon, eggs and sunshine were good for you
 
Right.

what(theText);

produces nothing (I am tracing theText -- so I know there is a string in it). But

what("hi");

behaves correctly. The string I am passing has HTML in it, which I thought might be the problem, but I tried

what(&quot;<b>hi</b>&quot;);

and it worked fine.
 
what(thetext) works fine for me

post sample content of thetext so i can try to recreate the problem


_______________________________________
You know you're old if you can remember when bacon, eggs and sunshine were good for you
 
Ok, turns out it is the HTML that is crashing the function. I think I can handle it from here...
Thanks for your help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top