random animation + random sounds and background music

Hi guys!

I am new to AS3, but I have to do this project for the class, and I really don't understand how to do it.

I searched the forums and the internet, but did not find a lot of information. I found most of this code on the Internet however, and while I understand very well, I master AS3 enough to program myself.
Could you guys please help me a bit with this?

That's what I'm trying to achieve:

  • Background music loop in the back, which begins with the opening of the swf file and never stops. I think I've realized that, with this piece of code:

import flash.media.Sound;

import flash.net.URLRequest;

import flash.media.SoundChannel;

BG music

var music: Sound = new Sound (new URLRequest ("music1.mp3"));  same folder

var sc:SoundChannel;

SC = music.play ();

One thing though: it would be cool to put in a loop, and I don't know how to do this.

  • I also need various small audio clips to play randomly above the aforementioned background music. I use this, which works a little, but I would like to have more control on the randomness. Ideally the clips should not play twice in a row. I don't know how to do this.

import flash.media.Sound;

import flash.net.URLRequest;

import flash.media.SoundChannel;

import flash.events.Event;

songs of the var: Array = new Array ("sound1.mp3", "sound2.mp3");

Sound: sound var;

var soundChannel:SoundChannel;

var randnum:uint;

function playsong()

{

RandNum = Math.Floor (Math.Random () * Songs.Length);

Sound = new Sound();

Sound.load() (new URLRequest("sounds/"+songs[randnum]));

soundChannel = sound.play();

soundChannel.addEventListener (Event.SOUND_COMPLETE, playrandomsong);

}

function playrandomsong(e:Event)

{

playsong();

}

playsong();

  • Finally, I need to move from frame to frame at random to play different animations. For example:

Project starts, background music starts playing, we hear random sounds played one after the other, while some animations are visible on the screen, playing in random order.
I don't know how to do this.

Thank you very much for your help! I'll try to find out on my own, but any help will be appreciated.

use a Boolean value to prevent the execution of code:

var alreadyExecuted:Boolean;

{if(!alreadyExecuted)}

alreadyExecuted = true;

.

. code you want to run only once, regardless of how many times this frame is entered

.

}

Tags: Adobe Animate

