Function of audio fade smoothly from one level to another in AS2

Hi all.

I'm a newcomer in Actionscript, programming and trying to modify a site Flash downloaded from TemplateMonster.com template (which is a model of AS2).  I almost managed to do I have to do, but met a couple of brick walls.  One is that I added a video player on the site and that he must make the track of background music gently melted when the video starts and fade in when it ends (or is stopped).  I created an object listener for the video player that works.  It is the fade everything smoothly from noise levels that doesn't.

I found a great thread since last year (http://forums.adobe.com/message/3236495) in which kglad address the issue of the audio from fading from one level to the other.  As models of TemplateMonster implemented a master clip and then load pages to play there, and I need to call the function from the pages, I tried setting up as a global function.

For example, during initialization of the whole of the site, I have this:

//---------------------------------------------------------------------------------------- -------------

this.createEmptyMovieClip ("mcMusictrackHolder", this.getNextHighestDepth ());
var sndAudio:Sound = new Sound (mcMusictrackHolder);
var nMaxMusicVolume:Number = new Number (mcMusictrackHolder);

nMaxMusicVolume = 30;
sndAudio.attachSound ("MusicTrack");
sndAudio.setVolume (nMaxMusicVolume);
sndAudio.start (0,9999);

Here's the function of kglad converted to a global function
_Global.fadeSoundF = function(mc:MovieClip,s:Sound,vol:Number,sec:Number):Void
{
trace ("Getting here with sound to" + s.getVolume ());
clearInterval (mc.fadeI);
var volumeInc:Number = flight - s.getVolume (/(10*sec));
mc.fadeI = setInterval(fadeF,100,mc,s,volumeInc,vol);
trace ("leash with her to" + s.getVolume ());
}

function fadeF(mc:MovieClip,s:Sound,inc:Number,endVol:Number):Void
{
s.setVolume (s.getVolume () + Inc.);
If (Math.ABS(s.getVolume-endVol) < Inc.)
{
clearInterval (mc.fadeI);
}
}

//---------------------------------------------------------------------------------------- -------------

Then in the page that contains the video player (a child of the above), I have this:

//---------------------------------------------------------------------------------------- -------------

var listenerObject:Object = new Object();
var sCurrentState:String;

listenerObject.stateChange = function(eventObject:Object):Void
{
sCurrentState = my_FLVPlybk.state;
If (sCurrentState == "play")
{
fadeSoundF (_root.mcMusictrackHolder, _root.sndAudio, 0, 1);

}
on the other
{
fadeSoundF(_root.mcMusictrackHolder,_root.sndAudio,_root.nMaxMusicVolume,1);
};
};

my_FLVPlybk.addEventListener ("stateChange", listenerObject);

//---------------------------------------------------------------------------------------- -------------

The listener object works fine - so if instead of calling fadeSoundF I just _root.sndAudio.setvolume (0) to cut and _root.sndAudio.setvolume (30) to restore it works fine except that the volume changes abruptly instead of the rise.

But obviously there is a problem with my efforts to convert the function of kglad at the global level and to use this way, because tracing instructions tell me that the audio is preparing to random levels.  Smoothly ramps well - she tries to get crazy - 472 or + 8212 figures or others.

Any help with where I'm wrong would be appreciated.  Keep in mind that even though I have some long programming experience - there are in other languages, this environment is completely foreign to me and you can feel free to assume I'm completely ignorant.  What I managed to restore comes largely from research online, this is why there is probably a blatant obvious error in there.  Feel free to answer that assumes that I know nothing.

Best,

Pete

No, use:

this.createEmptyMovieClip ("mcMusictrackHolder", this.getNextHighestDepth ());

var sndAudio:Sound = new Sound (mcMusictrackHolder);

var nMaxMusicVolume:Number = 30;

//

sndAudio.attachSound ("MusicTrack");

sndAudio.setVolume (nMaxMusicVolume);

sndAudio.start (0,99999);

_Global.fadeSoundF = function(mc:MovieClip,s:Sound,vol:Number,sec:Number):Void

{

clearInterval (mc.fadeI);

var volumeInc:Number = (flight - s.getVolume ()) /(10*sec);

{if(volumeInc!=0)}

mc.fadeI = setInterval(fadeF,100,mc,s,volumeInc,vol);

}

}

function fadeF(mc:MovieClip,s:Sound,inc:Number,endVol:Number):Void

