Extend TextInput

Hi --
I am just beginning to migrate from ActionScript 2 to
Actionscript 3. I
would like to create a simple custom control with the
TextInput as the base
component and just a few custom properties of my own to help
me understand
how AS 3 works. I have started with this code:
package {
import fl.controls.TextInput;
public class MyTextInput extends TextInput {
public function MyTextInput() {
I have my document class set to MyTextInput and I have my
publish settings
set to AS 3 and I have "Export to SWC" checked.
When I try to publish my component I get two errors:
1017: The definition of the base class TextInput was not
found
5000: The class "MyTextInput" must subclass
"flash.display.MovieClip" since
it is linked to a library symbol of that type.
I am confused by the 5000 error as I have no items in the
library.
Any help would be appreciated.
Thanks
Rich

Hi --
I am transitioning from AS 2 to AS 3 -- my job is as an
Actionscript 2
programmer.
I figured out that by adding "$(AppConfig)/Component
Source/ActionScript
3.0/User Interface" to my class path I was able to get rid of
the first
error.
By creating a component in the library and having the base
class as the
default (MovieClip) I was able to get rid of the second
error. It confused
me because I assumed the base class should be what I was
extending -- in
this case the TextInput. However, by having that in my AS
file and having
the base class a MovieClip it works as expected.
Rich
"kglad" <[email protected]> wrote in message
news:g6v3b9$ols$[email protected]..
> you need a textinput component in your library, at a
minimum. but trying
> to create a component is not a good place to start
learning anything about
> actionscript.

Similar Messages

  • Focus in textInput

    Hi all,
    I have an extended textInput component.
    How can I select all text (highlight) when user click on this component?
    I try setFocus but it doesn't work.
    override protected function focusInHandler(event:FocusEvent):void
                    //Update component text real value (realValue is a number that comes from my DB.
                    super.text = _realValue.toString();
                    this.setFocus();
    any ideas?
    Thanks!

    You want to do something like
        <fx:Script>
            <![CDATA[
                protected function textinput1_focusInHandler(event:FocusEvent):void
                    super.focusInHandler(event);
                    textinput1.selectAll();               
            ]]>
        </fx:Script>
        <s:TextInput id="textinput1" text="focusIn test" focusIn="textinput1_focusInHandler(event)"/>
    because the RichEditableText focusInHandler sets the selection based on a number of factors.  If you always want everything selected you need to do it after this.

  • Customizing Spark TextInput

    I am creating a custom TextInput item renderer:
    package
        import spark.components.Grid;
        import spark.components.TextInput;
        import spark.components.gridClasses.GridColumn;
        import spark.components.gridClasses.IGridItemRenderer;
        public class gridTextInput extends TextInput implements IGridItemRenderer
            public function gridTextInput()
                super();
                setStyle("borderVisible", false);
    When I run my code the renderer still has a border. What's wrong with my code?
    Thanks

    Works for me. Do you mean the grid lines? or the actual border of the TextInput? What happens if you set borderVisible to true?
    A workaround would be to reskin the TextInput and remove the border.
    -Kevin

  • How to exclude accent characters in Text components

    How can I exclude accent characters in Text components. I
    just want the keystroke do nothing for accent characters.

    I assume you mean TextInput.
    Easiest way? You may want to do something like this, it
    restricts input to only the provided characters, so you'd have to
    add any others that you DO want:
    restrict="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
    Harder way? Extend TextInput (but it only stops `):

  • Item Renderer in ActionScript

    I typed the devguide example on pp 719-720 into 2 separate
    files: MyRenderer.as, test.mxml (both shown at end of post). IDE
    gives the errors listed below. Any ideas? I thought the compiler
    was smart enough to resolve the MyRenderer.CellField reference
    using the xmlns="*" attribute of the mx:Application tag.
    1120: Access of undefined property CellField. test.mxml
    1172: Definition MyRenderer:CellField could not be found.
    1120: Access of undefined property CellField. test.mxml
    1120: Access of undefined property CellField. test.mxml
    1120: Access of undefined property CellField. test.mxml
    MyRenderer.as:
    // ActionScript file
    package MyRenderer {
    import mx.controls.*;
    import mx.core.*;
    public class CellField extends TextInput
    public function CellField() {
    height=60;
    width=80;
    setStyle("borderStyle", "none");
    editable=false;
    override public function set data(value:Object):void {
    super.data = value;
    if (value != null) {
    text = super.listData.text;
    if (Number(super.listData.text) > 100) {
    setStyle("backgroundColor", 0xff0000);
    super.invalidateDisplayList();
    test.mxml:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    height="600" width="600" xmlns="*">
    <mx:Script>
    <![CDATA[
    [Bindable]
    public var mydp:Array =
    {Monday: 12, Tuesday: 22, Wednesday: 452, Thursday: 90},
    {Monday: 258, Tuesday: 22, Wednesday: 45, Thursday: 46},
    {Monday: 4, Tuesday: 123, Wednesday: 50, Thursday: 95},
    {Monday: 12, Tuesday: 52, Wednesday: 111, Thursday: 20},
    {Monday: 22, Tuesday: 78, Wednesday: 4, Thursday: 51}
    ]]>
    </mx:Script>
    <mx:DataGrid id="myDatagrid" dataProvider="{mydp}"
    variableRowHeight="true">
    <mx:columns>
    <mx:DataGridColumn dataField="Monday"
    itemRenderer="MyRenderer.CellField"/>
    <mx:DataGridColumn dataField="Tuesday"
    itemRenderer="MyRenderer.CellField"/>
    <mx:DataGridColumn dataField="Wednesday"
    itemRenderer="MyRenderer.CellField"/>
    <mx:DataGridColumn dataField="Thursday"
    itemRenderer="MyRenderer.CellField"/>
    </mx:columns>
    </mx:DataGrid>
    </mx:Application>

    Hi,
    I'm sorry to bug you with a non-technical discussion, but I
    am a recruiter in San Diego. My client is in need of 3 Senior Flex
    Developers for their project. I have had an extremely rough time
    finding someone for this position. Would you be interested in this
    position, or do you know of anyone that might be? We do pay
    referral fees. This position may be open to telecommuting.
    Job Description:
    They are in the midst of a major re-architecting of their
    Corporate Management system utilizing many cutting edge
    technologies. As it relates to the position they are using Flex as
    their UI.
    This is either a contract, or a full-time position.
    Pay: Market Rate
    Thanks for your help!
    Natalie Fay
    Outsource Technical
    www.ostechnical.com
    [email protected]
    858.874.5637

  • Dynamically add component question?

    Hi:
    Here is part of my code in short:
    public class TextInputWithAutoComplete extends TextInput
    private function addComp():void{
    list = new List();
    list.id = "autoCompleteList";
    list.x = 0;
    list.y = 20;
    list.addEventListener(MouseEvent.MOUSE_UP, handleMouseDown);
    parentDocument.addChild(autoCompleteList); OR addChild(autoCompleteList); //my question is here
    private function handleMouseDown():void{
    //TODO
    I realized that if I do addChild, I can't really see the dynamically added component, since flex did not reserve space for my List to display. So I do parentDocument.addChild, and then the component appears no problem. My question is since it's being added in the parentDocument, so it is suppose to be a component belong to parentDocument, so is that component still be able to call this handleMouseDown?
    From my experience, it's still able to, but which doesn't make sense to me.
    Can someone explain a little about why it can still work, or any better approach other than parentDocument.addChild
    Thanks.

    In Flex there is a lifecycle that represents the contract between the component and its parent.  See the chapters on creating custom components and the lifecycle methods createChildren, commitProperties, measure and updateDisplayList.
    Some components size to content like Containers.  When you add a child to a container it will measure the child and make room for it or add scrollbars if there isn't enough room.
    If you add a child to TextInput, it doesn't expect additional children so it will not make room for it.  You can subclass and override its measure and updateDisplayList methods to make room for an additional child.
    I would not recommend adding another interactive control to an interactive control since that will make managing focus and accessibility much harder.  It is better to group these in a container in most cases.
    The reason the mouse handler still gets called is because a handler can be on any object whether it is a child or sibling or parent and will be called by the object dispatching the event if the handler is listening to that object.  If you had attached the handler to "this" it would not get called when the List is not a child of "this".
    Alex Harui
    Flex SDK Developer
    Adobe Systems Inc.
    Blog: http://blogs.adobe.com/aharui

  • AddEventListener and Function with Parameters

    Hello guys
    I got this situation
    nameTxt.addEventListener(FocusEvent.FOCUS_IN,formTextHandler);
             private function formTextHandler(text:String):void{
    where i want to send some additional information too
    so how could i do that?
    Thanks

    hi,
       it seems like you will need to extend your text Component and Event class as well. Its not clear from your code that what component you are referring to . so generally you will extend your required component .
    you will need to addEvent Listener
    FocusEvent.FOCUS_IN
    in your custom extended component and in the handler of that focusEvent you will dispatch your new custom event with the parameters from this FocusEvent you received and as well as new parameters that are also required by your new extended Event.
    Method of extending events is straight forward. e.g this a sample for extending Events you will need to modify it with the paramaters you require in your event .
    package
        import flash.events.Event;
        public class AccountEvent extends Event
            public var accountObj:Object
            public static var NewAccount:String='newAccount'
            public function AccountEvent(type:String,newAccount:Object)
                super(type)
                this.accountObj=newAccount
    and here is the code how to use this event
    package
        import flash.events.Event;
        import flash.events.FocusEvent;
        import AccountEvent
        import mx.controls.TextInput
        public class customText extends TextInput
            public function customText()
                super();
                addEventListener(FocusEvent.FOCUS_IN,onFocus)
            private function onFocus(e:FocusEvent):void{
                dispatchEvent(new AccountEvent(paramaters.....///here you will add your custom paramerters and 
               //you will catch this event in your main application rather then catching the focus in event

  • "Suggestive" validators (suggestors?)

    Is there any way to do this? For example, I have a "signup"
    type form (name, email, address, hobbies, etc.)... Certain fields
    would be required and have their respective validators (name,
    email, phone)... But other fields (hobbies, homepage, etc.), I
    would like to recommend that the user fill them in before
    submitting the info, but it's OK if they don't... Is there any type
    of "suggestion validator" that can accomplish this, or do you just
    have to handle all the logic yourself...??? Or can you actually
    just do it with validators and I'm missing something obvious...???
    Just wondering...

    Istrasci,
    There is nothing like a "sugestion validator" in Flex
    framework. But as you said, you can validate those fields with your
    own logic. I would sugest you create your own "sugestion validator"
    class to use it in your project, sou it would be easier to handle.
    Depending on what you plan to do, you cold extend TextInput and
    create a flag, required or optional and create your own validator,
    which would handle each Field acording to its flag.
    (I personaly hate flex validators, i always create my own
    lib).
    I hope that my post was useful.
    Regards,
    Peter

  • Prototype / Extend a TextInput()

    Hi --
    I would like to add some functionality to a TextInput but I
    am not yet
    familiar with working with objects in AS 3. I do understand
    object oriented
    programming and I am familiar with prototyping in Javascript
    but I'm not
    sure of the exact syntax in Flash.
    Ideally what I am looking to do is add a property INPUTMASK
    which would
    hold a string value and add code to the "on change" event of
    the control.
    Then I want to store this all as a package and create a new
    control that I
    can store and drop onto the stage to reuse.
    If someone could explain to me how to get this started that
    would be great.
    If I create this control the way I hope I will be more than
    happy to share
    it with anyone who is interested in it.
    Thanks
    Rich

    I use the airport utility. It finds the express and says that it has extended the network. However, later when I check the wireless options of the express, it is setup as a Create a Network.
    "Create a wireless network" is the correct setting to extend the network when the AirPort is connected to the main router using a wired Ethernet connection.
    "Extend a wireless network" would be the correct setting only if the AirPort Express is connected to the main router using wireless only, not Ethernet.

  • Would like a TextInput that extends FlowElement

    I am writing a courseware application in Flex and find the Text Layout Framework very helpful, except that I have many cases where input fields must be within the flow, such as the following:
    First there might be a question _________________ and ______________,
    ___________, then there might be another question __________________.
    The input field does not need to be a RichTextEditor, it just needs to be able to move in the flow of the text so that format is maintained if a user increases the size of the text. 
    I have seen statements in this forum that that the TLF was not designed to be extensible, making this a difficult task.  The only other solution that I can see is to put the text into RichText objects and the input fields into TextInput objects, and write a Format Controller that positions these on lines taking into account the ending position of each, and performing line breaks as needed.  Does anyone have a better idea?  The problem seems a little strange given the ease of doing this in HTML.
    Gary

    Thanks to Robin on the excellent find on Platus' solution.
    Gary, i was wondering if an underline would be better than an underscore. Can you please share your thoughts on the better way to preserve the underline beneath the words that are typed? It should meet both these conditions:
    When the blanks are typed on, the underline should be preserved beneath the typed characters.
    When some typed content is deleted, the blanks should be preserved with underline.
    My plan before reading this post was to create two separate sets of TLFs - one for the passage with blanks and another set of TLFs superimposed on top, positioned to align with the input blank spaces - similar to Platus' implementation. But now, i would try to directly enter content.
    Another query is, how to display underlined blank spaces, without using underscores?
    This is a <flow:span textDecoration="underline">red</flow:span> apple.
    Would display: This is a red apple.
    This is a <flow:span textDecoration="underline">   </flow:span> apple.
    Would display: This is a apple.
    Shiyaz

  • What class should I extend for this custom control?

    The code below is my attempt at a mxml control to replace a custom context-menu  that my app needs on certain textInput controls.  Characters not on the keyboard are inserted into the text, replacing any selection, if applicable.  Flex AIR apps (which I need for local access to SQLite) don't let me do custom contextmenus when the control is not top-level.
    The custom component is encapsulated now in a Panel but I would like to have the composite control be nothing more than a textInput and a PopUpMenuButton right next to it.  Is that possible—not to have a container?  If so,  what class should I extend, if creating this as an ActionScript component?
    Thanks for the advice.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="228" height="64"  creationComplete="onInit();" >
        <mx:TextInput id="mytextinput"   height="20"></mx:TextInput>   
        <mx:PopUpMenuButton id="mybutton" itemClick="onCharSelected(event);" x="159" y="-2" label="æ" width="41"  />
        <mx:Script>
         <![CDATA[
             import mx.utils.StringUtil;
             import mx.events.MenuEvent;
             import mx.events.ItemClickEvent;
             import mx.controls.TextArea;
            import mx.controls.Alert;
            import flash.events.*;
            import flash.display.Sprite;    
            import mx.collections.ArrayCollection;
                // use a point to track the selection-start and selection-end position for the text field
                private var pt:Point=new Point;
                private var chars:ArrayCollection = new ArrayCollection(
                    [ {label:"ð", data : "ð"},
                      {label:"æ", data:"æ"},
                      {label:"þ", data:"þ"} ]);
                    // track the selection positions as the mouse is moved or text is entered
                  private function onMouseEvent(e:MouseEvent): void{
                      pt.x=this.mytextinput.selectionBeginIndex;
                      pt.y=this.mytextinput.selectionEndIndex;
                  private function trackSelectionIndices(e: Event):void {
                     pt.x=this.mytextinput.selectionBeginIndex;
                      pt.y=this.mytextinput.selectionEndIndex;  
                private function onInit():void {
                    this.mytextinput.addEventListener(Event.CHANGE, trackSelectionIndices);
                    this.mytextinput.addEventListener(MouseEvent.MOUSE_DOWN, onMouseEvent);
                    this.mytextinput.addEventListener(MouseEvent.MOUSE_UP, onMouseEvent);
                    this.mybutton.dataProvider = chars;                     
                private function onCharSelected(e:MenuEvent):void {               
                    doInsert( e.item.data.toString(), this.mytextinput);
            // insert the character chosen from the popup into the text field, replacing any selection, and then reset the insertion point
             private function doInsert(s:String, trgt:Object):void {
                var v:String = TextInput(trgt).text;
                var pre:String =v.substr(0,TextInput(trgt).selectionBeginIndex);
                var post:String=v.substr(TextInput(trgt).selectionEndIndex, v.length-TextInput(trgt).selectionEndIndex);
                var result:String = pre + s + post;
                TextInput(trgt).text=result;
                TextInput(trgt).setSelection(TextInput(trgt).selectionBeginIndex+s.length,TextInput(trgt) .selectionBeginIndex+s.length);
              ]]> 
        </mx:Script>        
    </mx:Panel>

    Wiping perspiration from my brow as I abandon the difficult approach.
    Here is the simpler approach where HBox encapsulates the TextInput and PopUpMenuButton. I am trying to figure out how to let the TextInput keep its selection highlight when it loses focus to the PopupMenuButton: setSelection does not cause the repaint.
    package Search
        import flash.events.*;
        import flash.geom.Point;
        import mx.collections.ArrayCollection;
        import mx.containers.HBox;
        import mx.controls.PopUpMenuButton;
        import mx.controls.TextInput;
        import mx.events.MenuEvent;
        public class UnicodeCharPopupMenu extends HBox
            public function UnicodeCharPopupMenu()        {   
                        super();   
                        Init();
            private var mytextinput:TextInput = new TextInput;
            private var mybutton:PopUpMenuButton = new PopUpMenuButton;
            private function Init():void {
                mytextinput.width=100;
                mytextinput.height=22;
                mybutton.width=44;           
                this.width=200;
                this.height=20;
                visible=true;
               mybutton.addEventListener(FocusEvent.FOCUS_IN, onMenuGotFocus;
                mytextinput.addEventListener(Event.CHANGE, trackSelectionIndices);
                mytextinput.addEventListener(MouseEvent.MOUSE_DOWN, onMouseEvent);
                mytextinput.addEventListener(MouseEvent.MOUSE_UP, onMouseEvent);
                mybutton.addEventListener( MenuEvent.ITEM_CLICK, onCharSelected);
                //mybutton.addEventListener(MenuEvent.MENU_HIDE, onMenuHide);
                //mybutton.addEventListener(MenuEvent.MENU_SHOW, onMenuShow);
                mybutton.dataProvider = chars;  
                addChild(mytextinput);
                addChild(mybutton);           
            // use a point to track the selection-start and selection-end position for the text field
            private var pt:Point=new Point;
              private var chars:ArrayCollection = new ArrayCollection(
                    [ {label:"ð", data : "ð"},
                      {label:"æ", data:"æ"},
                      {label:"þ", data:"þ"} ]);
          //button got focus, repaint selection highlight
            private function onMenuGotFocus(e:FocusEvent): void {           
                 mytextinput.setSelection(pt.x, pt.y);
            // nothing selected, menu closed
            private function onMenuHide(e:MenuEvent): void {
                if (e.item.data==null) {
                    mytextinput.setFocus();
            private function onCharSelected(e:MenuEvent):void {             
                    doInsert( e.item.data.toString(), mytextinput);
           public function getText():String {
                    return mytextinput.text;
                // track the selection positions as the mouse is moved or text is entered
                 private function onMouseEvent(e:MouseEvent): void{
                     pt.x=mytextinput.selectionBeginIndex;
                     pt.y=mytextinput.selectionEndIndex;
                 private function trackSelectionIndices(e: Event):void {
                    pt.x=mytextinput.selectionBeginIndex;
                     pt.y=mytextinput.selectionEndIndex;  
                 private function doInsert(s:String, trgt:Object):void {
                 var v:String = TextInput(trgt).text;
                 var pre:String =v.substr(0,pt.x);
                  var post:String=v.substr(pt.y, v.length-pt.y);
                var result:String = pre + s + post;
                TextInput(trgt).text=result;
                TextInput(trgt).setFocus();
                TextInput(trgt).setSelection(pt.x+s.length,pt.x+s.length);
                pt.x = pt.x + s.length;
                pt.y = pt.x;          

  • How do I get Flash to recognize my TextInput from class?

    Hi -
    I'm trying to write a class for a standard input form. I've
    got a movieclip in the library and have linked it to this class.
    (class included below.)
    This movieclip contains several text inputs which I have
    declared in my class file. I can get their ._x and ._y values, but
    I can't assign to the .text value of the TextInput. Nor can I read
    this value when I set it in the parameters tab in flash. It just
    comes up as undefined.
    It's as though flash does not recognize the instance that was
    placed on the stage in the authoring environement as a TextInput. I
    can trace out the instance, but Flash does not treat it as a
    TextInput because I can not assign a string to the .text property.
    If I instantiate the TextInput in my class file and then
    position it on the stage - I can assign to it. But this is not as
    practical because I can not lay things out visually in Flash. How
    do I get Flash to recognize my TextInput instance on the stage from
    a class file?
    Thanks in advance!
    import mx.controls.TextInput;
    import mini.slide.*;
    class mini.slide.InfoCollect extends Slide{
    var first:TextInput;
    var testInput:TextInput;
    var last:TextInput;
    var email:TextInput;
    var address:TextInput;
    var city:TextInput;
    var zip:TextInput;
    var phone:TextInput;
    function InfoCollect(){
    trace("InfoCollect created");
    this.first = new TextInput();
    this.first.text = "testing";
    trace("this.first = " + this.first.text);
    }

    Since you are putting the assignment and trace statements in
    the Constructor function, it is possible that the textInput boxes
    have not all yet loaded. So, when you are trying to assign values
    to them, they are not present on the stage.
    Put your code in an onLoad function. That way you can insure
    that all components have loaded before you assign values to them.
    The onLoad function will be called when the "onLoad" event is
    triggered after all of your movieclip has loaded.
    function onLoad() {
    ---your code here---
    }

  • TextInput in List, is it a Bug?

    Hi all,
    I need to have a TextInput inside a List component because I want the user to be able to change the name of the list item while viewing it. The problem is that the spacebar doesn't get captured. In other words a TextInput in a list works fine untill you want a space in what ever you are typing.
    Can anyone offer a suggestion on how to fix this or get around it?
    Thanks
    Here's the code I'm using.
    <?xml version="1.0" encoding="utf-8"?>
    <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/halo">
        <s:List id="list" >
            <s:itemRenderer>
                <fx:Component>
                    <s:ItemRenderer>
                        <s:states>
                            <s:State name="normal" />
                            <s:State name="hovered" />
                            <s:State name="selected" />
                        </s:states>                   
                        <s:TextInput id="nameLabel" text="{data.lastName}, {data.firstName}"/>                   
                    </s:ItemRenderer>
                </fx:Component>
            </s:itemRenderer>
            <s:dataProvider>
                <s:ArrayList>
                    <fx:Object firstName="Ann"  lastName="Green" />
                    <fx:Object firstName="Tom"  lastName="Smith" />
                    <fx:Object firstName="John" lastName="Black" />
                    <fx:Object firstName="Jane" lastName="White" />
                    <fx:Object firstName="Bill" lastName="Jones" />
                </s:ArrayList>
            </s:dataProvider>
        </s:List>
    </s:WindowedApplication>

    Update,
    If I create my own list that extends the SDK's list and if I override the findKey function so it looks like this:
    override protected function findKey(eventCode:int) : Boolean
                var tmpCode:int = eventCode;
                return tmpCode >= 32 &&
                   tmpCode <= 126 &&
                   findString(String.fromCharCode(tmpCode));
    instead of this:
    override protected function findKey(eventCode:int) : Boolean
                var tmpCode:int = eventCode;
                return tmpCode >= 33 &&
                   tmpCode <= 126 &&
                   findString(String.fromCharCode(tmpCode));
    Then using the space bar in the text input in the list works.

  • How Do I Change TextInput Font?

    Hi,
    I am using Adobe Flash CS5 and Action Script 3, but I am struggling to do something really simple (which means I am looking in the wrong place probably), I have 5 TextInput fields, I have added to the stage via the 'Components' option, but after discovering how to change the colour of the fields, I now want to change the font which appears when you type directly into the fields when the Flash movie is playing, however I can't seems to find this function.
    I found a tutorial which mentioned going to the properties panel and then clicking 'Character, then 'Embed Font', but this maybe in CS4?
    Any help would be great! 

    Thanks for your very quick reply kglad, I have followed the steps you outlined, my components instance name is 'ti', the font class is 'Harper', do I place this code within the timeline under actions or in the class I generated through the library, called Harper.as?
    It is just I keep getting an error of 'access to undefined property ti' and also 'TextFormat is not compile-time-constant'.
    Here is my class instance of Harper.as:
    package  {
        import flash.text.Font;
    public class Harper extends Font {
      public function Harper() {
      var tfor:TextFormat = new TextFormat();
    var f:Font = new Harper();  // F is your font class name - see below
    tfor.font = f.fontName;
    tfor.color = 0xFF0000;
    tfor.size = 18;
    ti.setStyle("embedFonts",true)
    ti.setStyle("textFormat", tfor);
       // constructor code
    Many Thanks

  • TextInput with a Watermark?

    I've been really trying to move away from .NET into the flex
    world. With .NET there is a AJAX control for placing a text
    watermark on a textbox. This simply gives a sample for the
    textinput. Example would be a login form with a username textinput
    that says "User Name", but when the user clicks on the box, that
    text disappears.
    I know how do create this effect with events, but is there
    already a control that does this, or do I need to extend the
    textinput control to add this functionality?
    Any thoughts? Don't want to reinvent the wheel because I
    don't know all the lingo.

    There is no control that has built in support for this, but
    you can do it in MXML without extending the control:
    <mx:TextInput id="ti1" text="User Name"
    focusIn="ti1.text=''"/>
    hth,
    matt horn
    flex docs

Maybe you are looking for

  • How to update my homepage, using a different computer

    I have published a set of pages on Idisk from my home computer, using Iweb. Now on my vacation I would like to add a couple of pictures to my homepage using my powerbook instead. I therefore downloaded my current homepages from idisk but I can not co

  • After a software update yesterday my computer won't start up

    Yesteday my computer downladed an update.  I shut down at work, then at home when I started it up a bar went accross the bottom completed and then the spining circle start up happened and it hung there. I waited a long time and then tryed to restart,

  • Bootcamp on Lion--but which Windows 7 ?

    I'm finally considering a bootcamp install of Windows 7 and am completely overwhelmed by the plethora of different Windows 7 versions available... Professional? Home? Ultimate? 32-bit? 64-bit? I intend to do this mostly to play games-at this point, s

  • Crashing in run time engine

    My application crashes and comes up with the following error message: The instruction at "0x303556ce" referenced memory at "0x3231206f". The memory could not be "read". Click on OK to terminate the program Click on CANCEL to debug the program My appl

  • Helix shuts down while in sleep mode

    Using windows 8.  Every time I shut the lid of my computer it goes into sleep mode. This is good, but after a while in sleep mode it either shuts down or does something that causes it to close all programs and require rebooting. How do i stop this fr