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 377399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:41:33+00:00 2026-05-12T14:41:33+00:00

Hi :) my question today is how to change a textFormat on a textfield.

  • 0

Hi 🙂 my question today is how to change a textFormat on a textfield.

I have a textFormat that has white text and one that has green text, on a button rollover I need to swap that textFormat on my textField to one that has green text. The textFields are getting their .text data from an Array to complicate things…


Arrays, Text Formats, Buttons, TextField Creation code:

var cataText:Array = [] //My text array

// Text Formats
var a12 = new TextFormat();
    a12.font = "Arial";
    a12.size = 12;
    a12.color = 0xFFFFFF;

var a12Green = new TextFormat();
    a12Green.font ="Arial";
    a12Green.size = 12;
    a12Green.color = 0xA7D23F;


// Create the Nav Buttons -----------------------------------
function createNav()
{
     for (var i:Number = 0; i < myXMLArray.lenght; i++)
         navButton = new NavButton();
         navButton.name = "button" +i;
         navButton.x = i * (SIZE + SPACING);
         navButton.y = buttonY;
         thumbsMov.addChild(navButton);

         buttons.push(navButton)
         buttons[i].addEventListener(MouseEvent.MOUSE_UP, handleButtonClick);
         buttons[i].addEventListener(MouseEvent.ROLL_OVER, handleButtonOver);
         buttons[i].addEventListener)MouseEvent.ROLL_OUT, handleButtonOff);
         buttons[i].useHandCursor = true;

     var traceText:TextField = new TextField();
         traceText.defaultTextFormat = a12;
         traceText.selectable = false;
         traceText.mouseEnabled = false;
         traceText.x = i * (SIZE + SPACING);
         traceText.y = 186;
         traceText.width = 116;
         traceText.height = 20;
         traceText.text = myXMLArray[i].id; // <setting the text
         thumbsMov.addChild(traceText);

         cataText.push(traceText);  // <The array my text is getting placed in

} 

}


Button Listener Code and where I’m trying to change textFormat

// Button Listener  -----------------------------------
function handleButtonOver(event:MouseEvent):void
{
    var button:NavButton = event.target as NavButton;
    if(button)
       button.nextFrame()
       thumbsMov.traceText.defaultTextFormat = a12Green;  //< trying to assign new textFormat
       thumbsMov.traceText.text = cataText[0].text; // < figured this is how I would set the text again...
       trace(cataText[0].text);
}

trace(cataText[0].text); //< this will trace out only if I comment out the 2 lines above it 🙁 because I get the error below on rollover if the 2 lines above are not commented out:

My error:
TypeError: Error #1010: A term is undefined and has no properties.
at test2_fla::MainTimeline/handleButtonOver()

I’m guessing that I need some sort of listenerEvent perhaps? To listen for some kind of variable change and then swaps out the textFormat, but I’m not sure about how to proceed that way.

  • 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. Editorial Team
    Editorial Team
    2026-05-12T14:41:34+00:00Added an answer on May 12, 2026 at 2:41 pm

    What happens if you change

    thumbsMov.traceText.defaultTextFormat = a12Green;
    

    to

    thumbsMov.traceText.setTextFormat(a12Green);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I already asked a question today : This one Now I have a code
Earlier today I asked a question about environ , and one of the more
Question Can I build a image database/library that has an e-commerce style checkout system
I have asked this question today already but this time I want to know
That is basically my question. It is showing me today's date and not a
a noob question here. I have a very strange situation that's very puzzling to
First: I'm shocked that I have to ask this question. Nowhere in the docs
I was going to Ask a Question earlier today when I was presented to
Earlier today a question was asked regarding input validation strategies in web apps .
Here's a quick question I've been banging my head against today. I'm trying 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.