Flash (AS3) Make image fade over current frame when button is pressed

Associate
Joined
26 Aug 2010
Posts
1,268
Location
West Yorkshire
I have a map animation in Flash cs5 with various levels of zoom over the timeline. throughout the whole time that the map is visible, (there are other parts) i want a button that will fade an image over the current visible frame. (this will then link and transition properly to a movie clip which is in a different location, but that isn't a problem)

I'm just not sure on how to place this image overlay to fade out at any point in the timeline.
 
Well, lets say i have 3 layers spread over frames 1-10, 11-20 and 21-30, each with different images, and a button on another layer which is visible the whole time. When the button is pressed, i want the playback to be stopped, and a fourth image to be overlayed onto the current frame starting with 0 alpha and fading to 100 over 5-10 frames, then once it gets to 100 alpha, the playback is moved to another scene and frame.
is that better explained? :P
 
so why don't you just have the fourth image overlay as a movie clip with its own 10 frame timeline, do an onlick on the button to stop the the main timeline but start the movielip, once the movieclip hits frame 10 instruct which scene and frame to play from with the script inside that frame?
 
on the root timeline, give it its own layer with a single keyframe that spans for as far as you need it, set the first frame as stop(); with an alpha tween that starts at 0, you wont see it till you trigger the alpha tween with the button.

edit: you could perform the animation with AS rather than a physical tween if you wanted.
 
okay, i've got halfway there. My tween works with actionscript and as a movieclip (instead of graphic so that it can have an instance name) and i can call it from a button, however for it to work properly, the layer with the movieclip has to be at the top and 0 alpha, but the problem is that it also acts as a barrier, not allowing me to click any of the buttons underneath it. (all the layers are sorted out into respective folders for level1, level 2 etc... as well as regions, so moving the movie under the buttons wouldn't really be feasible)
another problem is how i make the code stop running for a second while it waits for the tween to finish before moving onto the next bit of code to change the scene.
 
Just hide the movieclip with _visible = false; and then unhide it onclick before the animation plays, take the snippet of code that changes the scene and place it on the last frame of the MC timeline, then it will only execute when the animation has completed (remember to create a new keyframe)
 
Back
Top Bottom