A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Help AS3! Relocate a clip depending on other clips position

  1. #1
    Junior Member
    Join Date
    Nov 2009
    Posts
    16

    Help AS3! Relocate a clip depending on other clips position

    Hi again!
    In a preview post, without success, I was trying to do an Elastic Menu in AS3.
    The problem creating the menu with differents elements and submenus is resolved.
    Now, I need to relocate the menu elements dinamicly through TweenLite.
    For that, I use this method named posicionar();
    Code:
    private function posicionar():void {
    			
    			for (i=0; i<tamArray-1; i++) {
    				var elemento=itemArray[i+1];
    				newdestino = (itemArray[i].y+itemArray[i].height+2);
    				//elemento.y=newdestino; 
    				//When I use the line above, works perfect. If I use the line below I need 3 clicks over one element to relocate the rest in the right position.
    				TweenLite.to(elemento, 1, {x:elemento.x, y:newdestino, ease:Elastic.easeOut});
    			}
    		
    		}
    As I say in the commented codeline, the Tween doesn't get the right destination. I think is because the loop or may not. Should be another logic to do relocating stuff.
    Any help is wellcome. If I solve this problem, I will share the hole code for a Elastic XML Menu with the forum people.
    Thanks in advance.
    RO

  2. #2
    rabid_Delineator AttackRabbit's Avatar
    Join Date
    Dec 2003
    Location
    Orlando, Florida
    Posts
    481
    Usually this means something your doing to the target object is changing the intended value. Have you tried changing your ease type to something else. Try changing It from Elastic to just Linear. Elastic is gonna take longer to complete and actually will tween the object past and before its target value to achieve the elastic effect. I would imagine the problem is you are doing this in a loop and not waiting for each item to finish , before entering the next iteration.

  3. #3
    Junior Member
    Join Date
    Nov 2009
    Posts
    16
    Quote Originally Posted by AttackRabbit View Post
    Usually this means something your doing to the target object is changing the intended value. Have you tried changing your ease type to something else. Try changing It from Elastic to just Linear. Elastic is gonna take longer to complete and actually will tween the object past and before its target value to achieve the elastic effect. I would imagine the problem is you are doing this in a loop and not waiting for each item to finish , before entering the next iteration.
    Thanks for your answer!
    Hi, I've tried Linear but doesn't work at all. A programmer from other Forum, advise me to take the destination value from another array where is contained the last position of the elements.

    destiny=positionsArray[i].y+itemArray[i].height+2".

    I'm trying to do it without the "y" value and set the final destination through a method that returns the value only using the menu elements(itemArray.lenght()) and the height of each element.
    Any idea?
    We keep thinking!

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