you can take out the reset function and replace the onRollOut function to
invoke this._controller.setRollOverItem(null);

On 4/14/06, elibol <[EMAIL PROTECTED]> wrote:
>
> I forgot to do something with the alignItems function, here it is:
>
> function alignItems(){
>     var i = _global.menuNum, keyIndex = isNaN(_global.currentlyOver)?
> null:_global.currentlyOver+1, done = true, items = _global.menuItems,
> targetDistance, distance;
>     while(i-->1){
>
>         targetDistance = items[i-1]._x + itemSize;
>          if(i==keyIndex) targetDistance += itemSpacing2;
>         else targetDistance += itemSpacing;
>         distance = targetDistance - items[i]._x;
>         if(Math.abs(distance)>1){
>
>             items[i]._x += distance*0.4;
>             if(done) done = false;
>         } else if(distance!=0) items[i]._x = targetDistance;
>
>     }
>     updateAfterEvent();
>     if(done) clearInterval(_global.intID);
> }
>
> On 4/14/06, elibol <[EMAIL PROTECTED] > wrote:
> >
> > Hey man, try this out
> >
> > init();
> >
> > function init(){
> >
> >     _level0.createEmptyMovieClip("menu",-1);
> >     _global.menuNum=6;
> >     _global.itemSize=75;
> >     _global.itemSpacing = 10;
> >     _global.itemSpacing2 = 40;
> >     _global.menuItems=[];
> >     _global.currentlyOver = null;
> >     var i = -1, mitems;
> >     while(++i < menuNum){
> >         mitems = _global.menuItems[i] = menu.attachMovie("clip","clip"+i,i);
> >
> >         mitems._x=i*(itemSize+itemSpacing);
> >
> >         mitems._y=Stage.height/2;
> >         mitems.index = i;
> >         mitems._controller = this;
> >         mitems.onRollOver = function(){
> >             this._controller.setRollOverItem( this.index);
> >         }
> >         mitems.onRollOut=function(){
> >             this._controller.reset();
> >         }
> >         mitems.onRelease=function(){
> >             trace("you clicked item "+this.index);
> >         }
> >     }
> > }
> >
> > function setRollOverItem(index:Number):Void {
> >     clearInterval(_global.intID);
> >     _global.currentlyOver = index;
> >     _global.intID = setInterval(this, 'alignItems', 15);
> > }
> >
> > function reset(){
> >     clearInterval(_global.intID);
> >     _global.currentlyOver = null;
> >     _global.intID = setInterval(this, 'alignItems', 15);
> > }
> >
> > function alignItems(){
> >     var i =-1, l = _global.menuNum, keyIndex =
> > isNaN(_global.currentlyOver)? null:_global.currentlyOver+1, done = true,
> > items = _global.menuItems, targetDistance, distance;
> >     while(++i<l){
> >         if(i!=0){
> >             targetDistance = items[i-1]._x + itemSize;
> >              if(i==keyIndex) targetDistance += itemSpacing2;
> >             else targetDistance += itemSpacing;
> >             distance = targetDistance - items[i]._x;
> >             items[i]._x += distance*0.4;
> >             if(Math.abs(distance)>1 && done) done = false;
> >         }
> >     }
> >     updateAfterEvent();
> >     if(done) clearInterval(_global.intID);
> >
> > }
> >
> > On 4/13/06, Flash guru <[EMAIL PROTECTED]> wrote:
> > >
> > > Hey all,
> > >
> > > I'm working on this nav system and it has one bug in it. I know there
> > > is
> > > something wrong with my logic somwhere, I've just looked at it to
> > > long.
> > > Basically the bug is if you roll your mouse from right to left to
> > > quickly
> > > you get this crazy spacing issue.  Any help would be great.
> > >
> > > To make the following code to work just create a rectangle 75x11 and
> > > make it
> > > into a symbol with a linkage name of 'clip'. That's it you don't need
> > > anything on stage and put the following code in frame 1.
> > >
> > > Thanks again
> > >
> > >
> > >
> > >
> > > init();
> > > function init(){
> > > //initialize menu items
> > > _level0.createEmptyMovieClip("menu",-1);
> > > _global.menuNum = 6;             //number of menuitems
> > > _global.menuSpacing = 85;        //spacing
> > >     //set properties for menu items
> > >     for(var i=0; i<menuNum+1; i++){
> > >         var mitems:MovieClip = menu.attachMovie("clip","clip"+i,i);
> > >         mitems._x = i * menuSpacing;
> > >         mitems._y = Stage.height/2 ;
> > >         mitems.id = i;
> > >         mitems.moved = 0;
> > >         mitems.onRollOver = function(){    checkState(this);    }
> > >         mitems.onRollOut =  function(){    moveBack(this);     }
> > >         mitems.onRelease =  function(){    trace("you clicked item "
> > > +this.id);}
> > >     }
> > > }
> > >
> > > function checkState(itemPressed){
> > >     var startItem = itemPressed.id +1;
> > >     for(var j=startItem; j<8; j++){
> > >         if(menu["clip"+j].moved == 1){    //checks to make sure you
> > > can't
> > > rollover an item more than once
> > >             delete menu["clip"+j].onRollOver;
> > >         }else{                            //moves items
> > >         var cliptoMove = menu["clip"+j];
> > >         var movePos = menu["clip"+j]._x +
> > > (cliptoMove._width/2);  //will be
> > > used to tween items to the right of the one pressed
> > >         tween(cliptoMove,movePos, itemPressed.id-1);
> > >         menu["clip"+j].moved = 1;
> > >         }
> > >     }
> > > };
> > >
> > > function moveBack(item){
> > >     var startItem = item.id +1;
> > >     for(var j=startItem; j<8; j++){
> > >         var cliptoMove = menu["clip"+j];
> > >         var origPos = j * menuSpacing;
> > >         tween(cliptoMove,origPos);
> > >         menu["clip"+j].moved=0;
> > >     }
> > >
> > > }
> > > function tween(clip,targetX,itemtoDel){
> > >     if(clip._x != targetX){
> > >         clip.onEnterFrame = function(){
> > >         var easing = .5;
> > >         var vx = (targetX - clip._x)*easing;
> > >         clip._x +=vx
> > >         }
> > >     }
> > > }
> > > _______________________________________________
> > > [email protected]
> > > To change your subscription options or search the archive:
> > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> > >
> > > Brought to you by Fig Leaf Software
> > > Premier Authorized Adobe Consulting and Training
> > > http://www.figleaf.com
> > > http://training.figleaf.com
> > >
> >
> >
>
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to