Pessoal, Estou com uma dúvida com um DragOver que não exibe o showFeedback como DragManager.NONE no DragManager. A idéia que apenas determinados tipos de nodes possam receber um "drop", no código abaixo apenas 'courses'podem receber 'modules'.
Segue meu código que foi baseado no último exemplo no link: http://www.adobe.com/devnet/flex/quickstart/working_with_tree/ Agradeço qualquer ajuda. <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" initialize="onInit()"> <mx:Script> <![CDATA[ import mx.core.DragSource; import mx.managers.DragManager; import mx.events.DragEvent; import mx.collections.XMLListCollection; private const FOLDER:String = "folder"; private const COURSE:String = "course"; private const MODULE:String = "module"; [Bindable] private var coursesList:XML = <list><node objectID="6" name="CF" parentID="1" recordType="course"><node objectID="7" name="CFC" parentID="6" recordType="module"/><node objectID="8" name="CFAdmin" parentID="6" recordType="module"/><node objectID="9" name="CFML" parentID="6" recordType="module"/><node objectID="10" name="CFSCRIPT" parentID="6" recordType="module"/></node><node objectID="2" name="DataBase" parentID="1" recordType="folder"><node objectID="3" name="Oracle" parentID="2" recordType="course"><node objectID="4" name="PLSQL" parentID="3" recordType="module"/><node objectID="5" name="SP" parentID="3" recordType="module"/></node></node></list> ; [Bindable] private var courses:XMLListCollection; private function onInit():void { courses = new XMLListCollection(coursesList.node); } private function treeNodeLabelFunction(item:XML):String { return [EMAIL PROTECTED] + " (" + [EMAIL PROTECTED] + ")"; } private function onDragOver(event:DragEvent):void { // r is the visible index in the tree var dropTarget:Tree = Tree(event.currentTarget); var r:int = dropTarget.calculateDropIndex(event); myTree.selectedIndex = r; // retrieving the newly selected node, you can examine it and decide to tell // the user the drop is invalid by changing the feedback. var node:XML = myTree.selectedItem as XML; if( [EMAIL PROTECTED] != COURSE ) { DragManager.showFeedback(DragManager.NONE); tiTemp.text = "denied"; return; } else { tiTemp.text = "allow"; } // the type of drop - copy, link, or move can be reflected in the feedback as well. // Here the control and shift keys determine that action. if (event.ctrlKey) DragManager.showFeedback(DragManager.COPY); else if (event.shiftKey) DragManager.showFeedback(DragManager.LINK); else { DragManager.showFeedback(DragManager.MOVE); } } private function onDragDrop(event:DragEvent):void { } ]]> </mx:Script> <mx:Tree id="myTree" dataProvider="{courses}" labelFunction="treeNodeLabelFunction" dragEnabled="true" dragMoveEnabled="true" dropEnabled="true" dragOver="onDragOver(event)" dragDrop="onDragDrop(event)" width="200" showRoot="false" height="300"/> <mx:TextInput id="tiUpNode" text="[EMAIL PROTECTED]" y="103" x="208"/> <mx:TextInput id="tiTemp" y="142" x="208"/> </mx:Application> -- Hamad Amaral [EMAIL PROTECTED] --~--~---------~--~----~------------~-------~--~----~ Você recebeu esta mensagem porque está inscrito na lista "flexdev" Para enviar uma mensagem, envie um e-mail para [email protected] Para sair da lista, envie um email em branco para [EMAIL PROTECTED] Mais opções estão disponíveis em http://groups.google.com/group/flexdev -~----------~----~----~----~------~----~------~--~---
