Replacetext (Textfield.replacetext Method) - MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE Reference

Actionscript 2.0 language reference
Table of Contents

Advertisement

my_txt.multiline = true;
my_txt.type = "input";
my_txt.text = "Select some sample text from the text field and then right-
click/control click "
+ "and select 'Enter current date' from the context menu to replace the
"
+ "currently selected text with the current date.";
var my_cm:ContextMenu = new ContextMenu();
my_cm.customItems.push(new ContextMenuItem("Enter current date",
enterDate));
function enterDate(obj:Object, menuItem:ContextMenuItem) {
var today_str:String = new Date().toString();
var date_str:String = today_str.split(" ", 3).join(" ");
my_txt.replaceSel(date_str);
}
my_txt.menu = my_cm;
The
MovieClip.getNextHighestDepth()
7 or later. If your SWF file includes a version 2 component, use the version 2 components
DepthManager class instead of the
See also
setFocus (Selection.setFocus method)

replaceText (TextField.replaceText method)

public replaceText(beginIndex:Number, endIndex:Number, newText:String) :
Void
Replaces a range of characters, specified by the
specified text field with the contents of the
Availability: ActionScript 1.0; Flash Player 7
Parameters
beginIndex:Number
- The end index value for the replacement range.
endIndex:Number
- The text to use to replace the specified range of characters.
newText:String
1202
ActionScript classes
MovieClip.getNextHighestDepth()
- The start index value for the replacement range.
method used in this example requires Flash Player
and
beginIndex
parameter.
newText
method.
parameters, in the
endIndex

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash 8

Table of Contents

Save PDF