Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Creating a button that acts on text input

Explorer ,
Apr 07, 2018 Apr 07, 2018

Ive something similar, and cant get it to work.

im trying a simple code i got of flash for dummies, and it may be old :

its a movie clip box , instance is ball1, and a button called go, and and text input called size,

it said :Click the Character button on the Property inspector to open the Character Options dialog box and choose Specify Ranges. Then choose Numerals [0–9] and click OK.

on (release) {ball1._width = size;} does work so i tried

sepete layered objects each written on the timeline, as follows

size._visible = true;

ball1._visible = true;

go._visible = true;

go.onrelease = function(){

ball1._width = .size;

}

i cannot set character options as theres no option to do so, what can i do ?

i need it in AS 2.0 as the above is not functioning

if i add another text input box for the height what would the code be ?

TOPICS
ActionScript
1.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Apr 07, 2018 Apr 07, 2018

when go is clicked to what do you want change ball1's width?  the number in your textfield?

if so, use:

go.onrelease = function(){

ball1._width = Number(size.text);

}

Translate
Explorer ,
Apr 07, 2018 Apr 07, 2018

can anyone or a few comment please,

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 07, 2018 Apr 07, 2018

when go is clicked to what do you want change ball1's width?  the number in your textfield?

if so, use:

go.onrelease = function(){

ball1._width = Number(size.text);

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 07, 2018 Apr 07, 2018

Hi thank you i was at the adobe site and said thank you, and that it was

helpful, i asked how to get the tab button to scroll through text inputs

and the "return/enter button to press the submit button.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 07, 2018 Apr 07, 2018

use the tabIndex property of display objects to order the indexing.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 07, 2018 Apr 07, 2018

Okay ill do so tomorrow, its 10 pm here in south africa . thank you so much

, i wanted to ask tomorrow if the duplicates will have new instance names,

is it tfy, or tf or is that code ?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 07, 2018 Apr 07, 2018

the duplicated textfields will all have different names (eg, tf_<somenumber>).

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 08, 2018 Apr 08, 2018

how do i keep a record of the all the "new filled text input fields" ?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 08, 2018 Apr 08, 2018

you could store them in an array:

var tfA:Array = [];

.

.

this._parent.createTextField("tf_"+d,...);

tfA.push(this._parent['tf_'+d]);

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 09, 2018 Apr 09, 2018

I have a code that has helped me to take a text input field and replicate it, is this array code the same as this :

go1.onRelease = function() {

var d:Number = this._parent.getNextHighestDepth();

this._parent.createTextField("tf_"+d,d,enter._x,enter._y + next_tfY + 40,150,40);

this._parent['tf_' + d].text = size.text;

this._parent['tf_' + d].border = true;

size.text = '';

next_tfY += 40;

};

does this code have an array already? or does it need extra coding to beable to retrieve the entered data by a button

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 09, 2018 Apr 09, 2018

no array is used in that code.  this code stores the created textfields in an array:

var tfA:Array = [];

go1.onRelease = function() {

var d:Number = this._parent.getNextHighestDepth();

this._parent.createTextField("tf_"+d,d,enter._x,enter._y + next_tfY + 40,150,40);

tfA.push(this._parent['tf_' + d])

this._parent['tf_' + d].text = size.text;

this._parent['tf_' + d].border = true;

size.text = '';

next_tfY += 40;

};

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 09, 2018 Apr 09, 2018

okay thank you, so without the array code as above is the results still traceable and able to be used in further functions, or does an array need to be used to do further functions ?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 09, 2018 Apr 09, 2018

the array would be used outside the go1 onrelease to reference, move, remove etc the created textfields.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 09, 2018 Apr 09, 2018

i googled array and got this :

For example, a search engine may use an array to store Web pages found in a search performed by the user. When displaying the results, the program will output one element of the array at a time. This may be done for a specified number of values or until all the values stored in the array have been output. While the program could create a new variable for each result found, storing the results in an array is much more efficient way to manage memory.

The syntax for storing and displaying the values in an array typically looks something like this:

arrayname[0] = "This ";
arrayname[1] = "is ";
arrayname[2] = "pretty simple.";

print arrayname[0];
print arrayname[1];
print arrayname[2];

The above commands would print the first three values of the array, or "This is pretty simple." By using a "while" or "for" loop, the programmer can tell the program to output each value in the array until the last value has been reached. So not only do arrays help manage memory more efficiently, they make the programmer's job more efficient as well.

im not sure if its code for dreamweaver or adobe flash, but the other way with without using an array can i also do functions, will it use alot more memory in adobe flash

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 09, 2018 Apr 09, 2018
LATEST

oh okay,

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines