Christian Mueller

XML Plugin für Flexbuilder

Es kommt ja immer wieder vor, dass man seine xml-files nicht immer mit einem externen Editor (z. B. Notepad++) bearbeiten möchte. Wenn man eh schon Eclipse verwendet, lohnt es sich Rinzo Xml Editor anzusehen. Das Gute ist, dass es auch im Adobe Flexbuilder funktioniert. Man benötigt mindestens Version 3.3. Rinzo ansicht ist relativ unscheinbar. Es wird nur gestartet, wenn man xml-Dateien öffnet. Sehr praktisch finde ich das auto-indent.

Flex Checkbox Wordwrap

[code lang="as3"]
/**
* @author Christian Mueller
* @date 9/22/2009
* @describtion checkbox with textfield wordwrap true
*/
package components {

import flash.display.DisplayObject;
import flash.text.TextFieldAutoSize;
import mx.controls.CheckBox;
import mx.core.IUITextField;
import mx.core.UITextField;

public class MultilineCheckbox extends CheckBox {

private var multilineLabel : IUITextField;

public function MultilineCheckbox() {
super();
text = "";
}

private var _text : String;

public function set text( value:String ):void {
_text = value;
commitProperties();
}

public function get text():String {
return _text;
}

override protected function createChildren():void {
super.createChildren();

if ( multilineLabel == null ) {
multilineLabel = IUITextField( createInFontContext( UITextField ) );
multilineLabel.text = "";
multilineLabel.wordWrap = true;
multilineLabel.autoSize = TextFieldAutoSize.LEFT;
addChild( DisplayObject( multilineLabel ) );
}
}

override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void {
super.updateDisplayList( unscaledWidth, unscaledHeight );

if ( multilineLabel != null && textField != null ) {
multilineLabel.x = textField.x;
}
}

override protected function commitProperties():void {
super.commitProperties();

if ( multilineLabel != null ) {
multilineLabel.text = _text;
}
}

override protected function measure():void {
super.measure();
}
}
}
[/code]

Beispiel:
Get Adobe Flash player

textfield with preset label

Ab und an möchte man in Formularen Platz sparen und das label direkt in das inputfield schreiben. Wer sich nicht die komplette Mühe machen möchte, kann sich gern hier inspirieren lassen.

[code lang="as3"]
<?xml version="1.0" encoding="utf-8"?>
<!--
@author Christian Mueller
@date 9/02/2009
-->
<mx:TextInput xmlns:components="components.*" xmlns:mx="http://www.adobe.com/2006/mxml" text="{label}" focusIn="onFocusIn(event)" focusOut="onFocusOut(event)" styleName="LabelInactive">
<mx:Style>
.LabelInactive
{
color: #8B8B8B;
}
.LabelActive
{
color: #000000;
}
</mx:Style>
<mx:Script>
<![CDATA[

[Bindable]
public var label : String = "";

private function onFocusIn( event:FocusEvent ):void {
if ( super.text == label ) {
super.text = "";
styleName = "LabelActive";
}
}

private function onFocusOut( event:FocusEvent ):void {
if ( super.text == "" ) {
super.text = label;
styleName = "LabelInactive";
} else {
styleName = "LabelActive";
}
}

override public function set text(value:String):void {
if ( value == null ) {
value = "";
}

if ( value.split(" ").join("") != "" && value != label ) {
super.text = value;
styleName = "LabelActive";
} else {
super.text = label;
styleName = "LabelInactive";
}
}

[Bindable]
override public function get text():String {
if ( super.text == label ) {
return "";
}

return super.text;
}

]]>
</mx:Script>
</mx:TextInput>
[/code]

Twitter

  • Quatsch Comedy Club -
    http://t.co/zp15KjYs
    2012/02/04 00:27
  • Admiralspalast im Winter -
    http://t.co/fxafCyb8
    2012/02/04 00:55
  • Wow, did not know that #cycling in #britain is so dangerous
    http://t.co/Ug6EvIY2
    2012/01/30 18:27
  • wow RT @FITC: Using a data visualization of the children's brain waves @B__REEL created upholstery for a unique chair
    http://t.co/ohZEYpTy
    2012/01/30 17:04
  • Ha, ok. It was the fault of the #MWSearch extension. Nice to know
    2012/01/30 09:14