A Flash Developer Resource Site

View Poll Results: Was this post clear and to the point?

Voters
1. You may not vote on this poll
  • Wait what? say that again....complete jibberish

    0 0%
  • i don't think u knwo what yoru talking about

    0 0%
  • you could clarify your post better

    1 100.00%
  • VERY CLEAR POST!

    0 0%
Multiple Choice Poll.
Results 1 to 20 of 27

Thread: array and indexing movie clips

Hybrid View

  1. #1
    Senior Member
    Join Date
    Oct 2009
    Posts
    112
    is there a way to reset the last clicked currentTarget?

    something like "(DisplayObject(e.currentTarget).name).resetAfterE vent();

    i tried updateAfterEvent(); but that didnt solve the problem...

    basically i have multiple event listeners, one for MOUSE_DOWN, MOUSE_UP, and DOUBLE_CLICKED.
    then i have a timer event, where everytime the MOUSE_DOWN lasts for about 3 seconds, the binary socket sends out another number.

    for all my event listeners, it has been sending out the right number, but when i use the timer event, it always sends out the last clicked button.

    TO SUMMARIZE:
    for example, ill hold down "on1" and it will say "on1 was held"

    then ill hold down on2, and it will still say "on1 was held"

  2. #2
    rabid_Delineator AttackRabbit's Avatar
    Join Date
    Dec 2003
    Location
    Orlando, Florida
    Posts
    481
    Code:
    import flash.utils.Timerl
    import flash.events.TimerEvent;
    
    var downTimer : Timer;
    var selectedItem : MovieClip;
    
    var ONarray:Array=new Array(on1,on2,on3,on4,on5);
    stop();
    for (var i:uint = 0; i < ONarray.length; i++) {
        var ON:MovieClip= ONarray[i];
        ON.buttonMode = true;
        ON.addEventListener(MouseEvent.MOUSE_DOWN, Press1);
        ON.addEventListener(MouseEvent.MOUSE_UP, onMouseUp );
    };
    
    function Press1(e:MouseEvent):void{
      downTimer  = new Timer( 3000 , 0 );
      downTimer.addEventListener(  TimerEvent.TIMER , handleTimer );
      downTimer.start();
      selectedItem  = e.currentTarget;
    //do other things
    };
    
    function handleTimer( evt : TimerEvent ) : void {
    //do something
       trace( selectedItem );
    };
    
    function onMouseUp( evt : Event ) : void {
       downTimer.stop();
       downTimer.removeEventListener(  TimerEvent.TIMER , handleTimer );
       downTimer = null;
    //do more things
    };
    Last edited by AttackRabbit; 11-10-2009 at 10:21 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center