pixystk
asked on
Black Text Input needs opposite color highlight
I have an input box that has white text set within flash with a black box layered behind it.
Is there a way to modify the highlight and font color of the input text when selected with white bkgd/ black text instead of the default black bkgd /white text?
I have show border unselected so I can show the black box from behind.
Is there a way to modify the highlight and font color of the input text when selected with white bkgd/ black text instead of the default black bkgd /white text?
I have show border unselected so I can show the black box from behind.
I can suggest advanced solution.
You can get full control on your TextInput component by implementing custom skin.
For example this code will remove borders and background color
<mx:TextInput borderSkin="{null}" text="Hello"/>
By default TextInput borderSkin is "mx.skins.halo.HaloBorder"
You can create your custom class and extends from HaloBorder and override updateDisplayList(w:Number , h:Number):void function.
You can get full control on your TextInput component by implementing custom skin.
For example this code will remove borders and background color
<mx:TextInput borderSkin="{null}" text="Hello"/>
By default TextInput borderSkin is "mx.skins.halo.HaloBorder"
You can create your custom class and extends from HaloBorder and override updateDisplayList(w:Number
Well I agree @dgofman but as far as I understood the question, the author doesn't use Flex but native Flash.
ASKER
Yep, I'm strictly using flash/actionscript 3, so I'm still playing with the solution suggested first.
Unfortunately it doesn't look like there's an "easy" fix for this. This suggestion tho works for regular text and not necessarily input text.
Just for confirmation, I need to create a /com folder and inside it a /digitalflipbook folder then a /text folder and that will be where the .as file resides? Once it's actually there, do I need to modify the path within the .as file that references com.digitalflipbook.text and just call the class??
Thanks
Unfortunately it doesn't look like there's an "easy" fix for this. This suggestion tho works for regular text and not necessarily input text.
Just for confirmation, I need to create a /com folder and inside it a /digitalflipbook folder then a /text folder and that will be where the .as file resides? Once it's actually there, do I need to modify the path within the .as file that references com.digitalflipbook.text and just call the class??
Thanks
Are you using ActionScript codding or TextInput from "Component" libraries?
ASKER
I'm not using components. I've added a textInput to the stage and gave it an instance name and I'm calling it in AS.
Last question, are you using Adobe Flash CS3/4 Professional or Eclipse ActionScript Project?
ASKER
Flash CS4 Pro
In this case you can use TextInput from fl library
import fl.controls.TextInput;
var textFmt:TextFormat = new TextFormat();
textFmt.color = 0xFFFFFF;
textFmt.font = "Arial"
textFmt.size = 12;
var myTextInput:TextInput = new TextInput();
myTextInput.text = "HELLO WORLD";
myTextInput.textField.back ground = true;
myTextInput.textField.back groundColo r = 0x000000;
myTextInput.setStyle("text Format", textFmt);
myTextInput.move(10, 10);
addChild(myTextInput);
import fl.controls.TextInput;
var textFmt:TextFormat = new TextFormat();
textFmt.color = 0xFFFFFF;
textFmt.font = "Arial"
textFmt.size = 12;
var myTextInput:TextInput = new TextInput();
myTextInput.text = "HELLO WORLD";
myTextInput.textField.back
myTextInput.textField.back
myTextInput.setStyle("text
myTextInput.move(10, 10);
addChild(myTextInput);
ASKER
I'm getting errors on fl.controls.TextInput
1172: Definition fl.controls:TextInput could not be found.
is there a library I need to update?
1172: Definition fl.controls:TextInput could not be found.
is there a library I need to update?
FL library by default exisits in your Flash Player project.
Click File->Publish Settings..
Click Flash Tab
Click on Settings... button
Pick "Library Path" tab
You should add line
$(AppConfig)/ActionScript 3.0/libs
Click File->Publish Settings..
Click Flash Tab
Click on Settings... button
Pick "Library Path" tab
You should add line
$(AppConfig)/ActionScript 3.0/libs
ASKER
that's in there already... any other suggestions?
ASKER
ah!! I got it... I added a textInput component to the stage and deleted it so it's now in my library. Voila, no errors.
So would I then create an if statement that checks to see if the text is selected then change the backgroundcolor and text color???
So would I then create an if statement that checks to see if the text is selected then change the backgroundcolor and text color???
Add Classpath manually point to
C:\Program Files (x86)\Adobe\Adobe Flash CS4\Common\Configuration\C omponent Source\ActionScript 3.0\User Interface
C:\Program Files (x86)\Adobe\Adobe Flash CS4\Common\Configuration\C
What do you mean?
So would I then create an if statement that checks to see if the text is selected then change the backgroundcolor and text color???
So would I then create an if statement that checks to see if the text is selected then change the backgroundcolor and text color???
ASKER
Wow I really fooked my initial question. I was actually trying to ask this:
( i mistook highlight for selection color)
How do I get the background and text to change to it's opposite when you select the input text if it's on a black background.
( black bkgd w/ white text... selected is white bkgd with black text.)
Sorry for the confusion.
Moderators... please let me know if I should start over.
( i mistook highlight for selection color)
How do I get the background and text to change to it's opposite when you select the input text if it's on a black background.
( black bkgd w/ white text... selected is white bkgd with black text.)
Sorry for the confusion.
Moderators... please let me know if I should start over.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
YES! Sorry it took so long to explain. I was thinking "highlight:" as in hightlighter pen.
Where is the button to give extra points for patience and understanding?!
Thanks so much!
Where is the button to give extra points for patience and understanding?!
Thanks so much!
I only can suggest to open a new ticket and give points to ChristoferDutz.
He first submitted an answer about ColorTransform / invert. :)
He first submitted an answer about ColorTransform / invert. :)
http://yourpalmark.com/2007/08/13/changing-selection-color-on-dynamic-textfields/