Beck,

BN> Grande Hamad - e o grande aqui não é força de expressão :-D

Sendo assim, o correto seria Gordo Hamad :-)

BN> Como você também está tratando o evento DragOver é preciso cancelar o
BN> tratamento default da implementação da Tree. Para isto faça o
BN> seguinte:

BN> tiTemp.text = "denied"; // depois desta declaração no seu código
BN> event.preventDefault(); // adicione esta aqui

Na mosca! Pena que a documentação não diz isso no capítulo Using the Drag and 
Drop
Manager, apesar de discutido no capítulo que trata de item editors (que eu não
li) :-(

Sem querer abusar, a variável items em onDragDrop não deveria trazer o
nó que está sendo movido/copiado? Como representar este mó?

Obrigado.

<?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.utils.ObjectUtil;
                        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 " + [EMAIL 
PROTECTED];
                                        event.preventDefault();
                                        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
                {
                                var ds:DragSource = event.dragSource;
                var items:Array = ds.dataForFormat("treeItems") as Array;
                }
        
                ]]>
        </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
-~----------~----~----~----~------~----~------~--~---

Responder a