Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > Adobe Web Programming > Flash (all versions)
Password Reminder
Register
| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #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
Reply With Quote
  #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);
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 05:16 AM.


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