Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > Adobe Web Programming > Flash (all versions)
| Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Flash (all versions) section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old December 18th, 2007, 06:16 AM
Friend of Wrox
 
Join Date: May 2005
Location: Nürnberg/München, , Germany.
Posts: 140
Thanks: 0
Thanked 0 Times in 0 Posts
Default change the color of selected text dynamically

Hallo everyone,

I want to change dynamically the text color when I mark and select a text. The fact is:

I am having a procedure which changes the text color to red if there is an error such as:

if (minute1 == 0) {
     result.text = "Error. Not applicable";
     result.textColor = 0xBE0C26;
     clearAll();
}

This is just a piece of code from my calculator whichconverts the values between different units such as minute second day hour etc.

clearAll() function sets the default values. If I define the default text value under my clearAll function it changes the error message's color to the default text value. That's why I can't define its default color value under clearAll. But the text color remains as red when I try to enter another value. That's why I need such a function which turns the selected text color to its default value. I tried to use the

 formStyleFormat.textSelected = 0xffffff;

function but it didn't help me. Can anyone help me?

Your attitude determines your altitude
__________________
Your attitude determines your altitude
  #2 (permalink)  
Old December 18th, 2007, 11:11 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Oklahoma City, Oklahoma, USA.
Posts: 249
Thanks: 0
Thanked 0 Times in 0 Posts
Default

To change the font colors try this, you need to set up a TextFormat() first, then call it later where ever you need it changed.

var DefaultTxt = new TextFormat();
DefaultTxt = 0xBE0C26;

var ErrorTxt = new TextFormat();
ErrorTxt.color = 0xffffff;

formStyleFormat.setTextFormat(DefaultTxt);
formStyleFormat.setTextFormat(ErrorTxt);


Similar Threads
Thread Thread Starter Forum Replies Last Post
change the text color of (<xsl:value-of select="De ismailc XSLT 2 August 25th, 2008 07:25 AM
Change color of text in a listbox? ja8261 VB.NET 2002/2003 Basics 11 April 27th, 2007 10:14 AM
How to change the color of selected row of an HTML bhavna HTML Code Clinic 4 February 11th, 2007 09:22 PM
Need to change color of text in a text box? larry HTML Code Clinic 6 December 29th, 2006 05:14 AM
How to change color of selected external listview method VB How-To 8 October 20th, 2006 07:01 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.