Groups | Blog | Home
all groups > flash (macromedia) > july 2003 >

flash (macromedia) : Problems with variables when using Input Text Fields.


PUP100
7/30/2003 11:18:05 PM
I?m doing some work passing data from an input field into a variable & then performing some string manipulation on the string contained within the original variable.

If I use the below script having first named the variable associated with text field as MyString, any text I input into the text field is traced as I had expected

myString= ??
my_btn.onPress=function(){trace (mystring);}

So having established that the text field is submitting what ever is entered to the myString variable I would have thought the below script would have worked ok

myString= ""
var spot= myString..indexOf(",");
fluid=. myString.substr(0,spot);
my_btn.onPress=function(){trace(fluid);}



Robin Nicholl
7/31/2003 1:32:51 AM
I don't see what you're getting at. The script you posted is riddled with
errors:

[quoted text, click to view]

If you corrected those and supplied something other than an empty string
that actually included the character you're checking for (,) then the trace
window would display whatever comes before that comma.

Am I missing your point?

--
Robin Nicholl
studioalias
PUP100
7/31/2003 11:36:51 AM
Sorry Robin ? There was a number of typos in the original posting, I had cut a pasted it a bit for the forum.

The following is a more accurate (I hope) version of where I? currently at.

var spot = myString.indexOf(",");
fluid += myString.substr(0, spot);
my_btn.onPress = function() {
trace(fluid);
};

I have associated the variable connected with the ?Input Text Field? with the name ?myString? ? But just get ?0? thrown back in the trace window.

Am I going about getting info from an input box the wrong way?

The wierd thing is a simple code such as

my_btn.onPress=function(){trace(myString);}

works fine (la being the variable associated with the input box.) But as soon as I do some manipulation on the string it all falls on it?s T*ts.

Any further help ?Please.


AddThis Social Bookmark Button