awesome - just awesome - thanks. i know i am going to need this soon.

--- In flexcoders@yahoogroups.com, "Jason Hawryluk" <[EMAIL PROTECTED]> wrote:
>
> Here you guy's, gal's go don't forget to change the package 
location. I use
> this technique in allot of way's. Just let me know what you think
 ;) Code is
> below. The delayed class, and the sample use.
> 
> Cheers
> 
> Jason
> 
> Begin: DelayedTimer.as
> 
> /**
>  * This class provides a timer abstraction, and issues a callback 
to the
>  * desired function once the time event hit's. Create one instance 
for each
>  * delayed timer you require
>  *
>  * @langversion ActionScript 3.0
>  * @playerversion Flash 8.5
>  * @tiptext
>  *
>  **/
> 
> package com.vision.delayedTimer{
> 
>  import flash.utils.Timer;
>  import flash.events.Event;
>  import flash.events.TimerEvent;
> 
>  public class DelayedTimer extends Timer {
> 
>   private var _caller:Object;
> 
>   public function DelayedTimer  (){
>    //init the extended class
>    super(1000,1);
> 
>   }
> 
>   /**
>    * getters and setters for the object passed
>    **/
>   public function get caller():Object
>   {
>    return _caller;
>   }
> 
>   public function set caller(d:Object):void
>   {
>    _caller = d;
>   }
> 
> 
>    /**
>    * Inicialize the timer for the delayed call
>    *
>    * -Parameters
>    * @event = the event that set off this obejct
>    * @func = a function call to run
>    * @caller = the actual object that called this object
>    * @delay = the delay in milliseconds between timer events
>    * @repeat = number of times to repeat 0= indefinit
>    *
>    * -verion
>    * @langversion ActionScript 3.0
>    * @playerversion Flash 8.5
>    * @tiptext
>    *
>    **/
> 
>   public function startDelayedTimer(event:Event,func:Function,
> callerin:Object=null,delay:Number=1000, repeat:uint=1):void {
> 
>    if (func == null){return;}
> 
>    if (caller !=null){
>     caller=callerin;
>    }
> 
>    if (caller != event.target){
>     caller = event.target;
> 
>     if (running ==true){
>      cancelDelayedTimer();
>     }
> 
>     delay = delay;
>     repeatCount=1;
> 
>     addEventListener(TimerEvent.TIMER,func);
> 
>     start();
> 
>    }
> 
>   }
> 
>   /**
>    * clean up the call and stop the running timer
>    *
>    * -verion
>    * @langversion ActionScript 3.0
>    * @playerversion Flash 8.5
>    * @tiptext
>    **/
>   public function cancelDelayedTimer():void{
> 
>    if (running ==true){
> 
>     _caller=null;
> 
>     stop();
>     reset();
> 
>    }
> 
>   }
>  }
> 
> }
> 
> End: DelayedTimer.as
> 
> Begin: SampleDragDropOpen.mxml
> 
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; 
layout="absolute">
> 
> <mx:Script>
>  <![CDATA[
>  //*****************************************************
>  //all this stuff is for the sample
>  //*****************************************************
> 
>  [Bindable]
>  public var dsXML:XML = <groups>
>  <group isBranch="true" label="Folder 1">
>       <item label="Folder 1 Item 1" />
>    <item label="Folder 1 Item 2" />
>    <item label="Folder 1 Item 3" />
>    <item label="Folder 1 Item 4" />
>    <group isBranch="true" label="No Children 1-0"/>
>       <group isBranch="true" label="No Children 1-2"/>
>     </group>
>  <group isBranch="true" label="Folder 1">
>  </group>
>     <item label="Item 1" />
>  <item label="Item 2" />
>  </groups>
> 
> 
>  ]]>
> </mx:Script>
> 
> 
> <mx:Script>
>  <![CDATA[
>  //*************************************************
>  //tree delayed open while draginging an item
>  //*************************************************
> 
>  //handles auto open on drag drop operations
>  import com.vision.delayedTimer.DelayedTimer;
> 
>  private var oDelayedTimer:DelayedTimer = new DelayedTimer();
> 
>  //stored for opening
>  private var lastFolderOver:Object
> 
>  //the returned dispatched call if delay triggered
>  private function dispatchDelayedOpen(event:Event):void{
>   Tree0.expandItem(lastFolderOver,true,true);
>  }
> 
>  import mx.events.DragEvent;
>  private function handleDragOver(event:DragEvent):void{
> 
>   /**
>   this is the guts of it
>   **/
> 
>   var currTree:Tree = Tree(event.currentTarget);
>   var rowindex:int = currTree.calculateDropIndex(event);
>   var currNodeOver:Object;
> 
>   if (currTree.indexToItemRenderer(rowindex) !=null){
>    currNodeOver = currTree.indexToItemRenderer(rowindex).data;
>   }
>   else{
>    currNodeOver=null;
>   }
> 
>   //if not over any node cleanup if nessesary and return
>   if (currNodeOver == null){
>    if (lastFolderOver != null){
>     oDelayedTimer.cancelDelayedTimer();
>     lastFolderOver = null;
>    }
>    return;
>   }
> 
>   if ([EMAIL PROTECTED] &&
> currTree.isItemOpen(currNodeOver)==false){
> 
>    //test if not the same
>    if(lastFolderOver !=currNodeOver){
>     //clear and reset the delay store this folder as last
>     lastFolderOver = currNodeOver;
>     //clear the existing
>     oDelayedTimer.cancelDelayedTimer();
>     //create callback
>     
oDelayedTimer.startDelayedTimer(event,dispatchDelayedOpen,currNodeOver);
>    }
>    return;
>   }
>   else{
>    //clear the existing
>    if (lastFolderOver != null){
>     oDelayedTimer.cancelDelayedTimer();
>     lastFolderOver = null;
>    }
>    return;
>   }
> 
>  }
> 
>  private function handleDragComplete(event:DragEvent):void{
>   //cleanup delay stuff
>   oDelayedTimer.cancelDelayedTimer();
>   lastFolderOver = null;
>  }
> 
> ]]>
> </mx:Script>
> 
> <mx:XMLListCollection source="{dsXML.children()}"
>   id="XMLdc"/>
> 
>  <mx:Tree id="Tree0" dragComplete="handleDragComplete(event)"
> dragOver="handleDragOver(event)" labelField="@label"
>  dragEnabled="true" dataProvider="{XMLdc}"
>  dragMoveEnabled="true" dropEnabled="true"
>  width="250" height="100%" />
> 
> 
> </mx:Application>
> 
> End: SampleDragDropOpen.mxml
> 
> 
>   -----Message d'origine-----
>   De : flexcoders@yahoogroups.com 
[mailto:[EMAIL PROTECTED] la
> part de Jason Hawryluk
>   Envoyé : mercredi 12 juillet 2006 10:06
>   À : flexcoders@yahoogroups.com
>   Objet : RE: [flexcoders] Explorer-like drag & drop tree
> 
> 
> 
>   I have a little support task to do first then i'll put it up.
> 
>   :°
> 
>   jason
> 
>     -----Message d'origine-----
>     De : flexcoders@yahoogroups.com 
[mailto:[EMAIL PROTECTED] la
> part de Jonas Windey
>     Envoyé : mercredi 12 juillet 2006 09:45
>     À : flexcoders@yahoogroups.com
>     Objet : RE: [flexcoders] Explorer-like drag & drop tree
> 
> 
> 
>     Cool, can't wait. I've now gotten so far that I can drag items 
on every
> node, but the only thing I need to force now is that if you drag an 
item on
> a node on the last level, it needs to be open for flex to allow 
dropping on
> it.
> 
>     For now I'll just open every node in my tree in the initial 
state. That
> way at least it's working.
> 
> 
>     Now give me your sample ;-)
> 
> 
>     Jonas
> 
>     Lol <-> Jason, we're anagrammable
> 
> 
> 
> --------------------------------------------------------------------
--------
> 
>     From: flexcoders@yahoogroups.com 
[mailto:[EMAIL PROTECTED] On
> Behalf Of Jason Hawryluk
>     Sent: dinsdag 11 juli 2006 23:55
>     To: flexcoders@yahoogroups.com
>     Subject: RE: [flexcoders] Explorer-like drag & drop tree
> 
> 
>     I'm at home, and it's late, but i'll put together a sample, and 
post it
> when i get back to work ;)
> 
> 
>     Jason
> 
> 
>       -----Message d'origine-----
>       De : flexcoders@yahoogroups.com 
[mailto:[EMAIL PROTECTED]
> la part de Pat Buchanan
>       Envoyé : mardi 11 juillet 2006 22:58
>       À : flexcoders@yahoogroups.com
>       Objet : Re: [flexcoders] Explorer-like drag & drop tree
> 
>       Jason:
> 
> 
>       Do you have an example of this for us current/future newbies?
> 
> 
>       Thanks!
> 
> 
> 
>       On 7/11/06, Jason Hawryluk <[EMAIL PROTECTED]> wrote:
> 
>       What I do is on dragover after a set time when over the 
folder i open
> it. The user is then free to drag into the folder.
> 
> 
>       If you want i can give you more details, if you think this 
would help
> solve your problem.
> 
> 
>       jason
> 
> 
> 
> 
>         -----Message d'origine-----
>         De : flexcoders@yahoogroups.com
> [mailto:[EMAIL PROTECTED] la part de Jonas Windey
>         Envoyé : mardi 11 juillet 2006 15:59
>         À : flexcoders@yahoogroups.com
>         Objet : RE: [flexcoders] Explorer-like drag & drop tree
> 
>       Yea, go figure that every directory contains a dummy leaf. 
Wouldn't
> really
>       be explorer-like wouldn't it :-)
> 
>       -----Original Message-----
>       From: flexcoders@yahoogroups.com 
[mailto:[EMAIL PROTECTED]
> On
>       Behalf Of Tom Chiverton
>       Sent: dinsdag 11 juli 2006 15:33
>       To: flexcoders@yahoogroups.com
>       Subject: Re: [flexcoders] Explorer-like drag & drop tree
> 
>       On Tuesday 11 July 2006 12:36, Jonas Windey wrote:
>       > Since the directories in the deepest level won't ever have 
an open
> node,
>       > this is impossible.
> 
>       If it really is the case that it needs an open node, just add 
a dummy
> child
>       node.
> 
>       --
>       Tom Chiverton
> 
>       ****************************************************
> 
>       This email is sent for and on behalf of Halliwells LLP.
> 
>       Halliwells LLP is a limited liability partnership registered 
in
> England and
>       Wales under registered number OC307980 whose registered 
office address
> is at
>       St James's Court Brown Street Manchester M2 2JF. A list of 
members is
>       available for inspection at the registered office. Any 
reference to a
>       partner in relation to Halliwells LLP means a member of 
Halliwells
> LLP.
>       Regulated by the Law Society.
> 
>       CONFIDENTIALITY
> 
>       This email is intended only for the use of the addressee 
named above
> and may
>       be confidential or legally privileged. If you are not the 
addressee
> you
>       must not read it and must not use any information contained 
in nor
> copy it
>       nor inform any person other than Halliwells LLP or the 
addressee of
> its
>       existence or contents. If you have received this email in 
error please
>       delete it and notify Halliwells LLP IT Department on 0870 365 
8008.
> 
>       For more information about Halliwells LLP visit 
www.halliwells.com.
> 
>       --
>       Flexcoders Mailing List
>       FAQ: http://groups.yahoo.com/group/flexcoders/files/
flexcodersFAQ.txt
>       Search Archives:
> http://www.mail-archive.com/flexcoders%40yahoogroups.com
>       Yahoo! Groups Links
> 
>       __________ NOD32 1.1653 (20060711) Information __________
> 
>       This message was checked by NOD32 antivirus system.
>       http://www.eset.com
> 
> 
> 
>     __________ NOD32 1.1654 (20060711) Information __________
> 
>     This message was checked by NOD32 antivirus system.
>     http://www.eset.com
>







------------------------ Yahoo! Groups Sponsor --------------------~--> 
Yahoo! Groups gets a make over. See the new email design.
http://us.click.yahoo.com/XISQkA/lOaOAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~-> 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to