Similar Questions

  • Voice and background music.

    Is it possible to have the two narrative voices and background music in the same blade?  I would like music to start and then gradually fade when the begns voice speak.  I use Captivate 4 but will soon Captivate 6.

    Thank you.

    Hello

    If you import the audio file of the slide, go to the properties of the slide and click on the tab "audio".

    Looking for fade in and fade out options for audio.

    Kind regards

    Mukul

  • my computer makes sounds and plays music in itself

    my computer plays music and other sounds when the machine is idle for some time.

    As double a + for the answer to your message, disable any suspect plugins or addons in any browser you use.

    See you soon,.
    Jerry
  • What happened to the window start Firefox with images and background chill music?

    Since the upgrade to a new computer running Windows 8 (64-bit) my start page of Mozilla has not all the themes of big picture and background chill options of music that I really enjoyed. How can I get that back?

    Hello, the themes of the photo and background music were never part of the homepage by default in firefox - maybe you had a personalized homepage or an addon on your old computer to achieve - if you find that you have used before it will be certainly possible to set up the same way on your new pc...

  • Background music does not make in the final export

    I spent hours trying to figure this problem without success.

    I am doing a project in creation that has the music videos 2, another track for sound effects and another track for background music.

    The background music plays and is audible during the preview and in the project, but it NEVER makes it to export final (H.264) no matter what I do.

    I try to switch the sound effects and background music, background music is therefore on track 3 with sound effects on track 4 and sound effects through the fine but is not background music.

    I tried with both versions of the background music the .wav and .mp3 and niether work, can somone please explain it to me and possibly propose a solution?

    I had a quick glance at this project. The problem is the variation of the extreme speed of the music, your clips is 1/20 of the original speed. I did the work by reducing the speed of the music of 50%, the music video for nesting and by reducing the speed of the nest to 10%. Hope this works for you.

  • No speech DVD when played only background sound and music can be heard with slight deaf speech

    during playback of a dvd on my laptop I can hear the sounds of music and accessories background but only weak dialogue of the deaf. I went into sounds and I tried to change some settings but without success. Can anyone help please.

    Hi skinbyfinn,
     
    1. this happens with other DVDs?
    2. what player you use to play the DVD?
     
    We recommend that you cross check if the same problem persists in playing other video DVDs. Check also play the DVD using a different DVD player.

    Please, try the steps following and post back with the results, so that we can help you better.
     
    Kind regards
    Syed
    Answers from Microsoft supports the engineer.
  • Randomized sound paintings in the channels of sound and transformed of Fourier

    Advice on the combination of SoundArrays in soundChannels with turn?

    a movieclip is triggured by a timer every 250ms and I coded sounds.

    I'm putting this script below

    //Lasers Array
    var laserArray:Array = new Array[Zap1, Zap2, Zap3];
    var oneLaser = laserArray[Math.floor(Math.random() * laserArray.length)];
    trace ("oneLaser");
    

    in

    //Plays a laser sound
    var laser:Sound = new Zap1();
    var laserChan:SoundChannel = new SoundChannel;
    laserChan = laser.play();
    //pans a laser Sound
    var laserTrans:SoundTransform = new SoundTransform;
    {
         laserTrans.volume = 1;
         laserTrans.pan = (tempLaser.x / (stage.stageWidth / 2) -1);
    }
    laserChan.soundTransform = laserTrans;
    

    Thanks in advance

    I wrote by hand, so it's probably just the difference in the documentation. They type the class cast and use an 'object' as it is instantiated. In other words:

    to randomly select a laser

    var soundClass: Class = getDefinitionByName (laserArray [Math.floor (Math.random () * laserArray.length)]) as a class;

    create solid laser

    Laser var:Object = new soundClass();

    Set to the string

    var laserChan = new SoundChannel();

    laserChan = laser.play ();

    .. .transform code

    The parts in bold correspond to the difference and must clean the error.

    What made getDefinitionByName(), it is simply look in your library any element that has the name ask you as a name class (link). For example I imported an old MP3, right click on it in the library, click the ActionScript tab and checked to set the link and named "GoodDay: class

    What that will do the Flash is to make a class called GoodDay and inside there will be sound. For me to have access to it, I can use getDefinitionByName to access the class library. In this class, I can create the sound.

    for example:

    get the class that generates library

    var theClass: Class = getDefinitionByName ('GoodDay') in class;

    now to use this class to get the sound

    var theSound:Object = new theClass();

    now I have the "theSound" sound and can play

    var myChannel:SoundChannel = new SoundChannel();

    myChannel = theSound.play ();

    Make sure your laser sounds all have a unique class-binding name (laser1, laser2, laser3, etc) and then you can use getDefinitionByName to access.

    Again, this reduces just memory by preloading does not all the sounds in a table ahead. It is good to know how to access the library items in this way in any case.

  • iPhone 5 c randomly open and use apps

    Ive had my Iphone 5 c for a few years and never had any problems. But recently I've had a few problems with applications seemingly randomly are opened and used. Used by sense that things will be clicked or pressed. For example, once I looked at my phone to see that he changed their apps and missing out on my clock application, go to the timer and had set a random time and tune. Currently I wouldn't be a game and have him by my side just to come turn on my screen and see several things in the game be enabled (for example, power-ups etc.) what is strange, is that I saw never actually happen. Instead things listed above will be only seem to happen when my phone is in my pocket or on my side. Also I don't understand how he could unlock my phone, even though I have a password.

    Before that, I dropped my phone on an outdoor stone floor causing in the middle of the screen to feel strange and cheerful (hard to describe). I did not notice that other problems and even this problem with the screen do not seem to affect my phone somehow major.

    Is there a possibility that my phone might have been hacked?

    Or could it be something to do with my screen is broken?

    I just want to know the problem so you can fix and ease my mind.

    Currently on IOS 9.1

    Any help or advice would be appreciated.

    Hello!

    It sounds like you are dealing with a ghost screen.

    Given that the phone had some physical damage, this problem may be related to the phone screen and a repair of the screen may solve the problem.

    You will first need to isolate the problem to see if it is software or hardware related.

    I would say to backup the iPhone via iTunes or iCloud and restore as a new to test and see if the problem persists. If so, its more than likely the screen of the iPhone. Hope this helps

  • My computer redirects me to random pages and turn my CPU at 100%... I think that his "ping.exe".can someone help?

    Original title: ping.exe

    I have something on my computer that redirects me to random pages and runs my CPU at 100%... I think that his "ping.exe".can someone help?

    MalwareBytes's AntiMalware - no AntiVirus. ;-)

    Probably your best bet - flatten (wipe) the system and start from scratch.  You will need your most recent backup (your stuff, like your documents, photos, music, video, spreadsheets, databases, presentations, bookmarks/Internet favorites, e-mail contacts, serial number, proof of purchase/receipts, that may have been scanned in, etc. and so on...) and a good list of installed software and hardware specifications (I suggest Belarc Advisor running on the current system and print the results if possible) then you can get the drivers before or after installation.

    Of course, you will also need your multimedia installation product key/serial numbers and that go hand in hand.  In Windows XP - there is no way for me to know (without telling you) what level your installation CD is... so you will need to install the SP2 and SP3 after installing the operating system.  I would leave it disconnected from the Internet (physically) until it is at least SP3 and you have confirmed its firewall is enabled and, if possible, you have installed an antivirus application.

    For you, I suggest the eSet 32 antivirus (not more) - which costs ~ $60 every two years for private users.  Add to that the MalwareBytes full package which costs, if I remember, ~ $25 for life.

    Then, once the system * is * connected to the Internet (physically) - get hardware drivers installed for everything and the rest 100 + installed post-SP3 updates.  Then you can worry about all your other programs and restore your files LAST.

  • Random sound 'connect' followed by "disconnect" sound

    Random sound 'connect' followed by "disconnect" sound

    In the last days, I started hearing the "connect" and "disconnect" sounds very randomly and quite frequently when using my computer.   I started the Manager tasks to see if I could determine what was causing the sounds occur.  To the best of my knowledge, the EEM of sounds to occur every time 'mobsync, exe' (microsoft Sync Center) starts.  I never remember activate "mobsync" (but it is possible that one of my kids got on and did something) and I saw an internet post saying that she could not be disabled.

    How can I stop this?  It's quite annoying to listen all day since I work from my computer!

    Hi dexxamax

     

    First, I suggest you to check if you have any sync partnerships with files or devices. You can check if put an end to these partnerships help you solve the problem. Refer to the following links for assistance.

    http://Windows.Microsoft.com/en-us/Windows-Vista/Sync-Center-frequently-asked-questions

    http://Windows.Microsoft.com/en-us/Windows-Vista/Troubleshoot-sync-problems

    http://Windows.Microsoft.com/en-us/Windows-Vista/understanding-sync-errors-and-warnings

     

    I hope this helps.

  • Speech and voice barely audible, loud background music.

    I can't watch any type of movie or clip, like any speech is not audible on the background music or other sounds. It is on my pc. Also, when you test a surround sound, all the tests sounds came from my left speaker.

    Hi Jens,

    1. do you get any error message when the sound fails?

    2. What is the format of these audio files?

    3. were there any changes (hardware or software) to the computer before the show?

    Sound problems can be caused by cables that are not connected properly, damaged drivers, incompatible drivers, sound settings, missing updates and problems with your sound card.

    Method 1: Download and install the Fixit from the link below and see if the Audio works.

    Diagnose and automatically fix the audio problems and audio playback

    Method 2: Proceed as from the link below and check if Audio works.

    http://Windows.Microsoft.com/en-us/Windows/no-sound-help?T1=tab02#no-sound=Windows-7&V1H=win8tab1&V2H=win7tab1&V3H=winvistatab1&v4h=winxptab1

    Answer please if you have any questions.

  • No sound during playback of a file only background music is running

    While reading a file in Windows Media player it is only running background music, the song is not audible.

    Hi Gauravsaggy,

    I understand that you have a problem with playback of the audio files. I'll be happy to help you with this problem.
     
    (1) for the limit with the particular audio file?
    (2) have you made changes on the computer before this problem?
     
    Method 1: I suggest you run the Microsoft FIXIT from the link and if it helps.
    Diagnose and automatically fix the audio problems and audio playback
    http://support.Microsoft.com/mats/AudioPlayback/
     
    Method 2: You can also try to use the Audio playback problems troubleshooting to solve the problem. It search common problems with your volume settings, your sound card or driver and your speakers.
    Open the troubleshooting of Audio playback
    http://Windows.Microsoft.com/en-us/Windows7/open-the-playing-audio-Troubleshooter
     
    For reference:
    Tips for solving common audio problems
     
    I hope it helps. If you have problems in the future, please let us know. We will be happy to help you.
  • How can I play a random sound files by clicking a button "play"?

    I am new to JS languaje and I want to do a short quiz animation (animate edge). Must play an audio (from the audio load in the scene) when I click on the "play" button I should be using the Random function and build a table for audio files, but I don't know how to build the table and how to use the Random function.

    I hope you help me to solve this problem.

    I think you just need to put this line above the function call

    this:

    SYM.init_sound = function() {}

    var random_audio = audio [Math.floor (Math.random () * audio .length)];

    SYM. $(random_audio) [0]. Play();

    };

    to do this:

    var random_audio = audio [Math.floor (Math.random () * audio .length)];

    SYM.init_sound = function() {}

    SYM. $(random_audio) [0]. Play();

    };

  • How to loop a section of sounds and animation not at the beginning of the animation?

    Hello, I'm a total noob to Flash in the hope of doing something quickly reliatively. I'm using version Flash Professional CS6 track for this purpose. However, I am a little unsure of how to work this loop button. What I'm trying to do is create a small interactive game. I would like to have the opening be an animation of title which plays only once and then comes to a music section and 2 buttons ('play' and 'how to play') that will make a loop until the player decides which to click. When I used the loop tool, it created a section for me to drag around. I dragged to include sound and animation of the section I want to loop. However, when I tried to play the animation at the beginning, she skipped the opening and went straight to the loop part. In addition, there not completely loop. I'm quite inexperienced and still learning, how can I get the Flash to play at first and then search the section loop and have it loop continuously until someone pushes the button? None of the tutorials that I've seen so far has on this topic and if it involves entering code then I am at a loss. Thanks for any help.

    What you seem to be describing could be done using a movieclip for animation in a loop.  Create a movieclip symbol and build this animation loop with the sound on the inside.  Plavece while, in a framework at the end of the animation of a master schedule.  If you place a stop() command in this framework as well then stop the main timeline and animation in a loop (movieclip) is expected to play on its own at all times.

  • Sounds in my application do to stop the background music. iOS

    Hello

    I have an app for iPad. I use short sounds in it to the buttons in my user interface.

    Unfortunately when I start my application of background music in the music player stops immediately.

    Do you have any idea how to solve this problem? I don't want to stop the audio player of the user, but at the same time, I want my sounds.

    Thank you in advance.

    With AIR 2.7 on iOS, there is no way to stop the background music being silenced.

    However the sound stops only when you play in fact all of the music in the air and not at the time of launch application.

Maybe you are looking for