Groups | Blog | Home
all groups > flash (macromedia) > july 2004 >

flash (macromedia) : How to do this



jfharper
7/11/2004 11:46:45 PM
I am trying to add in an existing swf file to a timeline and have it fade in
using the opacity while it plays. I am very new to flash and am having
difficulty getting it to work. I assume in order for the opacity to work,
there must be a symbol set up for this...however, I am not sure how to add in
the swf...I've gotten suggestions on adding some code, i.e. loadMovie,
etc...but since I've tried addintg the code to the symbol timeline, it still
will not work the way I described above. I've attached a zip file of my
attempt (fla) along with the swf file I am trying to load...if anyone who knows
how to do this would not mind adjusting my file for me and reposting...that
would be great. I think having a file in front of me that works would be much
better than reading a post of how to do it...thanks for all your help.
JH
jfharper
7/12/2004 4:47:55 PM
I'm not sure what that reply was all about, I checked that link, but it jus brought me back to my post and your link reply???
Buff Dogg
7/12/2004 4:55:59 PM
Try something like this.

loadMovie("fox.swf", _root.loader); // loader is an empty movie clip that
you use to load the swf

once the movie is loaded do this.
if (_root.loader != undefined)
{
loader._alpha = 0;
while ( _root.loader.getBytesLoaded() < _root.loader.getBytesTotal() )
{
// run some loading code (not required)
}

// start fade in
id = setInterval(fadeIt, 1000); // 1000 is the time in milliseconds til the
function is run again

function fadeIt()
{
if (_root.loader._alpha < 100)
_root.loader._alpha += 5; // this adds 5 to the value of alpha
else
clearInterval( id ); // stops the function from running every second
}
jfharper
7/12/2004 5:48:12 PM
OK...thanks for the clarification and the code. I will try that, but I am
still a bit confused as to where exaclty to put the code, and how if might
work/interfere with other symbols in my timeline....like other image symbols
that will fade in before or after this swf symbol. In any case, I will try
that out, see if I can't get a handle on things from there and post if I have
any questions...thanks again.
JH
J formerly private news
7/12/2004 5:51:23 PM
you asked is there a quick link to your old post :P

I meant to post the link there hehe!

[quoted text, click to view]

J formerly private news
7/12/2004 5:54:47 PM
http://www.macromedia.com/cfusion/webforums/forum/messageview.cfm?catid=194&threadid=857923

you asked this question here, posting it in the original thread brought it
to the top of the forum again!


[quoted text, click to view]

jfharper
7/12/2004 6:19:20 PM
BuffDog,

I tried the following and I could not get it work at all...here are some
questions I have.

loadMovie("fox.swf", _root.loader); // loader is an empty movie clip that
you use to load the swf
- OK, am I supposed to have a symbol named "loader" in my fla? and am I
supposed to put this code on the symbol's timeline or the main timeline?

once the movie is loaded do this.
if (_root.loader != undefined)
{
loader._alpha = 0;
}
- I cut out the while statement cuz I wanted to keep things simple to begin
with.

// start fade in
id = setInterval(fadeIt, 1000); // 1000 is the time in milliseconds til the
function is run again

function fadeIt()
{
if (_root.loader._alpha < 100)
_root.loader._alpha += 5; // this adds 5 to the value of alpha
else
clearInterval( id ); // stops the function from running every second
- I added all of the above code to the same keyframe (5) on my main timeline,
I also striped the loader movie clip symbol contained in my fla...the fox.swf
file is in the same directory as the fla file, and nothing happened at
all...would you mind clarify where I might have gone wrong...thanksl
JH


AddThis Social Bookmark Button