A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Making actionscript fades gradual

  1. #1
    Senior Member
    Join Date
    Feb 2002
    Location
    Newcastle Upon Tyne
    Posts
    324

    Making actionscript fades gradual

    When I fade a movie by reducing its alpha setting in a 'for' loop, it is virtually instantaneous. How would I make it more gradual and subtle. I have had a little look at the set Interval function but can't figure how I would use it here.


    Can anyone help?

    Thanks
    Graeme
    www.reebox.co.uk

  2. #2
    Jace Masula
    Join Date
    Apr 2000
    Posts
    100
    loop the script between 2 frames, the for loop will preform all actions until the condition is true BEFORE returning values

  3. #3
    Senior Member
    Join Date
    Feb 2002
    Location
    Newcastle Upon Tyne
    Posts
    324
    Not quite sure what you mean, can you give me an example?

    Graeme
    www.reebox.co.uk

  4. #4
    Senior Member of Toon Army lucky-black-cat's Avatar
    Join Date
    Aug 2002
    Location
    Benarraba Andalucia Spain
    Posts
    303
    Hi

    You should check out onClipEvent(enterFrame); in the reference.

    You can have some thing like this ... on the action for a movie clip instance named mc1, which is on the main timeline (_root).

    Code:
    onClipEvent(load){
    	_root.mc1._alpha = 100;
    }
    onClipEvent(enterFrame){
    	if(_root.mc1._alpha >0) {
    		_root.mc1._alpha -= 5;//change this to speed/slow rate
    	}
    }
    This would reduce the _alpha of mc1 by 5 each frame that is played. Change the 5 in the example or the movie frame rate to speed/slow.
    http://www.property-in-the-sun.com
    Cheap Holidays in Andalucia Spain for Flash Programmers from 2005!

  5. #5
    Senior Member
    Join Date
    Feb 2002
    Location
    Newcastle Upon Tyne
    Posts
    324
    I'm looking to do the fade on the rollover of one of the buttons. Here's the code I've got for the rollover:

    Code:
    newButton.onRollOver = function() {
    		for (shade=0; shade<100; shade++) {
    			_root.mouthgraphic._alpha -= (shade/1000);
    		}
    		createEmptyMovieClip("rol", 1000);
    		rol._x = 350;
    		rol._y = 500;
    		rol.createTextField("rollovertext", 10, 0, 0,500, 300);
    		rol["rollovertext"].text = this.var_over;
    		rol["rollovertext"].setTextFormat(rollover);
    How could I incorporate it into this?

    Thanks

    Graeme
    www.reebox.co.uk

  6. #6
    Senior Member
    Join Date
    Feb 2002
    Location
    Newcastle Upon Tyne
    Posts
    324
    It's alright. I've managed to sort this one.

    Thanks for all your help,

    Graeme
    www.reebox.co.uk

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