0
private var _textField:TextField;
0
private var _style:StyleSheet;
0
private var _resizeHeight:uint;
0
+ private var _extendedContainer:Sprite;
0
public function PickleButton(options:Object) {
0
this.itemWidth = options.width || 200;
0
this._image = options.image || new Sprite();
0
this._textField = this.createTextField();
0
this._textField.htmlText = '<p>' + (options.text || 'No text specified') + '</p>';
0
+ if ( options.extended_content != null ) {
0
+ this._extendedContainer = options.extended_content;
0
this.resizeComponents();
0
- public function drawBackground(color:uint = 0xFF00FF):void {
0
- color = this._backgroundColor;
0
+ public function drawBackground():void {
0
- this.graphics.beginFill(
color, 0.4);
0
+ this.graphics.beginFill(
this._backgroundColor, 0.4);
0
this.graphics.drawRoundRect(0, 0, this.itemWidth, this.itemHeight, 15, 15);
0
private function onMouseOut(e:MouseEvent):void {
0
- trace("And we're out");
0
this._backgroundColor = PickleButton.NORMAL_COLOR;
0
private function onClick(e:MouseEvent):void {
0
- if ( this.itemHeight == 50 ) {
0
+ if ( this.itemHeight == this.getExtendedHeight() ) {
0
+ private function retract():void {
0
+ private function extend():void {
0
+ this.resizeTo(this.getExtendedHeight());
0
+ this.displayExtended();
0
private function createTextField():TextField {
0
var text:TextField = new TextField();
0
- private function redraw(
):void {
0
+ private function redraw(
withParent:Boolean = false):void {
0
+ if ( withParent ) (this.parentItem as ProjectList).redraw();
0
private function resizeTo(height:uint = 0):void {
0
private function resizer(e:Event):void {
0
- if ( this.itemHeight
!= this._resizeHeight ) {
0
+ if ( this.itemHeight
< this._resizeHeight ) {
0
this.itemHeight += ( (itemHeight < this._resizeHeight)? 2 : -2 );
0
- this.drawBackground();
0
- (this.parentItem as ProjectList).redraw();
0
+ this.itemHeight = this._resizeHeight;
0
this.removeEventListener(Event.ENTER_FRAME, this.resizer);
0
trace("Removed listener");
0
this.itemHeight = this.getBaseHeight();
0
this._textField.x = this._image.width + this.padding;
0
this._textField.width = this.itemWidth - this._image.width - this.padding;
0
- this._textField.height = this.itemHeight - this.padding
* 1;
0
+ this._textField.height = this.itemHeight - this.padding
;
0
this._image.x = this.padding;
0
this._image.y = this.padding;
0
- private function getBaseHeight()
{
0
+ private function getBaseHeight()
:uint {
0
return this._image.height + this.padding * 2;
0
+ private function getExtendedHeight():uint {
0
+ return this.getBaseHeight() + this._extendedContainer.height + this.padding;
0
private function createStyleSheet():StyleSheet {
0
var style:StyleSheet = new StyleSheet();
0
style.parseCSS('p { font-family: "Trebuchet MS"; font-size: 11px; color: #000000; background-color: #FF00FF; }');
0
+ private function displayExtended():void {
0
+ this.addChild(this._extendedContainer);
0
+ this._extendedContainer.y = this.getBaseHeight();
0
+ private function hideExtended():void {
0
+ this._extendedContainer.parent.removeChild(this._extendedContainer);
Comments
No one has commented yet.