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




Input Textfields Into Array.



I have a problem concerning how to put some input into an array.If the user clicks anywhere on the stage a small green dot appears (this is an mc with a button in it) if the green dot is pressed it turns red and a textfield appears next to it. This is all done by duplicatemovieclip. Now to the hard part. Since i duplicate the movieclip with the input field, it too is duplicated and contains the same variable as the previous. Hence, if i change anything in one input field, all of them changes. How can i make it so that the text field holds the text that is entered in an array instead of a normal variable. So basically i want to be able to label the red dots to different names and have these names in an array.I tried putting labels[] as the var that the field contains but that didn't work. Any help is greatly appreciated. (I don't know if this is in the worng part of the forum, I just assumed that I would need to use actionscript to fix this. If it is in the wrong place, I apologise)



ActionScript.org Forums > ActionScript Forums Group > ActionScript 1.0 (and below)
Posted on: 05-08-2006, 04:04 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Three Input Textfields
I'm working on a stand alone program where the user needs to input information into 3 different input text fields correctly inorder to advance. Upon entering the frame with the three textfields the focus needs to be set to the first one (lastname) where the user will type in "Jones"; then they need to TAB to the next field (firstname) and type "Kristie"; and then TAB to the last (Middle) and type "A". While "Tabbing" to the next field i need to have the program check the text box they are leaving to make sure the correct information is in it, if not it needs to clear the text field so the user can correctly enter the info.

So far i have:
On the frame:

lastname.tabindex = 1;
firstname.tabindex = 2;
middle.tabindex = 3;
Selection.setFocus(lastname);

However I can't tab to the next 2 fields.

Can anyone give me some guidance on how to make all this work?

Input Textfields
Just a quickie... Why cant i declare a variable to an input text field?

ie:

var myName:String = myName_txt.text;

myButton.onRelease = function()
{
trace(myName);
};



when i trace it i get nothing back, however if i add the a name to the var property in the properties panel it works fine, i thought that using this option was not recommended in MX onwards??? Any ideas???


PS: Yeah i am new to flash actionscript!!!

Input Textfields
Can someone please tell me how to create a set of 6 text boxes that are required to be used as an input?

I've been trying, but to no avail. Any help would be greatly appreciated

Scewing Input Textfields
If you scew input textfields they disappear. Is is the same with dynamic textfields?? What's up with that? Is there a way of fixing this?

Bug With Input-textfields In Movieclip
I got this movieclip with an input-textfield and three buttons inside.

This is what the buttons do:
Button1: Moves the movieclip.
Button2: Rotates the movieclip to the left.
Button3: Rotates the movieclip to the right.

Button1 is working alright.
The two rotate-buttons is also working, but the textfield disappeares when I use then. When I rotate the movieclip back to it's original position, the textfield reappear.

How can I get the textfield to follow the movieclip's rotation without disappearing?

Formatting In Input Textfields
How would you mix html links, bold characters, italic characters, etc into an input text field? Would you need to have a button that adds special characters like <b>Bold</b> in order to make something bold?

Flash Bug With Input TextFields
I add a stylesheet and it stops working?? Anyone know whats up?


Code:
var style = new TextField.StyleSheet();
style.parseCSS(".Normal{font-family: Arial;font-size: 12;}");
_root.createTextField("myText",100,10,10,200,200);
myText.type = "input";
myText.html = true;
myText.border = true;
//The following line causes the text to become uneditable.
myText.styleSheet = style;

Input And Dynamic Textfields
Hey everyone.  Im new to Flash MX and am already getting stuck on some simple actionscript.  Heres what Im aiming to do:

I have a input textfield, a button, and a dynamic text box.  When somebody types text in the input textfield and presses the button, that text shows up in the dynamic textbox.  

Heres the actionscript that Ive been trying to get to work:

The input textfield's instance name is "textfield01".
The dynamic textbox's instance name is "results01".
The button's instance name is "button01".

The actionscript is as follows in frame 1:

_root.button01.onRelease = function(){
  var entered_text01 = textfield01;
  _root.results01 == entered_text01;
}

Another alternative I tried was putting the actionscript on the button like so:

on(Release){
  var entered_text01 = textfield01;
  _root.results01 == entered_text01;
}

However, neither of these prints anything in the dynamic text box.  After I enter some text and press the button, nothing shows up.  

Any help is appreciated.

--REI

Input Textfields To Dynamic After Right Entry?
I want to convert an input textfield to dynamic after correct entry by the user.

Initially i thought of a Movie clip with 2 frames, 1 with input & other with dynamic. but now i have to have 5 textfields, user can enter in all the 5 fields.

please help me if there is a way for this.
AJ

Insert / And Decimals Into Input Textfields
Is there a way to have either a "/" or a decimal point to be inserted into a input test field when a user types in 2 values. In other words I need a dash or a decimal point to automatically insert between the 3rd and fourth value... bacially I'm having the user type in the date and i need the dashes to appear where they normally would and then have the user type in a price and have the decimal appear in its usual spot...

anyone have any ideas?

Masked Input/dynamic Textfields?
Heey,

I'm quite good at scripting in Flahs... atleast that's what I thought
Untill I found this (bug/problem/stupid action of me) ...

On the toppest layer I've put a big square that's masking all the other layers I have...
Now when I use an dynami ctextfield and give it a value... it desn't show up... I thought this was kinda weird so i tried it on anohter file using only 2 layers... when I put the textfield in the lower layer (the one that's being masked) it does't show a value... but when i add another layer (not masked) it doesn show it...

Now I need to know if this is a bug... sumthing I should know... or whatever???

Greetz,

Detecting ENTER On Input TextFields?
Hi,

Is there a way to check for the 'hit' of an enter key on a input text field? i.e. I want to wait until the user has entered a value before i assign the contents of the input text box to a variable and continue the rest of the movie.

Thanks

Input Serial Key To 5 Dynamic Textfields
Hi, i need make 5 dynamic textfields with 5 number filled in and with 5th 10th 15... it should automaticly jump to next dynamic textfield. If somebody can help me. thx
For sure, it is something like if you fill in regkey when you install some soft

