flash HTML editor API documentation: [ overview ]

all functionality is available via Object.HTML object. you can download the editor control example FLA here.

function description
Object.HTML.setSelection


usage
: Object.HTML.setSelection( textfield, begin, end )

textfield:
being the name of the field, not the object. usually the result of a Selection.getFocus() call!

begin:begin index gotten from Selection.getBeginIndex()

end:being the end index, usually from Selection.getEndIndex()

setSelection will navigate the HTML engine to the proper text location, afterwards you may call functions to change the formatting, eg. setBold() which is then applied to the selected range.

example:
Object.HTML.setSelection( Selection.getFocus(), Selection.getBeginIndex(), Selection.getEndIndex() );

Object.HTML.restoreSelection


usage
: Object.HTML.restoreSelection();

restoreSelection will force flash to put the focus on the textfield previously selected by "setSelection" and restore the selection range, for example after a user has clicked a button.

Object.HTML.getState


usage
: state = Object.HTML.getState();

getting the state of the textfield/range previously selected by "Object.HTML.setSelection"

state being an object with the following fields, or null if invalid arguments:

state.bold, where 1 = bold, 2 = unbold, 3 = mixed
state.italic, where 1 = italic, 2 = non-italic, 3 = mixed
state.underline, where 1 = underlined, 2 = not underlined, 3 = mixed

state.left, where 1 = left aligned, 2 = not left aligned
state.center, where 1 = centered, 2 = not centered
state.right, where 1 = right aligned, 2 = not right aligned

state.url, string, if the current selection holds a link
state.url_target, string, if the current selection holds a link with target
state.color, string in form "#ff0000"
state.fontsize, current font size or "---" if mixed
state.fontface, current font face or "---" if mixed

Object.HTML.setColor


usage
: Object.HTML.setColor( 0xff0000 ) or Object.HTML.setColor( 0xff, 0, 0 );

applies the desired color to the textfield/range previously chosen by Object.HTML.setSelection(...)

Object.HTML.setFont


usage
: Object.HTML.setFont( "_sans" );

applies the desired font face to the textfield/range previously chosen by Object.HTML.setSelection(...)

valid font names are: _sans, _serif and _typewriter ... for using device fonts
or: any font name, as long as the font is embedded in the same movie that also holds the HTML textfield
!

Object.HTML.setFontSize
usage: Object.HTML.setFontSize( 20 );

applies the desired font size to the textfield/range previously chosen by Object.HTML.setSelection(...)
Object.HTML.setTarget


usage: Object.HTML.setTarget( "_top" );

applies the desired target to the textfield/range previously chosen by Object.HTML.setSelection(...)
if the selected range has not been a link, a link will be automatically created

Object.HTML.setLink


usage
: Object.HTML.setLink( "http://www.active-web.cc" );

applies the desired link to the textfield/range previously chosen by Object.HTML.setSelection(...)
if the selected range has not yet been a link, a link will be automatically created

if the argument was "", an eventually existing link will be removed

newly created links will use "<AEDIT HREF" instead of "<A HREF" because otherwise the link would be active in edit mode. you have to take care of this when saving/loading the text. (not used anymore since flash 5/6 have problems with unknown HTML tags. - we really create "<A HREF" now !)

Object.HTML.removeLink
same as Object.HTML.setLink( "" );
Object.HTML.setBold


usage
: Object.HTML.setBold();

applies the desired format option to the textfield/range previously chosen by Object.HTML.setSelection(...)


Object.HTML.removeBold


usage
: Object.HTML.removeBold();

applies the desired format option to the textfield/range previously chosen by Object.HTML.setSelection(...)

Object.HTML.setItalic


usage
: Object.HTML.setItalic();

applies the desired format option to the textfield/range previously chosen by Object.HTML.setSelection(...)

Object.HTML.removeItalic


usage
: Object.HTML.removeItalic();

applies the desired format option to the textfield/range previously chosen by Object.HTML.setSelection(...)


Object.HTML.setUnderline


usage
: Object.HTML.setUnderline();

applies the desired format option to the textfield/range previously chosen by Object.HTML.setSelection(...)

Object.HTML.removeUnderline


usage
: Object.HTML.removeUnderline();

applies the desired format option to the textfield/range previously chosen by Object.HTML.setSelection(...)

Object.HTML.alignLeft


usage
: Object.HTML.alignLeft();

applies the desired format option to the textfield/range previously chosen by Object.HTML.setSelection(...)

Object.HTML.alignCenter


usage
: Object.HTML.alignCenter();

applies the desired format option to the textfield/range previously chosen by Object.HTML.setSelection(...)

Object.HTML.alignRight


usage
: Object.HTML.alignRight();

applies the desired format option to the textfield/range previously chosen by Object.HTML.setSelection(...)

if you have got any problems, wishes or questions please contact us vie e-mail under baumgartner@active-web.cc


[ close this window ] [ www.active-web.cc ]