1202 ActionScript classes
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()
method used in this example requires Flash Player
7 or later. If your SWF file includes a version 2 component, use the version 2 components
DepthManager class instead of the
MovieClip.getNextHighestDepth()
method.
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
beginIndex
and
endIndex
parameters, in the
specified text field with the contents of the
newText
parameter.
Availability:
ActionScript 1.0; Flash Player 7
Parameters
beginIndex
:Number
- The start index value for the replacement range.
endIndex
:Number
- The end index value for the replacement range.
newText
:String
- The text to use to replace the specified range of characters.
Summary of Contents for FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
Page 1: ...ActionScript 2 0 Language Reference ...
Page 1352: ...1352 ActionScript classes ...