+展开-ActionScript
package oreilly.cookbook {
import mx.skins.ProgrammaticSkin;
public class CustomDropIndicator extends ProgrammaticSkin {
public var direction:String = "horizontal" ;
public function CustomDropIndicator() {super();}
override protected function updateDisplayList (unscaledWidth:Number, unscaledHeight:Number ):void {
super.updateDisplayList(unscaledWidth, unscaledHeight );
graphics.clear();
graphics.beginFill( 0x000000 );
if( direction == "horizontal"){
graphics.moveTo( 4, -10 );
graphics.lineTo( 6, -10 );
graphics.lineTo( 6, -4 );
graphics.lineTo( 10, -4 );
graphics.lineTo( 5, 0 );
graphics.lineTo( 0, -4 );
graphics.lineTo( 4, -4 );
graphics.lineTo( 4, -10 );
}
else{
graphics.moveTo( 10, 4 );
graphics.lineTo( 10, 6 );
graphics.lineTo( 5, 6 );
graphics.lineTo( 5, 10 );
graphics.lineTo( 0, 5 );
graphics.lineTo( 5, 0 );
graphics.lineTo( 5, 4 );
graphics.lineTo( 10, 4 );
}
graphics.endFill();
}
}
}
+展开-XML
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="horizontal" creationComplete="creationHandler();">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
private function creationHandler():void {
contactList.dataProvider = new ArrayCollection(['Josh', 'Abey', 'Todd']);
}
]]>
</mx:Script>
<mx:List id="contactList" width="200" height="200" allowMultipleSelection="true"
dragEnabled="true" dropEnabled="true" dropIndicatorSkin="com.oreilly.flexcookbook.CustomDropIndicator" />
<mx:TileList id="tileList" width="180" height="200"
dropEnabled="true" dropIndicatorSkin="com.oreilly.flexcookbook.CustomDropIndicator" />
</mx:Application>