I am adding INPUTTEXT through actionscript
and want to change the text color through color picker component
var mainContainer:MovieClip = new MovieClip();
var fontsContainer:MovieClip;
fontColorPicker.addEventListener(ColorPickerEvent.CHANGE, changeFontColor);
function addTextonStage(event:MouseEvent):void
{
var txtField:TextField = new TextField();
txtField.type = TextFieldType.INPUT;
txtField.defaultTextFormat = fmt;
fmt.align = TextFormatAlign.LEFT;
txtField.multiline = true;
txtField.autoSize = TextFieldAutoSize.LEFT;
txtField.antiAliasType = AntiAliasType.ADVANCED;
txtField.wordWrap = true;
fontsContainer = new MovieClip();
fontsContainer.addChild(txtField);
mainContainer.addChild(fontsContainer);
fontsContainer.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag);
}
function changeFontColor(e:ColorPickerEvent):void
{
fmt.color = fontColorPicker.selectedColor;
fontsContainer.txtField.defaultTextFormat = fmt;
fontsContainer.txtField.setTextFormat(fmt);
}
I am not able to get Font color change
ERRORS:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at scrapBook_fla::MainTimeline/changeFontColor()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at fl.controls::ColorPicker/onSwatchClick()
Following the tutorial , which changing color of inputtext on stage instance
http://active.tutsplus.com/tutorials/actionscript/develop-a-useful-fon t-picker-application-with-actionscript-30/