eg. : s/n 15478 - ju587 - 4d7s8 - fd547 - fds45

ths

Creating Dynamic (input) Textfields
Hi everybody!

I'm experiencing some problems when working with creating dynamic input textfileds. I want to create a textfiled with a colored border, embeded font with at fixed width. Later I also want to add an listener to this textfiler. Does anybody know how to solve my "huge" prolem?

// elektrophunk

Input Textfields - Weird Problem
Oi

I've got this weird problem with my input textfields. I create a textfield, set it to input and that's it. When I test the movie I can write in the textfields, but there is no visible text

And if I write something in the textfields (while working in flash) that text should be in the textbox when I test the movie right? But there is no visible text now what so ever.

I have made sure that I don't have the same color on the text as on the bg and things like that. I cannot understand this

Peace

LoadMovie-s Controlling Input Textfields
FIXED!!! You can ignore this post! Unless you came here by google and having same problems i am!


Hi All, first post here. I've done a lot of tinkering and reading...and researching and researching...and it's driving me nuts. I always research till i'm blue in the face before i make a post, anyways here it goes.

My goal: load a .swf file from a movie clip, modify the text field of an input text.

My scheme. I have a movieclip called page4, when a button called "quote" is released it loads contact.swf into a movieclip "contactholder." Great, that's easy works fine.

I need to edit a input text field called poi within contact.swf.


Code:
quote.onRelease = function() {
loadMovie("contact.swf", "contactholder");
_root.page4.contactholder.poi.text = "PRODUCT NAME";
};
The poi's text field is not taking the "product name" in.

I need to modify that field when the button is pressed this way i can use my contact.swf repeatedly and update the poi field when different quote buttons are pressed with a corressponding product name.

Seems like this should be so easy, but, it refuses to work.

Thanks in advance. I'd post the .fla, but it's corporate work for a defense contractor i recently started working for (told them i didn't really know much programming just some basic AS!)

EDIT: I did some retooling around. brought that contact.swf into my main movie (it's a contact form with some AS that talks to some coldfusion, no big deal) so that everything is in one movie and tried this


Code:
quote.onRelease = function() {
contactholder._visible = true;
_root.page4.contactholder.poi.text = "PRODUCT NAME";
};
So it seems to be some sort of pathing issue?

EDIT: WOW!!!

contactholder.poi.text = "PRODUCT NAME";

Just doing that seemed to do the trick, i guess after staring at this for so long i was going overkill on stuff tryign to make sure there were no mistakes...Wow...ok i got it!

DISREGARD THIS STUPID POST! Sorry! Thanks to anyone who would have responded!

Problems W/ The @ Character In Input Textfields
Hello,
On certain browsers, I have been hearing our customers complain that when they try to input an email address, the @ character is
getting converted to an "à" character

I cannot reproduce this error on any of the machines I have access to but I wanted to know if there were known issues regarding flash input fields
and problems w/ special characters.

Thanks,
Eric

Problems W/ The @ Character In Input Textfields
Hello,  
    On certain browsers, I have been hearing our customers complain that when they try to input an email address, the @ character is
getting converted to  an  "à" character

I cannot reproduce this error on any of the machines I have access to but I wanted to know if there were known issues regarding flash input fields
and problems w/ special characters.

Thanks,
Eric

Basic Question About Input TextFields
Well... I want to design a simple, yet important function related to text fields in my forms..

I want to put some initial text inside of it.. like "first name"... but I would like that name to disappear when the user click on the textfield..

Plus, I want the textfield to come back with the initial string ("first name") - if user click outside of it and left no information at there...

Anybody can help??

Tanx!

Auto Resize Input Textfields
i'm looking for some help on resizing input textfields depending on how much text is entered.

ideally the textfield would resize it's height vertically to accomodate more text as it's entered, but stays the same width.

i'd imagine this would be acheived with onChanged or getTextExtent, but I've had no success.

is this even possible? if so, how?

Experts Help Wanted - Resizable Input Textfields
Greetings

Does anyone know now to create resizeable input textfields.

When I say resize able, I mean so that they can have a bounding box and can be resized by lenght and height but without resizing the text inside.

This guy has a similar type of thing
http://www.gskinner.com/gmodeler/

Thanks for any help

Dynamically Layout Input And Dynamic Textfields
I would like to dynamically layout input and dynamic textfields from external data. The input boxes appear throughout the dynamic (nonselectable) text. Imagine a paragraph with several 'fill-in-the-blanks' throughout. I want to build one function that will automatically parse and populate this.

In dynamic HTML and CFM, this is a simple matter. In Flash, it looks like a huge feat...

What is the best approach to do this? Any ideas/code are welcome.

Note: we have to publish for Flash 6 Player, but are authoring in Flash MX 2004.

Best and thanks,
Sarah

Accessing Dynamically Created Input Textfields
Inside a function i dynamically make 10 Input textfields. How do I make them global - that is, how can I access to their .text property from outside the function? The plan is that when a user clicks on a button, the listener function will determine the values in these input textfields, but am stuck in two ways:
1) input textfields are not recognized outside the function (1120: Access of undefined property vnosno.)
2) how to access each of the 10 input textfields, when i create each one with the same variable name (is there a way to create them with successive numbers; e.g. vnosno1,vnosno2,vnosno3...?)

this is how i created the input textfields:

ActionScript Code:
for (var k:int = 0; k < 10; k++) {
    var vnosno:TextField = new TextField();
    vnosno.type = TextFieldType.INPUT;
    vnosno.width = 100;
    vnosno.height = 23;
    vnosno.x = 100;
    vnosno.y = 80 + (k * 30);
    addChild(vnosno);
}

Possibility Of Turning Dyn. Textfields Into Input Fields
hello again

so is this possible?

i am asked to do a little updateable minisite
so people need to be able to update previous posts

