A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Controling alpha via actionscript

  1. #1
    Senior Member
    Join Date
    Jul 2000
    Posts
    137

    Controling alpha via actionscript

    Hi, there I have an effect I want to acomplish where some letters that have alpha value = 0 slowly start to fade in as well as their size starts to grow, but the thing I'm having problem with is setting their alpha value back to 0 once it has reached 100,
    this is the script I have so far and it works ok at the start of the effect but it just keeps growing and the alpha value never fades away

    instancename.onEnterframe = function() {
    this._alpha += 1;
    this._xscale += 0.5;
    this._yscale += 0.5;
    if (this._alpha>=100) {WHAT CODE DO I INSERT HERE IN ORDER FOR THE ALPHA VALUE TO START GOING DOWN???
    }
    };

    for any help you may provide, muchas gracias.

  2. #2
    Legendary Super Hero Flashsaga's Avatar
    Join Date
    Jul 2003
    Location
    Earth (Temporarily)
    Posts
    335
    hi,
    well im not exactly sure what ur trying to do, but i would suggest using a motion tween to make things easier, however since the title specificly saying via actionscript ill assume that theres a reason to not use a motion tween, well i came up with this code, u might have to rework a bit of ur code to fit this in properly ( but its not too hard to change)

    onClipEvent (load) {
    this._alpha=0;
    alphagrow = 1;
    }
    onClipEvent (enterFrame) {
    this._alpha += alphagrow;
    if (this._alpha >=100) {
    alphagrow = -1;
    }
    }

    this however only works on a moviclip, so u would have to make ur text a movieclip, or u could edit it a bit so that it will work in ur function that u have made (which isnt too hard) if u have any questions about the code or how to put it in ur function feel free to ask

  3. #3
    Senior Member
    Join Date
    Jul 2000
    Posts
    137

    It worked

    thanks a million my friend your suggestion was right on the money......I appreciate it thanks again.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center