Fellow Flexcoders,

So I have been trying to place a button in the titlebar of one of my panels and started digging around. I remembered Jesse had put up an example of a mix-in class ( http://www.jessewarden.com/archives/2005/01/collapseable_pa.html ) for doing just that. I dug through the code and have had no luck. I have included the actionscript from my test file at the end of this message.

so my questions are:

1) Jesse, what voodoo do you do to get that to work? ;)
2) Everyone, is there a different way I can do this? Is Jesse's way the most efficient / elegant?

Thanks,
Seth

Code:

myPanel.mxml (root element is <mx:Panel /> with the following in a script tag, not including includes)

import mx.utils.*;
import de.richinternet.utils.Dumper;

private var menu_pb : Button;


public function initFunk ( ) {
Dumper.dump ( "Init..." );
_initMenuButton ( this ); // Not sure why I have to do this, but I don't got compile errors on menu_pb with this.
}

static private function _initMenuButton ( obj ) {
Dumper.dump ( "Init 2..." );

obj.onMenuButton = obj.onMenuButton;

obj.createClassObject ( Button, "menu_pb", obj.getNextHighestDepth ( ));
obj.menu_pb.label = ">";
obj.menu_pb.setSize ( 22, 22 );
obj.menu_pb.addEventListener ( "click", Delegate.create ( obj, obj.onMenuButton ));
}

private function onMenuButton ( ) {
Dumper.dump ( "Trace: fileShare.onMenuButton()" );
}

static private function _sizeOverload ( obj ) {
Dumper.dump ( "Size 2..." );
obj.super.size ( );
obj.menu_pb.move ( obj.width - obj.menu_pb.width - 8, 4 );
}

function size ( ) : Void {
Dumper.dump ( "Size..." );
super.size ( );
_sizeOverload ( this );
}

/* All dumps to the tracer are accounted for and in the expected order... */

Attachment: PGP.sig
Description: This is a digitally signed message part

Reply via email to