Skip to main content
dalvydasv27776233
Inspiring
January 19, 2016
Answered

AS3 SharedObject From Input to dynamic text field in other frames..

  • January 19, 2016
  • 2 replies
  • 1913 views

Hello I Have script:

var gTeams:Array = new Array(teamName1,teamName2, teamName3);

var so:SharedObject=SharedObject.getLocal("dataSO");

var shared_data:String;

for (var i:int=0; i<gTeams.length; i++) {

    if (so.data["team_name_" + i]) {

        gTeams.text = so.data["team_name_" + i];

    }

}

function saveTextF():void{

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

so.data["team_name_"+i]=gTeams.text;

}

so.flush();

}

In other frames I have dynamic text fields:

tName1, tName2, tName3.

But I cant get text from input text fields.

How I can do that?


Thanks for your help

This topic has been closed for replies.
Correct answer nezarov

Someone?


Use Event.CHANGE instead of TextEvent.TEXT_INPUT:

teamName1.addEventListener(Event.CHANGE, tName1F);

function tName1F(e:Event):void{

.

.

.

Note that the reply number 8 is the correct answer to your question.

2 replies

dalvydasv27776233
Inspiring
January 19, 2016

My fonts is embeded but in dynamictext fields I cant see last character and i dont understand why?

kglad
Community Expert
Community Expert
January 19, 2016

make sure your textfield is large enough to display all the characters.  make sure your textfield is multiline if there's not enough room on one line and increase its height to display everything or scroll the textfield.

dalvydasv27776233
Inspiring
January 20, 2016

If I write "ONE" i see "ON". If i write one character see just empty field. If I write Johan Straus I see Johan Strau And why I cant understand... With all fiels in flash everything is ok with these nop.

kglad
Community Expert
Community Expert
January 19, 2016

save the text property of those textfields (after user entry) into a variable (or variables).  you can then use those variable values when the input textfields no longer exist.

dalvydasv27776233
Inspiring
January 19, 2016

I get String cant be null or something like that.

dalvydasv27776233
Inspiring
January 19, 2016

Like this?:

var tName1 = teamName1.text;

var tName2 = teamName2.text;

var tName3 = teamName3.text;

tName1.text = tName1;

In dynamic text field I get: tekst "[object TextField]"