|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
another dynamic text question
hi there,
i have a dynamic textfield with some text like: [subject] i want this to be inside the textfield instead of a label next to the textfield because of limited space. when u click with the mouse on the textfield to position the cursor inside, i want the text to become selected, just like in the adresbar in IE. when u start typing, the [subject] dissapeares for the freshly typed text thnx in advance koala |
|
#2
|
|||
|
|||
|
Assuming you have FlashMX, this will work.
Code:
TextField.prototype.select = function() {
var selector = {field:this};
selector.setSel = function(end) {
if(Selection.getBeginIndex() == Selection.getEndIndex()) Selection.setSelection(0, end);
Mouse.removeListener(selector);
clearInterval(selector.setInt);
}
selector.onMouseUp = function() {
this.setInt = setInterval(this.setSel, 1, this.field.length);
}
Mouse.addListener(selector);
}
Usage: Code:
txtName.onSetFocus = function() {
this.select();
}
Credit to Prometh for the code. |
|
#3
|
|||
|
|||
|
thnx
hey Cyanide, thnx for the great code. it works perfectly and does exactly what i want it to do. had to use an inputfield, because i coudn't edit the dynamic one, but this is no prob
greetz and many thnx, koalabeer |
![]() |
| Viewing: Dev Shed Forums > Web Design > Flash Help > another dynamic text question |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|