[flashpro] Fade scripter for objects
pete otaqui
pete.otaqui at gmail.com
Fri May 20 08:31:45 EDT 2005
The only issue with Denis's method is one of memory consumption and
the flash scope chain. Although in this particular example the effect
is probably negligble, you can find out more about the problems with
defining functions inside functions here:
http://timotheegroleau.com/Flash/articles/scope_chain.htm
An alternative method might be like this:
function fade(_mc,maxi) {
_mc.maxi = maxi;
_mc.onEnterFrame = fademe;
}
function fadme() {
if ( math.round(this._alpha)==this.maxi ) {
trace("stopped");
delete this.onEnterFrame;
} else {
this._alpha += (this._maxi-this._alpha)/10;
trace(this._alpha);
}
}
Cheers
Pete
On 20/05/05, Denis Huë <denis at atypic.be> wrote:
>
> function fade(here, maxi) {
> here.onenterframe = function() {
> if (math.round(here._alpha)==maxi) {
> delete here.onenterframe;
> trace("stopped");
> } else {
> trace(this._alpha);
> finalfo = maxi;
> distancefo = (finalfo-here._alpha);
> here._alpha += distancefo/10;
> }
> };
> }
>
> fade(yourmovieclip,10);
> stop();
>
> my function works for fadein & fadeout
>
> // denis Huë / www.atypic.be
>
> -----Message d'origine-----
> De: flashpro-bounces at muinar.org [mailto:flashpro-bounces at muinar.org] De la
> part de Valentijn Langendorff
> Envoyé: vendredi 20 mai 2005 13:59
> À: Mailing list for professional Flash designers and developers
> Objet: [flashpro] Fade scripter for objects
>
> >
> > Hi All,
> >
> > I'm trying to fade an object [button] from 100% to 20%
> > Within a actionscript...
> > What am I doing wrong here!. Ps. Placed in the first frame of a scene x
> >
> >
> > function fade(){
> > this._alpha = 100;
> >
> > this.onLoad = function(){
> > if (this._alpha<100 && this._alpha>20){
> > this._alpha -= 5;
> > }
> > }
> >
> >
> > }
> > buttoninstanceorotherobjects.fade();
> >
> >
> > Regards Valentijn
> >
> > ______________________________
> >
> > ICT Solutions & Design
> >
> > Valentijn Langendorff
> > E : valentijn at multimediaconsult.nl
>
> ------------------------------------------------------------------
> send message to the list: mailto:flashpro at muinar.org
> [FlashPro] list info, subscribe, archive: http://flash-list.com/
> There's also a WebPro mailing list: http://webdesign-list.com/
> cutting-edge sounds for flash: http://flash-sounds.com/
>
> ------------------------------------------------------------------
> send message to the list: mailto:flashpro at muinar.org
> [FlashPro] list info, subscribe, archive: http://flash-list.com/
> There's also a WebPro mailing list: http://webdesign-list.com/
> cutting-edge sounds for flash: http://flash-sounds.com/
>
--
pete otaqui
new media developer
pete.otaqui at gmail.com
pete at thisnewthing.com
More information about the FlashPro
mailing list