what i have right now is a mc with all variable textfields in (15)
i am looking for a way for when the user klicks "update"
the same mc's(15) textfields are editable at runtime.

code for updating / posting into db are np.
just looking for a slightly more ez way for me to code

i was hoping to find some info upon it but allas...
started to roam the web but it leads me nowhere

any tips are most welcome

An Array Of Textfields, How?
Hello:



Is it possible to make an array of textfields and access the .text in a for loop. eg.
code:
for (i=0; i< 50; i++)
{
textField[i].text = array[i];
}


at least something easier than repeating 50 lines of myTestField1.text = "etc"
myTextField2.text = "etc etc"
and so on ....

TIA

Array Of Dynamic Textfields?
Hi all,

I'm wondering if there's a way to do this...

I have seven values from an XML file that I'd like to display in seven dynamic textfields. I'd also like to do some processing on the text in those fields based on certain user input.

I was hoping that I could name my dynamic textfields things like myText[0] and then go through my XML data and do something like this:

myText[0] = myXML[0].attributes.name;
myText[1] = myXML[1].attributes.name;

(or using a For loop)

and so on but that doesn't seem to work.

Is there a way to do something like this without resorting to hard-coded dynamic textfieldnames and iterating through them by explicitly?

Thanks!

Help Displaying XML Array Items In Textfields
I am attempting to pull XML content into my flash file and display it in various dynamic text boxes. It is properly looping thru the XML to collect the node data but cannot successfully display that data in my dynamic text fields. I was able to display data from the first Debit Title Node into a movie clip called "myDebitTitle1" but cannot display the data from the other Debit Title Node or the Credit Title Node into movie clips titled "myDebitTitle2" and "MyCreditTitle1". If someone can show me how to display the data in the Account Title nodes, I can do the rest. (Keep in mind that the XML will be changing; pulling in different transactions.)
Here is what I have so far:

var myXML:XML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function(success:Boolean):Void{
if(!success) return;

var rootNode:XMLNode;
var transDetails:String;
var transSummary:String;
var transDate:String;

var transAccounts:XMLNode;

var transDebits:Array;
var transCredits:Array;

//variables for account information
//var accountNode:XMLNode;
//var acctNodeName:String;
//var acctValues:Array;

var isCredit:Boolean = false;

rootNode = myXML.firstChild;
transDetails = rootNode.childNodes[0].firstChild;
transDate = rootNode.childNodes[1].firstChild;
transSummary = rootNode.childNodes[2].firstChild;

transDebits = new Array();
transCredits = new Array();

transAccounts = rootNode.childNodes[3];

numAccounts = transAccounts.childNodes.length - 1; //for some reason counts closing tag

for(var acctIdx:Number = 0; acctIdx < numAccounts; acctIdx++){
acctValues = new Array();
var acctNode:XMLNode = transAccounts.childNodes[acctIdx];

acctValues[0] = acctNode.childNodes[0].firstChild;//number
acctValues[1] = acctNode.childNodes[1].firstChild;//title
acctValues[2] = acctNode.childNodes[2].firstChild;//debitamt
acctValues[3] = acctNode.childNodes[3].firstChild;//creditamt
acctValues[4] = acctNode.childNodes[4].firstChild;//debitsign
acctValues[5] = acctNode.childNodes[5].firstChild;//creditsign

if( acctValues[2] == null) {
transCredits.push(acctValues);
} else {
transDebits.push(acctValues);
}
} // end for

//Results
trace("TransactionDetails: " + transDetails);
trace("-----------------------------------------------------------------------------------");
trace("TransactionSummary: " + transSummary);
trace("-----------------------------------------------------------------------------------");
trace("Date: " + transDate);
trace("-----------------------------------------------------------------------------------");
myTransDetails.item.text = transDetails;
myDate.item.text = transDate;
myTransSumm.item.text = transSummary;
for(var idx=0; idx<transDebits.length; idx++) {
trace("Debits Account: " + transDebits[idx]);
trace(" Number: " + transDebits[idx][0]);
trace(" Title: " + transDebits[idx][1]);
trace(" DebitAmt: " + transDebits[idx][2]);
trace(" CreditAmt: " + transDebits[idx][3]);
trace(" DebitSign: " + transDebits[idx][4]);
trace(" CreditSign: " + transDebits[idx][5]);
myDebitTitle1.item.text = transDebits[idx][1];//got this one to work...the others do not

}
trace("-----------------------------------------------------------------------------------");
for(var idx=0; idx<transCredits.length; idx++) {
trace("Credits Account: " + transCredits[idx]);
trace(" Number: " + transCredits[idx][0]);
trace(" Title: " + transCredits[idx][1]);
trace(" DebitAmt: " + transCredits[idx][2]);
trace(" CreditAmt: " + transCredits[idx][3]);
trace(" DebitSign: " + transCredits[idx][4]);
trace(" CreditSign: " + transCredits[idx][5]);

}

}

function fmtArray(arr):String{
var rv:String = "Array (";
var val:Object;
for(var idx:Number=0; idx < arr.length; idx++){
rv += " [" + idx + "] => ";
val = arr[idx];
if(typeof(val) == "object")
rv += fmtArray(val);
else
rv += " " + val.toString();
}
rv += " )";
return(rv);
}

myXML.load("data2.xml"); //URL for data file

-------------------------------XML---------------------------------------

<?xml version="1.0"?>
<LedgerTransaction>
<TransactionDetails>Working from the journal entry for this transaction, we put 12,000 on the debit side for Office Equipment, 2,400 on the debit side for Office Supplies and 14,400 on the credit side for Accounts Payable.</TransactionDetails>
<Date>4/3</Date>
<TransactionSummary>Bought $14,400 worth of Office Supplies and Equipment on credit</TransactionSummary>
<Accounts>
<Account>
<Number>124</Number>
<Title>Office Supplies</Title>
<DebitAmt>2,400</DebitAmt>
<CreditAmt/>
<DebitSign>+</DebitSign>
<CreditSign>-</CreditSign>
</Account>
<Account>
<Number>163</Number>
<Title>Office Equipment</Title>
<DebitAmt>12,000</DebitAmt>
<CreditAmt/>
<DebitSign>+</DebitSign>
<CreditSign>-</CreditSign>
</Account>
<Account>
<Number>201</Number>
<Title>Accounts Payable</Title>
<DebitAmt/>
<CreditAmt>14,400</CreditAmt>
<DebitSign>-</DebitSign>
<CreditSign>+</CreditSign>
</Account>
<Accounts>
</LedgerTransaction>

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

