|
-
Senior Member
movieclip AS _alpha fade trouble
Hello again!
Now that I'm finally moved into my new place, I'm getting back to working on my animated cartoon. During my "off time" I got a copy of the old Moock ActionScript guide and read through it. I'm a pretty decent php and ruby coder, so I figured actionscript would be fairly easy to pick up. But, alas, I'm having trouble right out of the blocks. Hence this post.
I'm trying to fade a bit of floating/shimmering text in and out during an opening credit sequence. I got my text doing what it needs to do and stuffed it into a one-frame movieclip. Then, I placed the following code on that one frame:
Code:
onClipEvent (load) {
this._alpha = 0;
}
onClipEvent (enterFrame) {
for (var i = 1; i < 60; i++) {
if (i < 20) {
this._alpha += 5;
}
else {
if (i > 40) {
this._alpha -= 5;
}
else {
this._alpha = 100;
}
}
When I play the resulting swf, the text floats/shimmers just as pretty as you please, but no fade in and fade out. Thinking my code might be the culprit, I tried substituting code I found on the board that, while it didn't aim to achieve the same sort of fade in and fade out I was going for, did nonetheless use the same onClipEvent handlers ("load" and "enterFrame"), but that code also failed. So I'm thinking that i've done something wrong in the way I've attached the code? Here's my structure:
Main timeline - has four keyframes. Keys 1 and 3 have 0 tweens; key 2 has 60.
mcFadeInOut is manually placed on the stage in keyframe 2 and manually removed in keyframe four. mcFadeInOut is itself one frame long and has the above code on that frame. This mc in turn contains two child clips that actually do the floating/shimmering work, said work achieved via tweaked motion scripts.
Any help setting me straight would be appreciated. The sooner I can get this working, the sooner I can get back to pretending to be as smart as I like to think I am. 
Thanks,
Matt
-
Senior Member
Okay, I knew it was something basic. It seems I need to add the actionscript to the movieclip via the movieclip's properties dialogue rather than putting it on an individual (and in this case the only) frame in the clip. Now that I've got that part working, I can work out the bugs in my script logic.
Matt
-
Senior Member
Well, I guess it makes sense that if you stick a for loop inside an enterFrame event, you keep resetting the for loop. So I made this more basic and threw out the middle condition since it wasn't really needed. Here's what I ended up with and it works.
Code:
onClipEvent(load) {
this._alpha = 0;
var counter = 1;
}
onClipEvent(enterFrame) {
counter++;
if (counter <= 20) {
this._alpha += 5;
}
else {
if (counter >= 70) {
this._alpha -= 5;
}
}
}
Matt
-
Glad you could help! 
-
Senior Member
 Originally Posted by sm5574
Glad you could help!

Heh. In my case, it's just a good example of the Blind Squirrel Principle at work...
The last time I was making km movies (way back in 2001 or 2002) I was just doing frame-to-frame and motion tween animation. This movie clip and actionscript stuff is cool!
Anyway, here's a bare bones version of the intro I was working on if anybody's interested. I still have to go back and animate some visual environmental stuff to give it a watery look and feel. And it has a stock preloader on it for now:
http://sketch.mattjordan.com/temp/
I have a question now about how to get the overall volume of a flash movie at an acceptable level. I've noticed that most flash movies seem to have noticeably louder sound than anything else I hear on the web. Is that just me or is it a general phenomenon? And if it's the latter, how do you guys go about gauging the proper overall volume for your swf's?
Thanks,
Matt
-
Looks good so far. Let us know when you have more.
As for sound, it's a tough call. I approach it from a sound engineer's perspective, which is, the more volume I give, the more sound the listener has to work with. If they turn it down, then when something quieter comes along, they can turn it up. If I make it quiet and they have to turn it up, then when something louder comes along, it'll blast their ears and their boss will come running and they'll get in trouble for playing around on the Internet instead of working. 
But it isn't as simple as that because most people have their volume set at whatever level the default sounds (like the "you've got mail" ding) are at, and those tend to be quiet. Since just about everything else on their system has adjustable volume, they typically use that as their base setting.
Here's an example Flash intro (which still needs a little tweaking) I did with koolmoves: http://www.tastensee.org
I like the sound level, but it is probably a little loud for web use.
btw, I thought the sound level on yours was fine.
-
Senior Member
Thanks for the feedback.
And I took a stab at finishing the intro tonight. I decided that, since the credits themselves are animated, any more animation would make the intro too busy and detract from the overall feel. So I had a go at a matte painting (one of my weakest skills). I'll probably leave this one in for now so I can get on with animating scenes, but I'll likely revisit it later and see what I think.
Same link as before:
http://sketch.mattjordan.com/temp/
Thanks again,
Matt
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|