ActionScript 1/2 :: Function To Fade Audio Smoothly From One Level To Another
Jan 4, 2012
I'm a newcomer to Actionscript programming and trying to modify a Flash site template downloaded from [URL] (which is an AS2 template). I've almost succeeded at what I need to do but have run into a couple of brick walls. One is that I've added a video player to the site and need to make the background music track smoothly fade out when the video starts and fade back in when it ends (or is stopped). I set up a listener object for the video player that works. It's the smooth fade of audio levels that doesn't.
The images for animation load okay. The sound loads okay. But the animation images need to be inserted in coordination with the sounds, which is difficult using only the ears There is a visual graph of audio levels in the library window, which I have seen appear in the timeline also but only momentarily. I do not know how to keep the audio graph on the timeline so as to know where to put the images. I can keep the graph open on the little library window when it is open but not on the timeline. how to keep the graph open on the audio track while I work on the image tracks.
I'm about to put my fist through the screen when trying to smoothly fade images together or lower an image opacity. The alpha is all the same throughout the tween. If I slide the alpha down on one keyframe, the entire tween's opacoty lowers instead of changing over the tween timeframe. I've resorted to using mask wipes.
Is there anyway to fade an image into another one or lower the opacity on a jpg? I'm stuck and can't figure it out. When I drop my image into the stage, it's a bitmap. There is no option to change it to a movie clip.I think when I create a tween, it allowed me to make a movie clip, I switched the graphic to a movie clip, but the alpha still didn't work.
i have put a flv video put in a flash cs3 , i want is that when i press i a button ,ofcoure which i will create, movie and sound fade out smootly , rather then movie and sound stops at once, meaning the video fade out smoothly and sound volume slowly,lowers down ,until it is totally silent,what code should i use
is there a way i can use a listener to see if an flv is playing? if its playing, fadeout any other audio(besides the flv's)if its not playing, fadein.i got the fade part...but need to figure out how to tell if the flv is playing or not.
All the links and tips around here show how to fade a sound out, but they all involve buttons or sliders. Is there a way in a frame-AS to start a 5 second fade out on a sound that has been loaded in a new _level and is activated with:
MySound = new Sound(this); MySound.attachSound("MusicClip"); MySound.start(0, 1); MySound.setVolume(60);
I can set the overall volume here, but fade it out after it's been playing for 30 seconds...
Let's say I have a slider that can go between 0 and 1.The SoundTransform.volume also ranges between 0 (silent) and 1 (full volume),but if I use a linear function,let's say SoundTransform. volume = slider.volume, the result is rather not pleasing.I really haven't studied the human ear,but I overheard once that human perception is logarithmic, or something similar. What algorithms should I use for setting the SoundTransform.volume?
how I can fade an audio clip out when I go from, i.e., frame 5 to frame 6?
The reason is that I have my swf playing up to frame 5, where it stops, and allows the audio to continue playing. But, if the user wishes to go to the next part of my swf, i.e. frame 6 to frame 10, where it stops at frame 10 to play the next audio clip, I want the audio from the first section to fade out once the swf gets to frame 6 on the timeline to allow for the next audio clip to play.
Currently, if I proceed to the next part, frames 6 to 10, and the audio from the first part has not finished playing, then both the first audio and the second audio play simultaneously.
I have an XML MP3 player on my stage with a Play and Stop button. I was wondering how i'm able to add a fade to the audio once the Stop button is pressed instead of an immediate stop.
I have a class Debug with a function called trace inside it which puts a TextField on the stage and outputs the text. Now I am trying to get the Debug.trace() function to do a "normal" debug trace as well from within side itself. of course this causes a recursive loop. I am trying to figure out how I can access the top level separately. I tried using namespaces such as AS3::trace but to no luck.
I know a solution is to rename my function to stop the conflict, but I would like that to be a last resort. It is being used in quite alot of places throughout my entire code so replacing it everywhere is going to be a ballache.
I have intro audio music playing on a project I am working on. The audio is in the timeline (but doesn't necessarily have to be), and when I click a button to move away from it, it just keeps playing. I can use SoundMixer.stopAll(); to make is stop as you click the button, but this makes a rather harsh abrupt stop to the music that is undesirable. I would like to have it fade the audio track out once the button is clicked.
Im working on a project and I dont know how to even think through the problem, as I've only worked through Flash through AS3, and the following needs to be done completely in AS too.
I have two pieces of content - some flash video, and an mp3, both loaded dynamically with loaders etc. All this I think I have fairly well in hand. What I'd like to do make the 'hick-up' as these tracks loop, disappear by cross fading the video and mp3 across it self in the loop - if that makes any sense at all. I suspect that I'll have to delve into the timeline, but perhaps strangely, never done so.
I am using the NetStream class with FMS to record the audio stream from the client's microphone to the FMS server.So far so good, the stream gets saved to the server as a .flv file. A php script grabs this file via ftp and copies it to the user's file store.What we need now is to either record the stream directly as .mp3 OR convert the recorded .flv to a .mp3 file - and this is where it gets interesting.
POSSIBLE SOLUTION 1 (preferred solution), Recording stream directly as .mp3:refer to Actionscipt Reference for Flash CS4:
The documentation suggests that it should be possible to directly record the audio stream as a .mp3 file. NOTE: this is with the new version, Flash CS4.I have tried this with both an Influxis account and with FMS 3.5 dev on my local machine. Both return this error:
function countdown(){ timer--; if(timer==0){[code]....
okay so there is my timer above, the timer counts down and everything else works exept for deleting the function at the end of the level, at the end of the level the script goes to another frame to show you have passed the level and then goes back to the previous frame to play the next level, all the new objects are made but the timer then counts double so its like the timer is running twice at a time so instead of counting down 1 everysecond it counts down 1 every half second, i have tried delete countdown();.i dont know how you actually make this work or how to go about it,
i have been trying to work out a way to have a endlevel function on my game....this function would, remove all event listeners, reset the cursor and most importantly clear all dynamically created movie clips(this is the part im having problems with).the first thing i tried was this:
so i am trying to create a "endlevel" function for my game, in this level i will need to remove all event listeners,stop all timers, remove all children off the stage and empty all arrays. i understand how to remove all event listeners and to stop all timers:
If i have a series of variables that are referenced on an enter frame function, is it better to declare the frequently used vars at the class level? Is there a performance benefit? What is the standard?
I have small issue in as3. I am load "mainmenu.swf" file into "main.swf". through loader class. so now "main.swf" is parent "mainmenu.swf" file children how can call "main.swf " variable & function from "mainmenu.swf" .
I've messed around with XML+FLASH menu systems (downloaded from various Flash resource sites) on a novice level . As in, I know how to modify the XML file to have the content I want and where to rename the XML file in the FLA if need be. But I've never had to actually manually modify any functions within the FLA before. I'm really green when it comes down to diggin' within the Flash coding. Anywho, I came upon this really nice horizontal/glide menu from a way talented flash guru who was nice enough to share his source files with me...
I have two layers in my FLA both with empty movie clips as follows:In mc_Empty1, I attach a faded background movieclip as I wait for mc_Empty2 to load a SWF. Once the SWF is loaded into mc_Empty2, I want to remove the faded background movieclip from mc_Empty1. When I load the SWF from the main timeline, the onLoad() function works and removes the faded background from mc_Empty1. However, when I load the SWF from mc_target, the SWF loads, but the onLoad() function does not. Here's my AS2 code:
//Loading SWF from main timeline mc_Empty1.attachMovie("mcFadedBg", "mc_FadedBg", 1); mc_Empty2.loadMovie("My.swf");mc_Empty2.onLoad = function():Void{ trace("loaded"); //This works removeMovieClip(mc_Empty1.mc_FadedBg); //This works}
[code]....
I know I'm targeting properly because the SWF loads as it should, but the onLoad() function does not.
This is making me a little kooky today. I thought I could defined a library path in PREFERENCES > ACTIONSCRIPT > ACTIONSCRIPT 3.0 SETTINGS then that library would be available to all AS3 FLA files, but that doesn't seem to work for me. If I use the PUBLISH SETTINGS and define the library path everything is fine.
Is there something that I could have done to disable the application level class path functionality? I guess I'm trying avoid having to set the library path for every new FLA I'm making.
I seem to be having trouble with TweenLite in AS2.I've created a class which I call on the main timeline. Within the class I've loaded images and once they are loaded I want to fade between them. I am calling (inside my class) the following code when the images have finished loading:
I have this problem when I try to fade in sound with the function below. It just doesn't work and I can't figure out where the problem is.I would like to fade in a looping sound but nothing happens.this is used to play a sound via events
I am trying to use fade in function for loader.loadMovie(this.main), but if I change the code 'loader.loadMovie(this.main)' to fade_in(loader.loadMovie(this.main)', it only can running for first frame, then stuck.