I am also including my source file and XML file. I am using MX2004 Professional.

Thanks in advance!!

Putting Contents Of An Array In Textfields
Yow, I have a problem ...

I have an Array with several Items (between 10-15)
Now i wanted to give out these Items in Textfields dynamically.
Can sumone help me out?

much appreciated

cheers

ChromeD

How Can I Create An Array Of Textfields? [QUICK]
Hi, i'm using this code


Code:
txts = new Array(title,title2);
for(i=0;i<2;i++)
{
txts[i].text=raiz.childNodes[0].childNodes[3].firstChild.childNodes[0];
}
But that does not work...Title and title 2 are two dynamic textfield that i've created in my scene! The problem seems to be the declaration...Does flash allow casting? cuz i tried to cast the "TextField" option and that didn't work as well.

Array Of Textfields - Why Doesnt This Work?
I've got 4 input text fields used for inserting numbers. (i'm making a math addition app for children) When each column is added up and the number inserted in the text box in the same column (working from right to left) it compares that number with the actual number and will display either a tick or cross.

e.g

Answers in text fields:

1 2 3 4

var comparetime: 1234

If textfield0 (which is 4) is equal to comparetime.length-1 (which is 4) then a tick will appear.

Now i thought this code would work, the theory is right, but for some reason it's not even entering the onKeyUp function.


