A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Stop Alpha Gain

  1. #1
    Member
    Join Date
    Aug 2008
    Posts
    38

    Stop Alpha Gain

    LOL... Okay once again I am plagued with a problem. How do I stop the alpha/fader gain? Notice how when I rollover the object I want it to stay at the 50... When it goes to 50 it gains back to 100... How can I stop the alpha from adding to 50 once I rollover? Thanks for all the help guys!





    PHP Code:
    onClipEvent(load){
    this._alpha=0;
    this.fader=0;
    }

    onClipEvent (enterFrame) {
    if (
    this.fader==0){
    this._alpha+=12;
    }
    if (
    this._alpha>=100){
    this.fader=0;
    }
    }
    on (rollOver) {
        
    _parent["color1"]._alpha=50;
        
    xstart this._x;
        
    ystart this._y;
        
    Mouse.show();


  2. #2
    Member
    Join Date
    Aug 2008
    Posts
    38
    Did I crap an egg on this one? lol...

    I can't stop the gain of the alpha... Once it hits 100 I'd like for it to stop adding ++++

  3. #3
    Member
    Join Date
    Aug 2008
    Posts
    38
    Anyone?


    Maybe it would help if I try to explain what I am trying to accomplish rather than fix it.


    I would like for the MC to load at a opacity of 0. Once loaded, it will fade in at a rate of +12 when the movie entersframe. I would like for the gain or rather the fade to stop once opacity has reached 100. That way when I rollover the MC it will set the opacity to 50 and stay at 50 until I rollout the MC. The issue is that it will go to 50 when I roll over, but will automatically add +12 again. How can I get it to stay on 50 when I rollover?

  4. #4
    :
    Join Date
    Dec 2002
    Posts
    3,518

    Maybe you can adapt this to what you are trying to do...

    Code:
    onClipEvent (load) {
    	this._alpha = 0;
    	function fadeIn() {
    		if (this._alpha < 100) {
    			this._alpha += 12;
    			if (this._alpha >= 100) {
    				delete this.onEnterFrame;
    			}
    		}
    	}
    	this.onEnterFrame = fadeIn;
    }
    on (rollOver) {
    	delete this.onEnterFrame;
    	_parent["color1"]._alpha = 50;
    	xstart = this._x;
    	ystart = this._y;
    	Mouse.show();
    }
    on (rollOut) {
    	_parent["color1"].onEnterFrame = fadeIn;
    }

  5. #5
    Member
    Join Date
    Aug 2008
    Posts
    38
    Figured it out.


    PHP Code:
    onClipEvent (load) {
        
    this.onEnterFrame = function() {
            
    this._alpha += 12;
            if (
    this._alpha>=100) {
                
    delete this.onEnterFrame;
            }
        }; 

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