{

s.setVolume (s.getVolume () + Inc.);

If (Math.ABS (s.getVolume () - endVol))<>

{

s.setVolume (endVol);

clearInterval (mc.fadeI);

}

}

Tags: Adobe Animate

Similar Questions

  • Can Audio be copied from one slide to another?

    I am using Captivate 1.01.1418 and created a film by importing nearly 40 PowerPoint slides. I added audio for each slide. Today, I found a handful of slides they need minor changes. So, I fixed them, re-imported and is now looking for a way to transfer audio from the previous version of these slides for spare parts.

    Is there a way to do this?

    Hi Lmarden

    There are basically two ways to achieve this.

    1. click on the Audio > change the schedule. Then selectionner select parts of the wave form, copy and paste into different slides.
    2. click on the Audio > Advanced Audio and export the desired file. Then visit the slide where you want and select Audio > Import.

    See you soon... Rick

  • Apple Extreme, Time Capsule and Express on the same system, what is the best way to set it up so that all devices smoothly from one end of the House to another?

    Apple Extreme, Time Capsule and Express on the same system, what is the best way to set it up so that all devices smoothly from one end of the House to another?

    I'm going to assume that you plan to have wireless devices.

    Let's say that the Capsule is your "main" router  If this is the case, then it must be located in the House, so that the distance between the time Capsule is the same for the outside walls of the House.

    Then, on the 'left' side of the House, looking for an airport to midway between the Capsule and time of the outer wall of the House. Do the same thing the 'right' side of the House.

    In other words, each of the two airports that "extend" the wireless signal are located at equal distance from the Capsule of time... but they are in opposite ends of the House.

    If you intend to interconnect all the airports and Time Capsule using a permanent, Ethernet wired... which by far is the 'best' way to put in place a network in terms of performance and reliability... then you can locate one of the devices anywhere you want.

  • Is there a Windows Media Player plugin which allows you to convert audio files from one type to another?

    Is there a Windows Media Player plugin which allows you to convert audio files from one type to another?
    For example: conversion of a

    1. file to a .mp3 file .m4a? Or a
    2. . M4P file to a .mp3 file, or a
    3. mp3 to a .mxmf file

    or visa / versa for any of them?

    Hello

    Thank you fo contact Microsoft Answers.

    Windows Media Player is not any plugin. Maybe you can try to Expression Encoder.

    Here:

    http://www.Microsoft.com/expression/products/Encoder4_Overview.aspx

    Or here:

    http://www.Microsoft.com/expression/products/EncoderPro_Overview.aspx

    Many third-party converters are also available, you can try.

  • problem of collage of video clips from one film to another file

    I use the Director of microsoft with Windows 8.1.  I have many movies at home that I edited various movie maker project files.  I would like to take some of my favorite clips of different projects and paste them into a new project.

    This has not worked for me.  That's how I tried to do.  I open the project file with clip I want to copy and paste.  I clip on the clip and select copy.  I then open the movie maker project where I want to paste this, and I click on the Clipboard to paste highlighted at the top left of the screen.  When I do that, I just get some sort of error noise ding, and then function to paste the Clipboard is grayed out.

    Anyway, how can I copy the project one film to another machine?

    Thanks much for any help.

    Sorry to post what I finally understood how to do this!  In case anyone else has had problems, here's what I discovered.

    To paste me a clip from one file to another, the destination file should have at least a clip already on it.  So what I did was import a video in the file as if to edit it, and then I managed to stick a clip of another movie project in this file, place the new file alongside the existing clip.  I guess you must have at least a clip holding a place for the paste function to work.

  • How to move the FILE from one place to another and keep "Indexing" have to move to the unknown location so you can't discover its full file path? Windows instructions provide information wrong re: how to do this!

    Make a bunch of audio files, placed in a folder on my desktop. Files initially sent to RealPlayer to burn, but when finished burning CD and went to read a CD, folder got seized by Media Player, 'Indexed' and disappeared from the office. I'm a relatively new computer user, and I need to learn more about file paths, how to view the path FULL of a file on my computer and how to type (create) full path when I need to. The "Indexing" feature seems to erase this lesson for me, and after having spent four hours trying to find Vista instructions on "How to move the file from one place to another", I gave up! Windows 'Help and Support' on my computer gives wrong directions. It states that if I right click on a folder > properties, a dialog box opens with a tab by which I can move my account. There is no tab location here. I found locations tab when right click on the "Mobile" folder, but still no option to "move file". No idea what is the folder "Roaming" or why it's on my computer. I want my audio files in the My Music folder, but this place is "access denied." Don't know how to get the audio file it in any case, but if anyone has any advice, I would be very happy! Thank you. PS - I had no problem moving folders in XP. I don't like the idea that a computer is to decide where to put my files. I want to control where I put my files. I don't like the way search works under Vista. I liked the XP search companion better because, for a computer fool like me, it was really easy to organize and find files and folders and had an option specific to find audio and video file TYPES.

    Here is an article on how to move your personal folders in Vista: http://www.howtogeek.com/howto/windows-vista/moving-your-personal-data-folders-in-windows-vista-the-easy-way/.  If you're talking about the special folders (such as photos, Documents, office...), then here is an article on how to move: http://www.winhelponline.com/articles/95/1/How-to-move-the-special-folders-in-Windows-Vista.html.

    If you have trouble with the search after you move the files, then rebuild the index: http://www.tech-recipes.com/rx/2103/vista_rebuilding_the_search_index/.  Here is an article on how to use Indexing Options in Vista that may be useful for you: http://www.vistax64.com/tutorials/69581-indexing-options.html.

    If the above does not help, your problem seems to relate to the image of the files/folders and their interactions with Media Center (which operate on different other folders).  Please repost your question in images and video Forum at: http://social.answers.microsoft.com/Forums/en-US/vistapictures/threads where the people who specialize in issues of the image will be more than happy to help you with your quesitons.

    Good luck!

    Lorien - MCSA/MCSE/network + / has + - if this post solves your problem, please click the 'Mark as answer' or 'Useful' button at the top of this message. Marking a post as answer, or relatively useful, you help others find the answer more quickly.

  • BSOD after copying the large number of files from one disk to another

    Hello. I hope you can help because this issue is very frustrating. Just built a new PC:
    -Gigabyte Z97X Gaming 7 mobo
    -8 GB Corsair vengeance 1866 mhz
    -EVGA GTX 770 video
    -CPU Intel 4770K
    -two hard drives of 1 TB WD black in RAID 1
    -one ADATA 256 Gb SSD as drive OS
    -a 1 TB drive Toshiba
    -Windows 7 64-bit professional
    -F3 Bios Rev

    System can work very well for everyday, but when I copy large number of files from one disk to another (i.e. 70 000 files, 80 GB), shortly after (10 to 30 minutes), I get a BSOD bugcheck.

    I ran MEMTEST86 for hours without error. I can run PRIME95 with max heat without error. And as I said, it seems to be fine until I do a copy of large files. It seems not to matter to this disc, I copy to/from. Start WIndows, I see no activity CHKDISK. Ideas?

    Log name: System
    Source: Microsoft-Windows-WER-SystemErrorReporting
    Date: 25/06/2014 19:55:50
    Event ID: 1001
    Task category: no
    Level: error
    Keywords: Classic
    User: n/a
    Computer: Daddys-PC
    Description:
    The computer was restarted after a bugcheck.  The bugcheck was: 00000124 0 x (0 x 0000000000000000, 0xfffffa8008788028, 0x00000000bf800000, 0 x 0000000000200401). A dump was saved in the: C:\Windows\MEMORY. DMP. Report ID: 062514-6692-01.
    The event XML:

     
       
        1001
        0
        2
        0
        0
        0 x 80000000000000
       
        32358
       
       
        System
        Daddys-PC
       
     

     
        0 x 00000124 (0 x 0000000000000000, 0xfffffa8008788028, 0x00000000bf800000, 0 x 0000000000200401)
        C:\Windows\MEMORY. DMP
        062514-6692-01
     

    No problem, thank you!

    All attached files of the DMP are the verification of bug WHEA_UNCORRECTABLE_ERROR (124) .

    A fatal hardware error occurred. This fatal error data error Architecture WHEA (Windows Hardware).

    If we run one! errrec on the 2nd parameter of the bug check (address of the WER structure), we get the following:

    ===============================================================================
    Section 2: x 86 / x 64 MCA
    -------------------------------------------------------------------------------
    Descriptor of @ fffffa8008788138
    Article @ fffffa80087882c0
    Shift: 664
    Length: 264
    Flags: 0x00000000
    Gravity: Fatal

    Error: Internal unclassified (Proc 4 row 1)
    Status: 0xbf80000000200401
    Address: 0x00000000fee00040
    Misc.       : 0 x 0000000000000086

    Internal unclassified error, this implies that it is not publicly documented and there is no way to identify the error.

    -----------------------------------------

    1. AppleCharger.sys is listed and charged, which is the driver GIGABYTE on / off Charge. See here for more information - http://www.gigabyte.us/MicroSite/185/on-off-charge.htm

    Very annoying software, so please uninstall ASAP!

    2 remove and replace Norton with Microsoft Security Essentials for purposes of troubleshooting temporary, as it can be at the origin of the conflict:

    Removal of Norton- https://support.Norton.com/SP/en/us/home/current/solutions/kb20080710133834EN_EndUserProfile_en_us;JSESSIONID=841A6D40BA6872C47697C6C6B19C8E11.4?entsrc=redirect_pubweb&PVID=f-home

    -MSE http://Windows.Microsoft.com/en-us/Windows/Security-Essentials-download 

    3 uninstall Gigabyte Saver Easy, Easy Tune, as well as all the another bloatware Gigabyte, it is very problematic.

    4.

    2: kd > lmvm marvinbus64
    start end module name
    fffff880' 04c 51000 fffff880'04 c 95000 MarvinBus64 (postponed)
    Image path: \SystemRoot\system32\DRIVERS\MarvinBus64.sys
    Image name: MarvinBus64.sys
    Timestamp: Fri Sep 23 17:17:03 2005

    Pinnacle Studio Marvin Bus driver, dated 2005. Too old to work with the operating system, so please delete the software + the device (if any).

    5 please remove your Rainbow Tech/SafeNet USB security device if there is no update for its software, device drivers are too old.

    -----------------------------------------

    If all else fails, there's only so much you can do with an error like this, checking until it boils down to a faulty processor that needs to be replaced. Start from 1 and work down:

    1. make sure your temperatures are the norm and nothing is overheating. You can use a program such as Speccy if you want to monitor the time - http://www.piriform.com/speccy

    2 clear your CMOS (or optimized load BIOS default) to ensure that there is no parameter incorrect BIOS - http://pcsupport.about.com/od/fixtheproblem/tp/clearcmos.htm

    3. make sure that your BIOS is up to date.

    4 if all else fails, the only one left to do is replace your CPU because it is defective.

    Kind regards

    Patrick

  • Moving installation of cluster COE from one box to another box

    We want to move the WCC existing (cluster) from one box to another box (the two unix). We have the cluster / folder {who have records cs /, vault /, weblayout /} on the drive shared, mounted in the source running on 11.1.1.6.0 machine.

    We installed the same facility in the destination area. We want to follow the steps below to move the config., destination data source.

    (1) stop the source servers.

    (2) modify the details of the db in destination of weblogic in the source db console.

    (3) remove the shared / source folder and mount in the destination area. (The vault, weblayout, cs files will be mapped directly to destination ucm)

    The other qns we are

    (1) the above steps are correct and COE will work without any problem.

    (2) do, the houses of the area must be synchronized (because the destination area is a fresh installation)


    Just to test, I copied the cluster/cs / source folder to the destination and destination of the content servers are working properly. (I did not copy arch / weblayout and changing the db)

    I saw an article on cloning of WCC servers

    It is Possible to Clone content Webcenter 11g? (Doc ID 1507480.1()

    He said the documentation http://docs.oracle.com/cd/E23943_01/core.1111/e10105/testprod.htm#ASADM11306

    Target already exists, it is just asking migrate config. using CMU. Should I worry field homes or cluster/cs is sufficient for the WCC smooth if they are synchronized?

    Thank you

    Narasa Kumar

    Narasa salvation,

    Yes, the steps you listed should be fine, as long as the details of the path are kept on the new host.

    Thank you
    Srinath

  • We can move customization from one instance to another

    Hello

    As we pass DFFs Menus, functions, from one instance to another.

    Can move personalization in all forms from one instance to another.

    Thank you.

    Yes - pl see MOS Doc 395117.1, the section titled "customizations moving between Instances.

  • I wish I could drag and drop items from one page to another of the window of the plan. Is this possible?

    In desiging my site, I want to be able to move items from one page to another by drag-and - drop from the flat screen of architecture. It would also help if the window could have a zoom in and out function to facilitate this.

    I just tried to zoom in the map window and discovered that it works.

  • Is it possible to move a Folio from one account to another?

    Is it possible to move a Folio from one account to another?

    Thank you

    Currently, it is not possible to move a Folio between accounts.

    One possibility would be to share the folio with the second account. The second account would then create a new folio and copy items to this new folio in addition to the preview images, and the metadata for any level of folio.

  • Fading from one image to another

    When you go a lot of web sites, a few times, there are photo fades from one image to another through various quantities of images, I think that it is smart enough, it can someone tell me how to do and what software I need, please

    In the Adobe Widget browser, there are the content slideshow Spry and Spry content slideshow.

    7 project - http://www.projectseven.com/products/galleries/index.htm

    Google search for JQuery carousel and you will get the results much more depending on what you want.

  • Buttons to copy from one file to another

    Seriously, I don't come to you guys for help until I've completely exhausted my sources online!

    I want to copy my buttons and their functions of one file to another with out having to recreate them each time.

    Is there a way to do this?

    Forrest

    You could put the buttons and their code in the same framework (or pair of over/under frames) and copy/paste the image from one file to another.

  • Copy some files from one user to another

    Hello!

    How can I copy (not share) some files from one user to another?

    The reason for this is because we rename users to other allocation model.

    Thank you!

    You must share the folders you want to transfer the ownership of the new username, or one responsibility that the new user has (I guess that's an Oracle Applications EUL). The user connects to Discoverer more with their new name. They open the workbook (s) and then do a SAVE AS. Who will save the workbook with them as the new owner. You must then sign with the old name of the owner and to delete these old files (after the first backup them) once you are sure that everything works fine. Yes, it is a nasty process. What we do is we use a "dummy" username when we create/modify the workbooks. In this way the fictional user name is the owner of the workbooks. So, it does not matter if a person leaves or if you change the user naming conventions. If you have many users to create cabinets, then a dummy user name doesn't quite work. You could always submit an enhancement request to Oracle for a copy function. I hope that you will get a lot of customers to support such a request.
    John Dickey

  • How to transfer a project from one computer to another file

    Hello

    In order to burning a DVD on my laptop that is older, I'm trying to transfer a working from a library folder and insert it into another on the old computer. I used a USB key. All the data has been transferred, but how do i:

    1) enter a library on the old computer? I DID this, but it will not appear in the Final Cut. I "Showed the content" and it allowed me to put the file in THIS library, but it will not appear in the column "libraries."

    (2) create its OWN library on the old computer?

    Thank you.

    Mike Scully

    Stay out of the whole library. This is a complex database. If the components have moved the database becomes useless. Pretty much all you need to do inside the library can be done from the inside of the PCF.

    If you cannot move the entire library from one machine to another on an external drive, you can move a project of a new library. That will copy only the clips used in the project. You can take it on the other machine. You can also export a master file and consider on the other machine to make the DVD. It is perhaps the simplest.

Maybe you are looking for

  • Can I drag on the desktop, a hyperlink to a specific e-mail TB?

    I want to create a hyperlink in TB so I can place them in a file, database or document. When I click on it, I want this hyperlink to open a specific e-mail message in TB. I want to do a lot of these hyperlinks, each attached to a different e-mail mes

  • Two files of programs after Vista update...

    Hello.I received the gradual upgrade of toshiba + Vista DVD today and everything was how it is described. As it is written in the guide, all the previous xp programms etc some time deleted. I like this because I want to tpo have a clean install. So I

  • W530 AC Power Brick Buzz

    Hello I have a Thinkpad W530 I received in December and have just noticed that the AC adapter is a constant, light, humming noise. It is pretty quiet, but in a quiet room, I can still here it about 2 feet away. Is this normal? This has certainly neve

  • I have problems with my pointer moves erractically. Is this a bug or a security issue? Help, please!

    My pointer will move while I'm clicking and make me click on something I didn't she like closing my window in the middle of something that is very aggravating. This problem occurs repeatedly no matter what type of program I use. I don't know why he s

  • Google on the 7 venue

    I just got 7 place and google wants me to set up account with them. I hate google it follows you to much. is it possible to remove the google Tablet? What other browser could be used for this topic Thank you