There are three errors in this but I can't find them. I can't select different fonts and the text area is not comeing up or the font list. A function name is missing as well around line 23: function setFontMenu(){ var userFonts=TextField.getFontList(); fontMenu.setDataProvider(userFonts);}setFontMenu(); function setCurrentFont(obj){var currentStyle= new TextFormat();} currentStyle.font = obj.getSelectedItem().label; textWindow.setNewTextFormat(currentStyle); this.createTextField("textWindow",15,45,95,520,472); textWindow.border=true; textWindow.type = "input"; checkSelection={}; checkSelection.onMouseUp= function(){ _global.beginIndex= Selection.getBeginIndex(); _global.endIndex= Selection.getEndIndex(); _global.caretIndex=Selection.getCaretIndex(); }; Mouse.addListener(checkSelection); textWindow.onSetFocus= function(){ var removeUnderline= new TextFormat(); removeUnderline.underline= false; this.setTextFormat(removeUnderline); }; textWindow,onKillFocus = function(){ var tempUnderline = new TextFormat();} tempUnderline.underline= true; this.setTextFormat(beginIndex, endIndex, tempUnderline); function setCurrentFont(obj){ var currentStyle= newTextFormat(); currentStyle.font =obj.getSelectedItem().label; currentStyle.underline= false; if(beginIndex>0){textWindow.setTextFormat(beginIndex,endIndex, currentStyle); }else{ textWindow.setNewTextFormat(currentStyle); } } function.saveText(){userText.data.savedDoc= textWindow.htmlText;} function loadText(){ textWindow.htmlText= userText.data.savedDoc;} userText= SharedObject.getLocal("userText");
You might want to add a function to change the font when the font is changed in the fontMenu, but the attached code should get rid of your errors. You had a period after the function key word which was the source of the error on line 23. Chris function setFontMenu() { var userFonts = TextField.getFontList(); fontMenu.setDataProvider(userFonts); } setFontMenu(); createTextField("textWindow", 15, 45, 95, 520, 472); textWindow.border = true; textWindow.type = "input"; var beginIndex:Number = 0; var endIndex:Number = 0; var caretIndex:Number = 0; var checkSelection:Object = new Object(); checkSelection.onMouseUp = function() { beginIndex = Selection.getBeginIndex(); endIndex = Selection.getEndIndex(); caretIndex = Selection.getCaretIndex(); setCurrentFont(); }; Mouse.addListener(checkSelection); textWindow.onSetFocus = function() { var removeUnderline = new TextFormat(); removeUnderline.underline = false; this.setTextFormat(removeUnderline); }; textWindow.onKillFocus=function () { var tempUnderline = new TextFormat(); tempUnderline.underline = true; textWindow.setTextFormat(beginIndex, endIndex, tempUnderline); }; function setCurrentFont() { var currentStyle = new TextFormat(); currentStyle.font = fontMenu.selectedItem; trace(fontMenu.selectedItem); currentStyle.underline = false; if (beginIndex>0) { textWindow.setTextFormat(beginIndex, endIndex, currentStyle); } else { textWindow.setNewTextFormat(currentStyle); } } function saveText() { userText.data.savedDoc = textWindow.htmlText; } function loadText() { textWindow.htmlText = userText.data.savedDoc; } userText = SharedObject.getLocal("userText");
Don't see what you're looking for? Try a search.
|