ActionScript Code:
for(var i:Number = 0; i < 4; i++){    var mc:TextField = this["t"+i];        mc.onKeyUp = function():Void    {//for test purtposes        testxt.text = "wooooo!! " + this._name;                switch(this._name.substring(1)) {            case 0:                //if ((this.text != null) && ((comparetime.substring(comparetime.length-1)) != null)) {                    if (this._name.text == comparetime.substring(comparetime.length-1)) {                        _root.attachMovie("tick", "tick", 200);                        tick._x = 34;                        tick._y = 45;                    } else {                        _root.attachMovie("cross", "cross", 200);                        cross._x = this._x;                        cross._y = this._y + 30;                    }                //}            break;            case 1:                //if ((this.text != null) && ((comparetime.substring(comparetime.length-2)) != null)) {                    if (this.text == comparetime.substring(comparetime.length-2)) {                        _root.attachMovie("tick", "tick", 201);                        tick._x = 56;                        tick._y = + 30;                    } else {                        _root.attachMovie("cross", "cross", 201);                        cross._x = this._x;                        cross._y = this._y + 30;                    }                //}            break;

Object Array Of TextFields/need Advanced User To Respond
Hi everyone,

I'm using this code in the first frame trying to create dynamic textFields and assign variable names and textField names dynamically. I need to know if I can create an array of objects and if I'm using the correct syntax for the object array. Also I'm using the same textFormat instance over.

mydata = new LoadVars();
mydata.load("bus.txt");

mydata.onLoad = function (success) {
if (success) {setboxes();
} else {_global.oops = "data didn't load";
trace("data didn't load");
}
}

function setboxes(){
busnames = new Array();
businst = new Array();
objarr = new Array();
busnames = mydata.buslist.split("|");
var i = 0;
var placeit = 0;
//reusable format instance. ?
myTextFormat = new TextFormat();
myTextFormat.font = "Arial";
myTextFormat.size = 12;
myTextFormat.color=0x000000;

for(i=0;i<busnames.length;i++){
//dyanmically assigned name for textField
businst[i] = "txtinsbus_"+i;
//dyanmically assigned variable for textField
setvarb[i] = "txtvarbus_"+i;
//position of textbox
placeit += 50;
objarr[i] = _root.createTextField(businst[i],0,placeit,50,200,300);
objarr[i].background=true;
objarr[i].border=true;
objarr[i].backgroundColor=0xFFFFFF;
objarr[i].borderColor=0x000000;
objarr[i].multiline=true;
objarr[i].html=true;
objarr[i].wordWrap=true;
objarr[i].variable= setvarb[i];
objarr[i].setNewTextFormat(myTextFormat);
}
stop();
}

How Do I Make An Array Of TextFields Elements React To Mouse Events Respectively?
I want to dynamically load text from an XML file into any array of TextFields, and be able change the color of text showing in each textfield element when my mouse moves over each of them.
I have this bit of code here that does this job, however, it is only the last textfield element in the array that would react to my mouse over. Also when I put mouse over other elements, it is also the last element that changes color.
How can it make each element react to my mouse event instead of one single element that changes text color even when my mouse is over other elements?


Here is my xml file named product.xml
<Products>
<Product id="0" Pname = "Glow" />
<Product id="1" Pname = "Opera" />
<Product id="2" Pname = "Georgia" />
</Products>

Please also see below my Actionscript:


ActionScript Code:
import flash.events.MouseEvent;

var urXML:URLRequest;
var ulXML:URLLoader;

//Connect to the xml file
urXML = new URLRequest("product.xml");

//Instantiate loader
ulXML = new URLLoader(urXML);

//Add event listener for load complete
ulXML.addEventListener(Event.COMPLETE, xmlLoaded);

//Load XML into loader object
ulXML.load(urXML);

//Create an XML object that holds the names of each product
var xmlProduct:XML;
var productList: XMLList;
function xmlLoaded(evt:Event) {
    xmlProduct = new XML(ulXML.data);
    trace("xmlProduct: "+ xmlProduct.toXMLString());
    productList = new XMLList(xmlProduct.children());

    var item:XML;
    var pArray:Array = new Array();
    var accumHeight:uint = 0;
    for each (item in productList) {
        trace(item.@Pname.toString());
        var i:TextField = new TextField();
        i.text = item.@Pname.toString();
        trace("i = "+i.text);

        i.addEventListener(MouseEvent.MOUSE_OVER, mouseOverText);
        function mouseOverText(event:MouseEvent):void {
            i.textColor = 0xff0000;
        }
       
        i.addEventListener(MouseEvent.MOUSE_OUT, mouseOutText);
        function mouseOutText(event:MouseEvent):void {
            i.textColor = 0x00ff00;
        }

        i.addEventListener(MouseEvent.MOUSE_DOWN, mouseClickText);
        function mouseClickText(event:MouseEvent):void {
            trace("Hi again!");
        }
       
        pArray[item.@id] = i;
        pArray[item.@id].y = accumHeight;
        accumHeight += 50;
        addChild(pArray[item.@id]);
        trace("pArray = " +pArray[item.@id]);
        pArray[item.@id].width = 100;
        pArray[item.@id].height = 20;
        pArray[item.@id].border = true;
        pArray[item.@id].selectable = false;
        pArray[item.@id].textColor = 0x00ff00;
    }
    trace(pArray.toString());

}

Text From An Input Box To An Array
How can you put all the characters in a text box into an array?

textbox contents:
dad kokrddaddad
array

Code:
var myArray:Array = Array("d", "a", "d", " ", "k", "o", "k", "r", "d", "d", "a", "d", "d", "a", "d");



Code:
b.onRelease = function() {
i = 0;
words.text.toLowerCase().charAt(i)
++i;
??????????
};
Glen Charles Rowell

Input Text To Array
Is there a way to make Array from Input Text?
for example :
I'm fill input text with [[1,1],[1,2]] and I want it to be array in Array variable.
This my code :

PHP Code:



inputtoarray.onRelease = function () {
    tempArray = inputpanel; //input text var
    tempArray = tempArray.split('"'); //<- to object var
    tempArray = tempArray.valueOf();
    trace(tempArray); //var trace
    trace(tempArray.length); //var len trace
    trace(typeof(tempArray)); //var type trace
}; 




Thanks b4

Input Text To Array?
I have a multiline input text box, on button release I want it to read line by line of what the user type in and put it in array. how am I goin to do that?

Thank you for your help.

Form / Input Array?
Hello,

I may just be mising something super simple, but is there a way to get all of the elements, in this case all INPUTS, and put them into an array so that I can loop through them? In particular I'd like to do somenthing like:

<< see attached code snippet below >>

this would allow me to get all of the input names (ultimately for a custom level of pre submission form validation)

Thanks for any help!!

Rich









Attach Code

//NON FUNCTIONAL CODE SNIPPET
for(i=0; i<this.form.elements.length; i++) {
trace(this.form.element[i].name);
}

How To Get Data From Input Text To Array ?
Hi all

I need to know how to get data from input text and send it to Array

and also how to display them out with DText ?

is it Clear

if the Array has its elements it's so easy with me

like this for example (*&*)

var mylist = ["a", "b", "c"];


// this is a cool function that will display mylist elements
// into DText by invoke it and passing arguement to it wwwwowowoow
function loop (nam) {
for (i=0; i<=nam[i]; i++) {
dis += nam[i];
dis += newline;


}
}





loop(mylist);


but as I need that how to get it from input text plz help out with little code post here ... thanks

Putting Input From User Into An Array...
I am trying to make a quiz where people answer the questions then they are stored to an array. I have the thing set up but i can't figure out how to script it to load the user's answer into the array.

Thank you

Store User Input Into An Array
Hi.
I am doing something with buttons labelled 0-9. Let's say the user will be asked to press 10 sets of 3- digit randomly generated numbers.

How i can store the user input inside an array so that i can send results to a database and can keep track of what the user had pressed before he got the correct answer.

Please help. Thanks in advance

Textfile Input -array Problem
Hi,
i am trying to get txt from a txtfile, into a load of dynamic boxes. The problem seems to be with the filling of 'tmp_arr'. All the vars belong to textboxes. i have tested various portions, and the prob is efinitely with the filling of the array. I can see the textfile data in the debug window.


code:

//array/var declaration------------
var tmp_arr = new Array(50);

var name1="";
var name2="";
var name3="";
var name4="";
var name5="";
var name6="";
var name7="";
var name8="";
var name9="";
var name10="";

var score1=0;
var score2=0;
var score3=0;
var score4=0;
var score5=0;
var score6=0;
var score7=0;
var score8=0;
var score9=0;
var score10=0;

var pu1=0;
var pu2=0;
var pu3=0;
var pu4=0;
var pu5=0;
var pu6=0;
var pu7=0;
var pu8=0;
var pu9=0;
var pu10=0;

var sk1=0;
var sk2=0;
var sk3=0;
var sk4=0;
var sk5=0;
var sk6=0;
var sk7=0;
var sk8=0;
var sk9=0;
var sk10=0;


//pull in textfile data
//-----------------------------------

var mtxt="";
var txtFile="mwsscores.txt";

var myVars = new LoadVars();
myVars.load(txtFile);

myVars.onLoad = function(raw) {

tmp_arr = raw.split(",");

}//end function


//fill boxes---------------------
//---------------------------------


var ee =0;
var d=1;
for(c=0;c<=9;c++){



this["name"+d]= tmp_arr[ee];
var ee=ee+1;
this["score"+d]= tmp_arr[ee];
var ee=ee+1;
this["pu"+d]= tmp_arr[ee];
var ee=ee+1;
this["sk"+d]= tmp_arr[ee];
var ee=ee+1;
var d=d+1;

}//end for
var ee=0;





........another simple prob with the power to confuse the great mind.....


thx in advance

EDIT: Replaced [ code ] tags with [ as ] tags - jbum

Parsing Input Into An Array Of Letters
Hi everyone,

I was hoping that someone could help me with a peculiar problem, that I could not find the answer to all over the web with some advanced Google Searching. Here it is: I would like to parse some User Input Text into individual letters (probably using an array so the letters can be used and changed easily).

The goal is to create an encryption flash script, which will take in a user input sentence, and spit out a jumble of "random" letters with a 4-Digit code. The end-user then takes the jumble, puts it in to the box, punches in the 4-Digit Code, and decrypts the message. I understand there may be ActionCrypt and stuff, but I'd enjoy attempting this myself. I have all the other data I need (translating letters in an array into numbers, jumbling the numbers, turning those numbers into letters, and then allowing the end-user to enter those and reverse-engineer the original sentence).

All in all, I only need the code to parse input text (in this case, and for the easiest idea, lets say 10 letter maximum) into an array of individual letters per sector.

To make this easy for me to understand, I'll give you some variables to work with, so if you post code, I understand what you mean with the variables:

input_txt = User Input Box
encrypt_btn = The button one will press, and thus make the (hopefully new) sentence be parsed into an array

So pretty much, I'm assuming the code will begin with the encrypt buttons AS:

"this.on(Release) = function()"

That's the way I imagine it at least... If any of you have an extremely advanced way, that's fine by me. Use all the variables you want, array names.... everything!

Thanks to Everyone

Input Text Fields From Array
This is the code i've got:




theFields = new Array("NAME", "EMAIL", "PHONE", "ADRESS", "COUNTRY");
xpos = 20
ypos = 20
movieclip.prototype.generateTextfields = function(theFields, xpos, ypos)
{
for( i = 0; i < theFields.length; i++)
{
this.createTextField(theFields[i], (xpos * i), 1, (ypos * i), 100, 18);
var tmp = this[theFields[i]];
tmp.text = theFields[i];

defaultFormat = new TextFormat();
defaultFormat.font = "verdana"
defaultFormat.size = 9;

tmp.border = true;
tmp.multiline = true;
tmp.selectable = false;
tmp.background = true;
tmp.type = "input";
tmp.borderColor = 0x000000;
tmp.backgroundColor = 0xcccccc;
tmp.setTextFormat(defaultFormat);

tmp.type = "input";
tmp.selectable = true
}
}



// usage //
_root.createEmptyMovieClip("tfGenerator", 1);
tfGenerator.generateTextfields(theFields, xpos, ypos);

What i want is to create a button that collects the inouted data and send it to a specific e-mail.
Is it possible??

Advanced Checking User Input Against An Array Help
advanced checking user input against an array help

im working on a form that has four input text fields and a submit button, and when the user submits his answers, these need to be checked against a set of values stored in an array. standard validation seems to be easy, where the first choice is verified against the first answer, and so on, but i've gotten stuck as the answers can be entered in any order, and while there are only four correct answers, there are more than four acceptable answers.

say this is the array

answers = ["math","physics","chem","chemistry","computer","co mputers","computer science"]

now there are four input boxes where the user has to enter his answers. i know that there are only four correct answers in total (math, physics, chemistry & computer science) but other acceptable answers are also available, since the user might input chem or chemistry, or maybe copmuter, computers or computer science

the four input text fields are answer1_txt, answer2_txt, answer3_txt & answer4_txt. how can i verify the input answers against the array ensuring that all four answers are correct without any duplication of answers (that is, someone enters math, physics, chem & chemistry - this will verify as all correct with standard checking)

any help would be greatly appreciated

sidrao

Input Text To Array Variable Not Working..
Hello all, I am working on a line rider/ free rider style game in flash 8 (which is coming along quite nicely ). For the whole night I've been trying to create a way to save and load data simply off text and have finally come up with a basic solution for it! I have my information all stored into an array neatly to be later used with the function lineTo upon load. My problem here is that when I actually input the data into the textbox to be picked up by the load button it does not draw the lines like its supposed to.

My load button has the following code:

onClipEvent (enterFrame) {
onRelease = function() {
var points = new Array(_root.xInput);
_root.lineStyle(5, 0xFF0000);
_root.moveTo(points[3].x, points[3].y);
for(i = 0; i < points.length;i++)
_root.lineTo(points[ i ].x, points[ i ].y);
}
}

Where _root.xInput refers to the location of the input textbox. Now I have tested actually filling in the x and y coordinates manually and it does work when the load button is pressed. In addition I checked if my paths were correct and if the load button was actually interacting with the input text already so thats not the problem. Anyone know why it wont accept my input directly from the textbox in the movie? Any help is appreciated, this problem just makes no sense to me =.

The code I am copy and pasting into the input text is this:
{x:321, y:97}, {x:319, y:95}, {x:316, y:95}, {x:310, y:95}, {x:302, y:95}, {x:291, y:95}, {x:279, y:96}, {x:265, y:98}, {x:254, y:102}, {x:246, y:106}, {x:240, y:112}, {x:236, y:114}, {x:234, y:118}, {x:231, y:122}, {x:230, y:125}, {x:229, y:130}, {x:229, y:134}, {x:229, y:138}, {x:232, y:144}, {x:236, y:150}, {x:240, y:156}, {x:245, y:160}, {x:251, y:165}, {x:259, y:170}, {x:266, y:175}, {x:272, y:181}, {x:279, y:186}, {x:287, y:191}, {x:292, y:197}, {x:294, y:201}, {x:294, y:205}, {x:294, y:208}, {x:293, y:213}, {x:290, y:218}, {x:285, y:224}, {x:279, y:229}, {x:270, y:234}, {x:259, y:239}, {x:247, y:243}, {x:237, y:246}, {x:229, y:250}, {x:224, y:251}, {x:222, y:252}, {x:220, y:253}, {x:219, y:253}, {x:218, y:253}, {x:217, y:253}, {x:216, y:253}, {x:214, y:253}, {x:213, y:253}

Creating An Array From Rows Of Input Boxes?
I have managed to create my table of input boxes and radio buttons, but now I have to make separate arrays from each row of input boxes. I then need to place those arrays into a bigger array that I can push new information to as new rows of input boxes are added. What element in my code do I need to use as a control in my loopto create these arrays of the instance names of my boxes? My code so far is:


Code:
import mx.controls.RadioButton;
//attach header movieclip for NA
this.attachMovie("naTable", "naTable_mc", this.getNextHighestDepth(), {_x:86.7, _y:97.1});
//loop to create multidimensional array of input boxes
var row:Number = 21;
var col:Number = 15;
var depth:Number = 0;
var rowArr:Array = new Array(row);
var i:Number;
var j:Number;
for (i=0; i<row; i++)
{
rowArr[i] = new Array(col);
for (j=0; j<col; j++)
{
rowArr[i][j] = "["+i+"]["+j+"]";
}
//trace(rowArr[i]);
}
//code to iterate through multi array elements
var outerArrayLength:Number = rowArr.length;
for (i=0; i<outerArrayLength; i++)
{
var innerArrayLength:Number = rowArr[i].length;
for (j=0; j<innerArrayLength; j++)
{
var tableFormat:TextFormat = new TextFormat();
tableFormat.font = "Arial";
tableFormat.bold = true;
tableFormat.size = 11;
tableFormat.align = "center";
_root.createTextField("NAr"+i+"_c"+j, depth, 87.0+(33.5*j), 117.1+(i*20.7), 28.1, 16.2);
var _box:TextField = _root["NAr"+i+"_c"+j];
_box.type = "input";
_box.selectable = true;
_box.restrict = "DdEeNnXx";
_box.border = true;
_box.multiline = false;
_box.maxChars = 1;
_box.textColor = 0000000;
_box.setNewTextFormat(tableFormat);
depth++;
trace(_box);
_box.onChanged = function(srcTxtBox:TextField) {
var origVal:String = srcTxtBox.text;
srcTxtBox.text = origVal.toUpperCase();
};
}
}

//loop to create radio buttons
var row:Number = 18;
var col:Number = 3;
var depth:Number = 0;
var naRadButton:Array = new Array(row);
var k:Number;
var l:Number;
for (k=3; k<21; k++)
{
naRadButton[k] = new Array(col);
for (l=0; l<col; l++)
{
naRadButton[k][l] = "["+k+"]["+l+"]";
}
}
var yPos:Number = 0;
var xPos:Number = 0;
//iterate through inner radiobutton array
var outerRBlength:Number = naRadButton.length;
for (k=0; k<outerRBlength; k++)
{
var innerRBlength:Number = naRadButton[k].length;
for (l=0; l<innerRBlength; l++)
{
createClassObject(mx.controls.RadioButton, "Nar"+[k]+"rb"+[l], this.getNextHighestDepth(), {label:"D", groupName:"den"+[k], fontFamily:"Verdana", fontSize:"12"});
var naRadioName:RadioButton = this["Nar"+[k]+"rb"+[l]];
//trace(naRadioName);
naRadioName.setSize(25, 25);
//xpos=-40+(33.5*l)
xpos=9+(24*l)
ypos=115+(k*20.7)
naRadioName.move(xpos, ypos, true);

}
}

Input Text To Array Variable Not Working..
Hello all, I am working on a line rider/ free rider style game in flash (which is coming along quite nicely ). For the whole night I've been trying to create a way to save and load data simply off text and have finally come up with a basic solution for it! I have my information all stored into an array neatly to be later used with the function lineTo upon load. My problem here is that when I actually input the data into the textbox to be picked up by the load button it does not draw the lines like its supposed to.

My load button has the following code:

onClipEvent (enterFrame) {
onRelease = function() {
var points = new Array(_root.xInput);
_root.lineStyle(5, 0xFF0000);
_root.moveTo(points[3].x, points[3].y);
for(i = 0; i < points.length;i++)
_root.lineTo(points[ i ].x, points[ i ].y);
}
}

Where _root.xInput refers to the location of the input textbox. Now I have tested actually filling in the x and y coordinates manually and it does work when the load button is pressed. In addition I checked if my paths were correct and the load button was actually interacting with the input text already so thats not the problem. Anyone know why it wont accept my input directly from the textbox in the movie? Any help is appreciated, this problem just makes no sense to me =.

The code I am copy and pasting into the input text is this:
{x:321, y:97}, {x:319, y:95}, {x:316, y:95}, {x:310, y:95}, {x:302, y:95}, {x:291, y:95}, {x:279, y:96}, {x:265, y:98}, {x:254, y:102}, {x:246, y:106}, {x:240, y:112}, {x:236, y:114}, {x:234, y:118}, {x:231, y:122}, {x:230, y:125}, {x:229, y:130}, {x:229, y:134}, {x:229, y:138}, {x:232, y:144}, {x:236, y:150}, {x:240, y:156}, {x:245, y:160}, {x:251, y:165}, {x:259, y:170}, {x:266, y:175}, {x:272, y:181}, {x:279, y:186}, {x:287, y:191}, {x:292, y:197}, {x:294, y:201}, {x:294, y:205}, {x:294, y:208}, {x:293, y:213}, {x:290, y:218}, {x:285, y:224}, {x:279, y:229}, {x:270, y:234}, {x:259, y:239}, {x:247, y:243}, {x:237, y:246}, {x:229, y:250}, {x:224, y:251}, {x:222, y:252}, {x:220, y:253}, {x:219, y:253}, {x:218, y:253}, {x:217, y:253}, {x:216, y:253}, {x:214, y:253}, {x:213, y:253}

Help Refreshing Library MovieClip Array Based On Input Text
Hi!

I've built this fancy airport board application where you can write your sentance in the input field and by that change the board.
You can see here an example of what I have at the moment.

here's the code I have:

ActionScript Code:
//putting some starting text in the text field
input_txt.text = "Oceanic Flight 815";

//initializing variables
var holder_mc:Holder = new Holder();
var letter_mc:Letter = new Letter();
var sentance:String = new String(input_txt.text);
var arrayLetters:Array = sentance.split("");

//button CLICK listener and relative action
ok_btn.addEventListener(MouseEvent.CLICK, ok_btn_CLICK);
function ok_btn_CLICK(e:MouseEvent):void{
    BuildSentance();
}

//The action that builds the sentances based on the input text
function BuildSentance():void{
   
    for (var i:uint=0; i<arrayLetters.length; i++) {
       
        //removeChild(holder_mc); ???? --> Need to remove holder_mc when already exists in order to reload the new sentance.
        //Or somehow reload/refresh the sentance
       
        //Need to somehow apply a timer that sets an interval of 1 second between the lettering fallout.
       
       
        //Calls Holder from Library and adds it to the Stage (this will be the container for the sentance)
        var holder_mc:Holder = new Holder();
        this.addChild(holder_mc);
        holder_mc.x = 10;
       
        //breaking input text into letters
        sentance = input_txt.text;
        arrayLetters = sentance.split("");
       
        //Calls Letter from Library and adds it to holder_mc
        var letter_mc:Letter = new Letter();
        holder_mc.addChild(letter_mc);
        letter_mc.x = 17*i;
        letter_mc.y = (10);
       
        //Adds letters to letter_mc's
        letter_mc.numbers1.letra_txt.text = arrayLetters[i];
        letter_mc.numbers2.letra_txt.text = arrayLetters[i];
        letter_mc.numbers3.letra_txt.text = arrayLetters[i];
    }
}
BuildSentance();

I'm having 2 problems:
1) on applying some sort of timer that throws the sentance letters one of a time to the board;
2) on updating the board, by removing the older sentance and throwing in the new one.

