Skip to main content
Known Participant
November 21, 2017
Question

replace " " with "#"

  • November 21, 2017
  • 1 reply
  • 286 views

i can use the following code in the test environment to swap space for hashtags as i type - but it doesn't work on the iPhone. I'm guessing that the text fields can listen for changes?

Is there a way around it? a workaround?

myText.addEventListener(Event.CHANGE, checker);

var str:String

var search:String

var replace:String

function checker(e:Event):void{

  str=this.myText.text

  search=" "

  replace="#"

  strReplace()

}

function strReplace(evt:Event=null):void {

str=str.split(search).join(replace);

  this.myText.text=str

}

This topic has been closed for replies.

1 reply

Inspiring
November 22, 2017

You need to use a StageText not a TextField