A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Extending the Texfield class

  1. #1
    Junior Member
    Join Date
    Sep 2004
    Posts
    4

    Extending the Texfield class

    I currently working on a userinterface that dosen't have have clicking. It's becoming quite the challenge...

    Anyways, I don't know if what I'm asking is possible, but is there a way to extend the Texfield class to have a onRollOver event?

  2. #2
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    something like this perhaps -
    Code:
    black = new TextFormat();  
    black.size = 12;  black.color = 0x000000; black.align = "center";
    white = new TextFormat();  
    white.size = 12;  white.color = 0xFFFFFF;  white.align = "center";
    
    TextField.prototype.hitTest = hitTest;
    
    this.createTextField("field1",1,100,100,100,20);
    field1.selectable = false;
    field1.border = true;  field1.borderColor = 0xFF0000;
    field1.background = true;  field1.backgroundColor = 0xCCCCCC;
    
    
    this.onMouseMove = function(){
    if(field1.hitTest(_level0._xmouse, _level0._ymouse)){
    field1.text = "that's nice"; field1.setTextFormat(white);
    field1.backgroundColor = 0x000000;  field1.borderColor = 0x00FF00;
    } else {
    field1.text = "hit me";  field1.setTextFormat(black);
    field1.backgroundColor = 0xCCCCCC;  field1.borderColor = 0xFF0000; 
    }
    };
    
    this.onMouseDown = function(){
    if(field1.hitTest(_level0._xmouse, _level0._ymouse)){
    field1.text = "ouch";
    field1.setTextFormat(white);
    field1.backgroundColor = 0xFF0000;
    }
    };

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center