Hi,
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:
Quote:
0
2
undefined
---------------------
2
undefined
undefined
---------------------
2
undefined
## [Tweener] Error: The property 'y' doesn't seem to be a normal object property of [object menuItm] or a registered special property.
undefined
|
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.