This:

      txt.onRollOut = txt.onPress = Delegate.create(this,txtPress);

Should be this:

      txt.onRollOut = txt.onPress = Delegate.create(this,txtOut);

According to the code given.

See if that works,
Chris


Subba Chalamalasetty wrote:

Hi Chris,

I tried using Delegate and i am still having the same problem.
I used your code and tried to save the onpress handler,but didn't work
import mx.utils.Delegate;
class test {
   private var txt:TextInput;
   private var oldOnPress:Function;
   private var tt:ToolTip;
   private function onLoad(){
      oldOnPress = txt.onPress;
      txt.onRollOver = Delegate.create(this, txtOver);
      txt.onRollOut = txt.onPress = Delegate.create(this,txtPress);
   }

   private function txtOver(){
      tt = new customToolTip(0xE5E5E5,0x022954,0x022954,20,10,15,20);
      tt.showTip("Total sales.");
   }

   private function txtOut(){
      tt.removeTip();
      oldOnPress.apply(txt);
   }
}

it is still having the same problem.Am I using the right event?.I am
totally lost and donno y it is not working(I also used TeoToolTip
component and it was giving me the same problem too).can you help me
out?

Thanks,
Subba

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Chris
Hill
Sent: Wednesday, August 09, 2006 3:56 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Tooltip rollovers for textinput..help plss

You're overwriting the onPress event on your text field. You need to save your old onPress event before overwriting it, and make sure that it

is called:

class test {
    private var txt:TextInput;

    private function test() {
    }

    private function onLoad() {
           //save the onPress handler
           txt.oldOnPress = txt.onPress;
txt.onRollOver = function() { tt = new
customToolTip(0xE5E5E5,0x022954,0x022954,20,10,15,20);
                 tt.showTip("Total sales.");
          }
txt.onRollOut = txt.onPress = function() {
              tt.removeTip();
                //call the onPress Handler
              oldOnPress();
          }

I don't think my changes will compile, but I hope you get the idea. I would suggest using the ascb.util.Proxy or mx.util.Delegate class to more gracefully handle your handlers. Something like this:

import ascb.util.Proxy;
class test {
   private var txt:TextInput;
   private var oldOnPress:Function;
   private var tt:ToolTip;
   private function onLoad(){
      oldOnPress = txt.onPress;
      txt.onRollOver = Proxy.create(this, txtOver);
      txt.onRollOut = txt.onPress = Proxy.create(this,txtPress);
   }

   private function txtOver(){
      tt = new customToolTip(0xE5E5E5,0x022954,0x022954,20,10,15,20);
      tt.showTip("Total sales.");
   }

   private function txtOut(){
      tt.removeTip();
      oldOnPress.apply(txt);
   }
}

Hope this helps
Chris

Subba Chalamalasetty wrote:

Hi,
I have rollovers for textinput boxes.When i use the onRollOver,i could
get the rollover text(movie clip), but when i click the text input,I am
not able to enter data in the textinput.I wrote a small tooltip class
and can somebody please help me to get the focus on textinput.i.e when
i
click on the textinput,I should be able to enter data and rollover
movie
clip be removed.here is the code



class customToolTip {
private var theTip:MovieClip;
      private var tFormat:TextFormat;
function
customToolTip(hex:Number,hex2:Number,colorOfText:Number,heightOfBox:Num
b
er,x1:Number,x2:Number,x3:Number) {
movieLoader = new MovieClipLoader();
             movieListener = new Object();
             movieLoader.addListener(movieListener);
             this.theTip = _root.createEmptyMovieClip("tooltip",
_root.getNextHighestDepth());
             //this.theTip.createEmptyMovieClip("tooltip",
_root.getNextHighestDepth());

this.theTip.createTextField("theText",this.theTip.getNextHighestDepth()
,
3,1,1030,70);
             this.theTip.beginFill(hex);
             this.theTip.lineStyle(1, hex2, 100);
             this.theTip.moveTo(0, 0);
             this.theTip.lineTo(x1, 0);
             this.theTip.lineTo(x2, -10);
             this.theTip.lineTo(x3, 0);
             this.theTip.lineTo(205, 0);  // (100,0)
             this.theTip.lineTo(205, heightOfBox); // (100,20)
this.theTip.lineTo(0, heightOfBox); // (0,20) this.theTip.lineTo(0, 0); // (0,0) this.theTip.endFill();
             this.theTip._visible = false;
             this.theTip.theText.selectable = false;
             this.tFormat = new TextFormat();
             this.tFormat.font = "Arial";
             this.tFormat.size = 9;
this.tFormat.color = colorOfText; this.tFormat.align = "center";
             this.tFormat.italic = true;
             this.theTip.theText.setNewTextFormat(this.tFormat);
      }
public function showTip(theTextInput:String):Void { this.theTip.theText.text = theTextInput; trace(this.theTip.theText.text); this.theTip._x = _root._xmouse;
             this.theTip._y = _root._ymouse+10;
             this.theTip._visible = true;
             this.theTip.onMouseMove = function() {
                     this._x = _root._xmouse;
                     this._y = _root._ymouse+25;
                     updateAfterEvent();
             }
      }
      public function removeTip():Void {
delete this.theTip.onEnterFrame;
             this.theTip._visible = false;
this.theTip.clear(); }
}




and here I am using the tooltip class

class test {
   private var txt:TextInput;
   private function test() {
   }

   private function onLoad() {
txt.onRollOver = function() { tt = new
customToolTip(0xE5E5E5,0x022954,0x022954,20,10,15,20);
                tt.showTip("Total sales.");
         }
txt.onRollOut = txt.onPress = function() {
             tt.removeTip();
         }



When i click on the textinput,I need to get the focus on textinput and
able to type data in textinput box .Can somebody help me in this...

Thanks,
Subba





_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to