thanks for the input guys - it's really helpful (always learning and all that)
did anyone have an opportunity to look at the _x positioning stuff to see how it could be any better? alz On Thu, Jun 12, 2008 at 6:27 PM, Merrill, Jason < [EMAIL PROTECTED]> wrote: > >>> mcScrollingIconContainer["clip"+i].onRelease = function():Void > > Don't use anonymous functions. If you have to use AS2, then use > mx.utils.Delegate instead. > > Also, you keep repeating, "mcScrollingIconContainer["clip"+i]" in your > code over and over in the same loop. Instead, I think a tighter way > (and perhaps better performance since there is not a continual lookup) > is to create a reference to it instead, and then just use the reference > to assign behavior: > > var thisContainer:MovieClip = mcScrollingIconContainer["clip"+i]; > > thisContainer.onRelease = Delegate.create(this, onContainerRelease); > thisContainer.onRollOver = Delegate.create(this, onContainerRollOver); > thisContainer.onPress = Delegate.create(this, onContainerPress); > thisContainer.onReleaseOutside = Delegate.create(this, > onContainerReleaseOutside); > > > > Jason Merrill > Bank of America > Global Technology & Operations & Global Risk L&LD > eTools & Multimedia > > Join the Bank of America Flash Platform Developer Community > > Are you a Bank of America associate interested in innovative learning > ideas and technologies? > Check out our internal GT&O Innovative Learning Blog & subscribe. > > > > >>-----Original Message----- > >>From: [EMAIL PROTECTED] > >>[mailto:[EMAIL PROTECTED] On Behalf > >>Of eric e. dolecki > >>Sent: Thursday, June 12, 2008 1:19 PM > >>To: Flash Coders List > >>Subject: Re: [Flashcoders] looking at the maths for an osx style dock > >> > >>sorry for the OT response, but man this code makes me so glad > >>I don't do AS2 anymore ;) > >>- e. > >> > >>On Thu, Jun 12, 2008 at 12:48 PM, allandt bik-elliott > >><[EMAIL PROTECTED]> > >>wrote: > >> > >>> hi guys - i queried this a few days ago when all the messages were > >>> disappearing into the hole - i've amended my code so it's > >>pretty darn > >>> close to what i want but not quite > >>> > >>> basically, i'm writing an osx style dock and at the moment, the > >>> scaling is working perfectly but the positioning is a bit > >>flaky - it > >>> looks like a string of beads on elastic that snap to the > >>previous bead > >>> - i've posted an example here > >>http://www.m2surveys.com/homeserve/dock/ > >>> > >>> the code that governs the size and position is this method > >>> > >>> private function addIconMouseListeners():Void > >>> { > >>> var ref:Object = this; > >>> > >>> for (var i:Number = 0; i < aIconArray.length; i++) > >>> { > >>> mcScrollingIconContainer["clip"+i].sTitle = > >>> aIconArray[i].sTitle; > >>> mcScrollingIconContainer["clip"+i].sLink = > >>> aIconArray[i].sLink; > >>> mcScrollingIconContainer["clip"+i].nColour = > >>> aIconArray[i].nColour; > >>> mcScrollingIconContainer["clip"+i].ID = i; > >>> mcScrollingIconContainer["clip"+i].thisX = > >>> mcScrollingIconContainer["clip"+i]._x; > >>> mcScrollingIconContainer["clip"+i].onMouseMove = > >>function():Void > >>> { > >>> var thisXmouse = Math.round(this._xmouse); > >>> var nIconSpan:Number = Math.round(ref.nIconWidth*5); > >>> //this governs the position and is the strange bit > >>> var nXPercent:Number = > >>> Math.round(thisXmouse/nIconSpan*100)/1.8; // adjusting this by /1.8 > >>> has made the icons move along - otherwise they stay static, > >>with only > >>> the moused over icon scaling and moving > >>> nXPercent = (nXPercent > 45) ? 45 : > >>(nXPercent < -45) ? > >>> -45 > >>> : nXPercent; > >>> this._x = this.thisX - nXPercent; > >>> > >>> // this governs the scale and works great > >>> if (thisXmouse < nIconSpan && -1*thisXmouse > >>< nIconSpan) > >>> { > >>> var nWidth:Number = ref.nIconWidth + > >>ref.nIconSpacing; > >>> var nPercent:Number = > >>Math.round((thisXmouse < 0) ? > >>> (thisXmouse/nIconSpan) *-100 : (thisXmouse/nIconSpan) *100); > >>> nPercent = 100 - nPercent; > >>> > >>> if (nPercent > 55) > >>> { > >>> this._yscale = this._xscale = nPercent; > >>> > >>> } else { > >>> this._yscale = this._xscale = 55; > >>> } > >>> } else { > >>> this._yscale = this._xscale = 55; > >>> } > >>> }; > >>> mcScrollingIconContainer["clip"+i].onRollOver = > >>function():Void > >>> { > >>> this.swapDepths(1000); // not needed after > >>_x is figured out > >>> ref.tfTradeTitle.text = this.sTitle; > >>> ref.addGlow(this); > >>> > >>> }; > >>> mcScrollingIconContainer["clip"+i].onRollOut = > >>function():Void > >>> { > >>> ref.removeGlow(this); > >>> } > >>> mcScrollingIconContainer["clip"+i].onRelease = > >>function():Void > >>> { > >>> getURL(this.sLink, "_self"); > >>> trace("getURL: "+this.sLink); > >>> }; > >>> > >>> } > >>> } > >>> > >>> could anyone make any suggestions as to how i can tighten it up, > >>> please? I could really use some help > >>> > >>> thanks a lot > >>> alz > >>> _______________________________________________ > >>> Flashcoders mailing list > >>> [email protected] > >>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > >>> > >>_______________________________________________ > >>Flashcoders mailing list > >>[email protected] > >>http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > >> > _______________________________________________ > Flashcoders mailing list > [email protected] > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > _______________________________________________ Flashcoders mailing list [email protected] http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