Can anybody help me on this?
Thanks in advance.

Help Refreshing Library MovieClip Array Based On Input Text
Hi!

I've built this fancy airport board application where you can write your sentance in the input field and by that change the board.
You can see here an example of what I have at the moment.

here's the code I have:

Code:
//putting some starting text in the text field
input_txt.text = "Oceanic Flight 815";

//initializing variables
var holder_mc:Holder = new Holder();
var letter_mc:Letter = new Letter();
var sentance:String = new String(input_txt.text);
var arrayLetters:Array = sentance.split("");

//button CLICK listener and relative action
ok_btn.addEventListener(MouseEvent.CLICK, ok_btn_CLICK);
function ok_btn_CLICK(e:MouseEvent):void{
BuildSentance();
}

//The action that builds the sentances based on the input text
function BuildSentance():void{

for (var i:uint=0; i<arrayLetters.length; i++) {

//removeChild(holder_mc); ???? --> Need to remove holder_mc when already exists in order to reload the new sentance.
//Or somehow reload/refresh the sentance

//Need to somehow apply a timer that sets an interval of 1 second between the lettering fallout.


//Calls Holder from Library and adds it to the Stage (this will be the container for the sentance)
var holder_mc:Holder = new Holder();
this.addChild(holder_mc);
holder_mc.x = 10;

//breaking input text into letters
sentance = input_txt.text;
arrayLetters = sentance.split("");

//Calls Letter from Library and adds it to holder_mc
var letter_mc:Letter = new Letter();
holder_mc.addChild(letter_mc);
letter_mc.x = 17*i;
letter_mc.y = (10);

//Adds letters to letter_mc's
letter_mc.numbers1.letra_txt.text = arrayLetters[i];
letter_mc.numbers2.letra_txt.text = arrayLetters[i];
letter_mc.numbers3.letra_txt.text = arrayLetters[i];
}
}
BuildSentance();
I'm having 2 problems:
1) on applying some sort of timer that throws the sentance letters one of a time to the board;
2) on updating the board, by removing the older sentance and throwing in the new one.

