Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

adding effect to attached mc with dynamic jpg

Status
Not open for further replies.

AudreyLucy

Technical User
Jul 19, 2002
42
US
Hi,
I'm using an attached movie clip, as a host clip for dynamically loaded jpgs. I would like to add an effect to this attached movie clip.

I want the host clip to "fade in"...but I'm having some trouble figuring out the proper syntax. I've had success getting the jpg to load into the host, but I can't get the host to fade in...

Here's the AS I have used...I'll add comments so it will be a little more clear as to what I'm trying to do on each line of script, please ask me if you need elaboration:


//tell host clip..."Be invisible."
image1_mc._alpha = 0;
//attach the host movie clip to the root level.
"image_mc" is the linkage identifier and
"image1_mc" is the new name of the host clip[/color]
_root.attachMovie("image_mc", "image1_mc", 1);
//load the jpg into the movie clip
image1_mc.onEnterFrame = function() {
_root.loadMovie("blur.jpg","image1_mc");
};

//"image1_mc", fade in. This AS works when I am NOT using attachMovie.
image1_mc.onLoad = function() {
image1_mc.steps = 10;
image1_mc._alpha += 100/this.steps;
};
stop();


Does anyone know what I can do to make this work?
 
image1_mc._alpha = 0;

fade = setInterval(fadeIn,100)

function fadeIn(){
image1_mc._alpha ++;
if(image1_mc._alpha >= 99){
clearInterval(fade)
}
}

 
Thanks for replying...
I tried your suggestion, but it still will not work properly. I'm getting the same results.

I removed my "fade in code"

image1_mc.onLoad = function() {
image1_mc.steps = 10;
image1_mc._alpha += 100/this.steps;
};
stop();

and replaced it with yours:

image1_mc._alpha = 0;
fade = setInterval(fadeIn,100)
function fadeIn(){
image1_mc._alpha ++;
if(image1_mc._alpha >= 99){
clearInterval(fade)
}
}

I know I'm doing something wrong here...Did I put the code in the right place? I placed it below the AS that attaches the clip and loads the jpg.
 
can you post the fla...it must be something simple....the code is ok
 


Can I email you a zip file? I'm not sure how to post the fla here.

Thanks for your help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top