Results 1 to 1 of 1
  1. #1
    Demon's Avatar
    Join Date
    Jul 2015
    Gender
    male
    Location
    Lost
    Posts
    1,095
    Reputation
    86
    Thanks
    316
    My Mood
    Angelic

    Simple Text Outline

    I'm bored.. working on a new project so might as well do other stuff while I'm at it.

    This example will be using Skilly's [Educational Source], as I'm assuming it's the new HOT source... and also happens to be the source that I'm testing/working with. It shouldn't really matter what source you use as this more of a as3 basics tutorial.

    Navigate to: TitleMenuOption.as and remove the dropShadow filter from the textField. (You could do this more dynamically and remove it when the outline is being done, but I find the dropShadow filter to be kind of shit so just remove it)
    Code:
     public function setText(text:String) : void
          {
             name = text;
             if(this.textField)
             {
                removeChild(this.textField);
             }
             this.textField = new SimpleText(this.size,txtClr,false,0,0);
             this.textField.setBold(bold);
             this.textField.text = text;
             this.textField.updateMetrics();
             addChild(this.textField);
          }

    now add these functions:
    Code:
    public function addOutline(thickness:int = 1, clr:uint = 0):void {
               var filter:GlowFilter = new GlowFilter(clr, 1, thickness, thickness, thickness * 10, BitmapFilterQuality.HIGH);
               filters = [filter];
           }
    
           public function removeOutline():void {
               filters = [];
           }
    addOutline adds an outline to the text button and removeOutline does the opposite.

    NOTE: You could implement this directly into the textField and overwrite it in TitleMenuOption.as for a much better, multi-purpose use. But keep in mind that things like color transform will overwrite any filters that you add to an DisplayObject ( hence why in this example I just put in TitleMenuOption.as ) depending on the way you apply the filter that is.

    Should look something like this:
    Last edited by Demon; 12-01-2020 at 06:00 PM.
    Nice

  2. The Following User Says Thank You to Demon For This Useful Post:

    wycuhmi (12-24-2020)

Similar Threads

  1. [Source Code] Simple Text Encryption
    By Defcon 1 in forum C++/C Programming
    Replies: 8
    Last Post: 11-16-2011, 04:30 PM
  2. one abstract LP one simple text LP
    By Keroaplt in forum Showroom
    Replies: 6
    Last Post: 07-24-2011, 02:31 PM
  3. [Release] My simple Text Based RPG!
    By VvITylerIvV in forum C++/C Programming
    Replies: 6
    Last Post: 06-02-2011, 06:51 PM
  4. [Solved] New modder Need help with simple text input NOOB!!
    By rotceh_dnih in forum Call of Duty Black Ops GSC Modding Help & Discussion
    Replies: 3
    Last Post: 02-28-2011, 04:26 AM
  5. How to make a simple text based game in c++
    By VvITylerIvV in forum Programming Tutorials
    Replies: 13
    Last Post: 08-09-2010, 05:49 PM