A Flash Developer Resource Site

Results 1 to 20 of 22

Thread: [RESOLVED] Tween via Array?

Threaded View

  1. #1
    Member
    Join Date
    Sep 2009
    Posts
    78

    Exclamation Tween via Array?

    Hi there;

    I'm working on a for-fun project where I have a bunch of letters, in a row, that are jumbled. What is supposed to happen is that if you press one of the letters, then press another, and it is supposed to tween the two of them to the others position. For some reason though, the tween doesn't seem to be working (Since there are about 12 or 13 letters, I was planning on temporarily placing the two to be tweened into an array, and then tween them via the array)

    Here is my code
    PHP Code:
    import flash.events.MouseEvent
    import flash
    .geom.Point
    import com
    .greensock.TweenLite;
    import com.greensock.easing.*;

    var 
    tempPoint:Point = new Point(0,0);
    var 
    movePoint:Point = new Point(0,0);
    var 
    queue:Array = new Array;
    var 
    i:int 1

    hint_mc
    .visible false;


    trace(tempPoint);

    hint.addEventListener(MouseEvent.MOUSE_UPgiveHint)

    function 
    giveHint(me:MouseEvent):void{
        switch(
    hint_mc.visible){
        case(
    false):
            
    hint_mc.visible true;
            break;
        case(
    true):
            
    hint_mc.visible false;
            break;
        }
    }

    a_text.addEventListener(MouseEvent.MOUSE_UPswitchA)
    h_text.addEventListener(MouseEvent.MOUSE_UPswitchH)

    function 
    switchA(me:MouseEvent):void{
        if(
    tempPoint.== && tempPoint.== 0){
            
    tempPoint.a_text.
            tempPoint
    .a_text.y
            queue
    [0] = a_text
            trace
    (tempPoint);
        }else if(
    movePoint.== && movePoint.== 0){
            
    movePoint.a_text.x
            movePoint
    .a_text.y
            queue
    [1] = a_text
            trace
    (movePoint)
            
    0
        
    }else{
            return;
        }    
                    
    }

    function 
    switchH(me:MouseEvent):void{
        if(
    tempPoint.== && tempPoint.== 0){
            
    tempPoint.h_text.
            tempPoint
    .h_text.y
            queue
    [0] = h_text 
            trace
    ("The temporary point is " tempPoint);
        }else if(
    movePoint.== && movePoint.== 0){
            
    movePoint.h_text.x
            movePoint
    .h_text.y
            queue
    [1] = h_text
            trace
    ("The movement point is " movePoint)
            
    0;
        }else{
            return;
        }    
                    
    }



    while(
    1){
        
    TweenLite.to(queue[0], 1, {x:movePoint.xy:movePoint.y,  ease:Linear.easeNonedelay:0overwrite:false});
        
    TweenLite.to(queue[1], 1, {x:tempPoint.xy:tempPoint.y,  ease:Linear.easeNonedelay:0overwrite:false});
        
    tempPoint.0
        tempPoint
    .0
        trace
    ("The tween should have worked. If it did not, then there is something fatally wrong with your coding. Eat a taco and then try again.")
        
    movePoint.0;
        
    movePoint.0;
        
    i++;

    Last edited by Bryguy; 02-08-2010 at 07:51 PM.

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