Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 159239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T10:49:25+00:00 2026-05-11T10:49:25+00:00

When I create a TextField in AS3 with multiline set to true and equate

  • 0

When I create a TextField in AS3 with multiline set to true and equate the text to say:

‘Hola \r hola’

I am unable to retrieve the index position of \r using indexOf function, it always returns -1

Does anyone know what I’m doing wrong?

var txt:TextField; txt.multiline = true;  txt.text = 'Hola \r hola';  //txt now renders fine with the line break  trace(txt.indexOf('\r')); //Returns -1, should return the valid index of \r in txt 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T10:49:26+00:00Added an answer on May 11, 2026 at 10:49 am

    Following Mikko’s answer I gave it a try :

    var textField:TextField = addChild(new TextField()) as TextField; textField.multiline = true;  textField.text = 'test \r test';  trace('result>' + textField.text.indexOf('\r')); 

    This code traces :

    result>5 

    … Just as expected.

    If it still doesn’t work for you, first try to search for another character than \r, if this works also try to search for \n. Maybe the line feed gets transformed somehow. (which OS are you on?)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'd like to create a text field with a dropdown list that lets the
Create a flat text file in c++ around 50 - 100 MB with the
Create a file called Valid[File].txt and stick some text in it. Start powershell and
Is it possible to do the following using AS3 and Flash CS3 IDE? The
Does anyone know how to create a dynamic textfield with a visible border and
first time posting here. I'm using a loop to create 3 buttons, but my
I need to create one textfield custom components which accepts only credit card number
I am able to create JFormatted TextField that accepts only float values,but I am
as you see this is a class create 4 text Fields , what i
There doesn't seem to be any tried and true set of best practices to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.