Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 11-23-2004, 07:36 AM   #1
harryz
Registered User
 
Join Date: Nov 2004
Posts: 2
Default actionscript fade in/out effect

i just need a simple snippet of code to fade a movie clip and then a snippet to fade it out. i'v searched all over and it doesnt seem to be working. im using MX not 2004.

heres the little code i have, i first set the _alpha to 10, which seems to work and then i wanted to fade it, but it just directly jumps to that alpha.

Code:
		function fadeIn(MC){
		with (MC){
		_alpha += _alpha/2;
		}
	}
	loadMovie( somemovie.swf, "mcImage" );
		mcImage._alpha= 10;
		fadeIn(mcImage);{
hope someone can help
harryz is offline   Reply With Quote
Old 11-23-2004, 02:02 PM   #2
Xeef
Off-Line
 
Xeef's Avatar
 
Join Date: Aug 2004
Location: Ibiza/Spain language :Hungarian/German/ abit English
Posts: 6,539
Default

hi and welcome to As.Org

PHP Code:
this.createEmptyMovieClip("tester_mc"1);
tester_mc.loadMovie("MySWF.swf");
function 
checkLoaded(target_mc:MovieClip) {
    var 
pctLoaded:Number target_mc.getBytesLoaded()/target_mc.getBytesTotal()*100;
    if (!
isNaN(pctLoaded) && (pctLoaded>0)) {
        
FadeIn(target_mc);
        
trace("clearing interval");
        
clearInterval(myInterval);
    }
}
var 
myInterval:Number setInterval(checkLoaded100tester_mc);
function 
FadeIn(target_mc) {
    
trace("movie loaded "+target_mc);
    
target_mc.onEnterFrame = function() {
        
this._alpha--;
        if (
this._alpha<=0) {
            
trace("fade out finished");
            
delete this.onEnterFrame;
        }
    };

2 things

1. if you load somthing it's not INSTANTLY there but code execution goes on so if you start load and next line do somthing whit the loaded clip it's not there because the load not finished yet
2. you need to execute the fade over more frames (else way it's not fade just JUMP from one value to the other)
__________________

test your self -->http://www.actionscript.org/forums/s...86&postcount=8
Xeef is offline   Reply With Quote
Old 11-23-2004, 09:08 PM   #3
harryz
Registered User
 
Join Date: Nov 2004
Posts: 2
Default hmmmm, doesnt seem to work, heres more details

so i tried that, and i can't seem to get it to fade, heres the rest of the code im trying to use the fade with, its a slideshow of sorts:

Code:
//initialize slide show
if( init==null )
{
	var init = true; //sets the app as initilized
	var num = 0;  //The current image displayed
	var path = 'http://mywebsite/';
	var imageArray = new Array( 
							path + "swf/bgimg/sse.jpg",
							path + "swf/bgimg/banner1.jpg",
							path + "swf/bgimg/banner2.jpg",
							path + "swf/bgimg/banner3.jpg",
							path + "swf/bgimg/banner5.jpg",
							path + "swf/bgimg/banner6.jpg",
							path + "swf/bgimg/banner7.jpg",
							path + "swf/bgimg/banner8.jpg",
							path + "swf/bgimg/banner9.jpg",
							path + "swf/bgimg/banner10.jpg"); 

		//Makes the initial call to the RotateImage function
	RotateImage();

		//creates a listner that calls event on this interval
	setInterval( RotateImage, 10*1000 );
	stop();
}

	//Shows the next image in array
function RotateImage()
{
	if( num >= imageArray.length )
	{
		num=0;
	}
	
//this is where the movie loaded and i want it to fade in at this point when it is loaded. mcImage is an existing movie clip i have setup under a few layers of other stuff, and i want the movie to stay under there. 
	loadMovie( imageArray[ num ], "mcImage" );



	num++;
}
harryz is offline   Reply With Quote
Old 11-24-2004, 11:42 AM   #4
farafiro
Addicted To FLASH
 
farafiro's Avatar
 
Join Date: Dec 2001
Location: Egyptian in UAE
Posts: 12,436
Send a message via MSN to farafiro Send a message via Yahoo to farafiro
Default

http://proto.layer51.com/s.aspx
serach for "fade" in Movieclip section
__________________
‚€* GOD Is Near ‚€*
Questions Don't PM for Questions . Thanks
An eye for an eye, make the whole world blind
_____________________________________________GHANDI
farafiro is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:41 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.