Hosting Solutions
mobile_logo Table of Contents

ColorPicker Component Tutorial

In this Flash ActionScript 3.0 tutorial we show how to dynamically program the ColorPicker component. Learn how to allow users to change colors on elements you want, and also learn how to access the value of their choice if using it in a form application. import fl.controls.ColorPicker; import; var rectWidth:uint = 450; var rectHeight:uint = 300; var bgColor:uint = 0xFFCC00; var borderColor:uint = 0x000000; var borderSize:uint = 2; var cornerRadius:uint = 12; var colorPicker:ColorPicker = new ColorPicker(); colorPicker.editable = true; colorPicker.move(20,10); addChild(colorPicker); drawRoundedRect(); function drawRoundedRect ():void { var roundedRect:Shape = new Shape;;, borderColor);,0, rectWidth, rectHeight, cornerRadius);; roundedRect.x = 60; roundedRect.y = 60; addChild(roundedRect); } colorPicker.addEventListener(ColorPickerEvent.CHANGE, colorChangeHandler); function colorChangeHandler(event:ColorPickerEvent):void { var newuint:uint = uint("0x"; bgColor = newuint; removeChildAt(numChildren -1); drawRoundedRect(); }

Flash Videos

Component Programming

ScrollPane Component TutorialTextArea Component Tutorial 2TextArea Component TutorialSlider Component TutorialProgress Bar Component TutorialRadio Button Component TutorialUILoader Component TutorialNumeric Stepper Component TutorialList Component TutorialDataGrid Component TutorialComboBox Component TutorialColorPicker Component TutorialCheckBox Component TutorialButton Component TutorialCustom Slider Component Development