Can anybody help me on this?
Thanks in advance.

Help Refreshing Library MovieClip Array Based On Input Text
Hi!

I've built this fancy airport board application where you can write your sentance in the input field and by that change the board.
You can see here(http://www.adhesive-studio.com/dev/AirportBoard_Sentances.html) an example of what I have at the moment.

here's the code I have:
Code:

//putting some starting text in the text field
input_txt.text = "Oceanic Flight 815";

//initializing variables
var holder_mc:Holder = new Holder();
var letter_mc:Letter = new Letter();
var sentance:String = new String(input_txt.text);
var arrayLetters:Array = sentance.split("");

//button CLICK listener and relative action
ok_btn.addEventListener(MouseEvent.CLICK, ok_btn_CLICK);
function ok_btn_CLICK(e:MouseEvent):void{
    BuildSentance();
}

//The action that builds the sentances based on the input text
function BuildSentance():void{
   
    for (var i:uint=0; i<arrayLetters.length; i++) {
       
        //removeChild(holder_mc); ???? --> Need to remove holder_mc when already exists in order to reload the new sentance.
        //Or somehow reload/refresh the sentance
       
        //Need to somehow apply a timer that sets an interval of 1 second between the lettering fallout.
       
       
        //Calls Holder from Library and adds it to the Stage (this will be the container for the sentance)
        var holder_mc:Holder = new Holder();
        this.addChild(holder_mc);
        holder_mc.x = 10;
       
        //breaking input text into letters
        sentance = input_txt.text;
        arrayLetters = sentance.split("");
       
        //Calls Letter from Library and adds it to holder_mc
        var letter_mc:Letter = new Letter();
        holder_mc.addChild(letter_mc);
        letter_mc.x = 17*i;
        letter_mc.y = (10);
       
        //Adds letters to letter_mc's
        letter_mc.numbers1.letra_txt.text = arrayLetters[i];
        letter_mc.numbers2.letra_txt.text = arrayLetters[i];
        letter_mc.numbers3.letra_txt.text = arrayLetters[i];
    }
}
BuildSentance();

I'm having 2 problems:
1) on applying some sort of timer that throws the sentance letters one of a time to the board;
2) on updating the board, by removing the older sentance and throwing in the new one.

Can anybody help me on this?
Thanks in advance.

Copyright © 2005-08 www.BigResource.com, All rights reserved