Home Tutorials Forums Articles Blogs Movies Library Employment Press
Prev Previous Post   Next Post Next
Old 10-13-2009, 08:57 PM   #1
Subhaus design
Registered User
Join Date: Oct 2009
Posts: 3
Default Resorting Array


I'm sure that someone probably asked about this problem, but after 2 days of googling I haven't find anything similar.

I'm making some vertical menu where button (actually mc) on click should tween to the end of menu.

I've try to splice clicked item, and after that to push it back to the same array so it will go to it's end. After that, I've plan to change y position of all items through for loop and using Tweener.

here's my code:

ActionScript Code:
import caurina.transitions.*; var mits:Array = new Array("about", "biography", "work"); var mitems:Array = new Array(); for(var i:int = 0; i<mits.length; i++) {     var mitem:menuItm = new menuItm();     mitem.id = i;     mitem.itm_txt.text = mits[i];     mitem.itm_txt.wordWrap = false;     mitem.itm_txt.autoSize = TextFieldAutoSize.LEFT;     mitem.x = 10;     mitem.y = 10+i*40;     mitem.name = "mitem"+i;     menus.addChild(mitem);     mitem.buttonMode = true;     mitem.mouseChildren = false;     mitems.push(mitem);     mitem.addEventListener(MouseEvent.CLICK, moveItems); } function moveItems(e:MouseEvent):void {     var spliced:Array = mitems.splice(e.target.id, 1);     mitems.push(spliced);     for(var a:int = 0; a<mitems.length; a++) {         var ipsilon:Number = 10+(a*40);         Tweener.addTween(mitems[a], {y:ipsilon, time:1});         trace(mitems[a].id);     } }

this code works for only few clicks (3 I think). The output look like this:





## [Tweener] Error: The property 'y' doesn't seem to be a normal object property of [object menuItm] or a registered special property.
I've try also with eather older Tweener class and TweenLite. Using them I'm not getting error, but the script is acting the same.

What am I doing wrong?

ps. sorry for my bad english. Hope you've understand.
Subhaus design is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 02:19 PM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.