Too much to ask and get a "stack on error of flow.

I have AS3 create 12 random var (actuelle1, play2, etc.) and then I ask him on average the 12 vars (number) until I get a specific average number. When I run the present in AS2, I get the question "script runtime error, continue to operate? I told him to run, and AS2 finally found the right set of 12 numbers to match a specific average number. In AS3, I get a "stack on error of flow. I know that all my AS3 swf need it's just more time to find.

Any ideas for a fix?

This is one of the possible approaches you can use. The following code generates a table of average values is what you set. Also note that you can change all the settings and generate any number of values with any means. Just stick to the timeline of the rocker and look at what is happening. I commented a few important points in the code:

// required average
var avgNum:Number = 10;
// number of values to generate
var numOfValues:int = 12;
// set of generated numbers
var numbersSet:Array = [];

generateNumbers();
// generates vlaues based on the settings
function generateNumbers():void {
     var sum:Number = avgNum * numOfValues;
     var currentNumber:Number = 0;
     for (var i:int = 0; i < numOfValues; i++)
     {
          currentNumber = sum * Math.random();
          numbersSet.push(currentNumber);
          sum -= currentNumber;
     }
     // difference between required sum of all the values
     // and sum of numbers that are generated
     var dif:Number = numOfValues * avgNum - arraySum(numbersSet);
     trace(dif);
     trace(numbersSet);
     trace(arraySum(numbersSet));
     distributeDifference(numbersSet, dif);
     trace(arraySum(numbersSet));
     trace(numbersSet);
}
// adds fraction fo difference to all array memebers
function distributeDifference(a:Array, dif:Number):void {
     // fraction to distribute
     var fraction:Number = dif / a.length;
     for (var i:int = 0; i < a.length; i++)
     {
          a[i] = a[i] + fraction;
     }
}
// sums up array members
function arraySum(a:Array):Number {
     var sum:Number = 0;
     for (var i:int = 0; i < a.length; i++)
     {
          sum += a[i];
     }
     return sum;
}

Tags: Adobe Animate

Similar Questions

  • How do I trouble and get rid of the error Code: rundll32.exe on my MacBook Pro?

    How do I trouble and get rid of the error Code: rundll32.exe on my MacBook Pro?  The heading reads as follows: of "http://Mac support1. com ".  I can't remove it from Safari.  It is also IMMEDIATELY said 'call APPLE to 1-844-335-2242 '.  I asked that this number.  Any help would be greatly appreciated.

    Choose force quit from the Apple menu, close Safari and then run it with the SHIFT key is pressed. If the message reappears, disconnect the computer from the Internet and close the tab Popup came.

    (138334)

  • I try to install the McGraw Hill software and get an access denied error message. I have contacted the software company, they tell me it's a compatibility issue with Windows Vista and to contact Microsoft.

    I try to install the McGraw Hill software and get an access denied error message.  I have contacted the software company, they tell me it's a compatibility issue with Windows Vista and to contact Microsoft.

    Right-click on the setup.exe > run as admin.

    See you soon. Mick Murphy - Microsoft partner

  • Having a problem with my computer I try to restart and get BSOD saying internal error Planner video background

    Original title: Blue Screen of Death (BSOD)

    Hello im having a problem with my computer I try to reboot and I get BSOD saying internal error Planner video background

    Here is my mini dump file:

    https://onedrive.live.com/redir?RESID=60FEBF11B9A3D76! 4807 & authkey =! AGKWUp-ndI0XBgE & ithint = the file % 2cdmp

    and here is my system info:

    https://onedrive.live.com/redir?RESID=60FEBF11B9A3D76! 4810 & authkey =! AFloWJarqiE83QM & ithint = the file % 2cnfo

    im hoping that this will let you know what is wrong or not

    RW

    This phenomenon was linked to your video driver (atikmpag.sys) /DirectX.  I would completely remove the current driver and install the latest driver available.

  • Access to the Internet and get a "atl100.dll" error when you try to use Firefox

    I just reinstalled Vista Home Premium and everything was going well for two days, but I can not access the internet regardless of the browser that I use and when I open Firefox, I got an error of "atl100.dll", I am afraid that my files cd, especially the .dll files can be altered, where can I find a good (and costs nothing) copy of the file atl100.dll? Please help as soon as possible. Thank you!!

    Original title: Re-installed Vista Home Premium and cannot access the internet & get a "atl100.dll" error when trying to use Firefox and IE just is not access to the internet either

    Hello

    1 did you changes to the computer before the show?

    2. What is the full error message?

    3. who is the antivirus installed on the computer program?

    4 are you using wired or Wi - Fi to access the Internet?

    5. What is the version of Internet Explorer installed on the computer?

    The possible causes:

    • ATL100.dll file is missing, as it was accidentally deleted from your computer
    • ATL100.dll file is damaged by viruses and your computer cannot access the file.
    • ATL100.dll associated with registry files is corrupt and obsolete.

    Perform the steps:

    Method 1: Perform a SFC scan on your computer to fix the corrupt dll files.

    Reference:

    How to use the System File Checker tool to fix the system files missing or corrupted on Windows Vista or Windows 7

    http://support.Microsoft.com/kb/929833

    Method 2: Run a scan antivirus on your computer.

    www.Microsoft.com/Security/Scanner

    Note: If infections are detected during the scan, there is a risk of data loss because infected files will be deleted.

    Method 2: Reset of internet explore and check. (If you use Internet Explorer)

    How to reset Internet Explorer settings

    http://support.Microsoft.com/kb/923737

    Warning: Reset the Internet Explorer settings can reset security settings or privacy settings that you have added to the list of Trusted Sites. Reset the Internet Explorer settings can also reset parental control settings. We recommend that you note these sites before you use the reset Internet Explorer settings.

    For more information, see the links:

    The problems of Internet connection

    http://Windows.Microsoft.com/en-us/Windows-Vista/troubleshoot-Internet-connection-problems

    Windows wireless and wired network connection problems

    http://Windows.Microsoft.com/en-us/Windows/help/wired-and-wireless-network-connection-problems-in-Windows

    I hope this helps.

  • Firefox using too much processor power and memory after that I have closed it

    I always clicked on 'X', the red top right of firefox to close. Lately when I do it, my CPU/RAM usage goes up dramatically and ff never really closed, slowing down my whole computer. It's really annoying, and the only way I know to stop it is to complete the process on ff with windows Task Manager. Any suggestions as to what could be the problem?

    If we consider the problem is resolved you can mark it as you please.

    However note that Norton Internet Security, by default, is likely to run 'pulse updates' not really a topic to discuss here, except to say that this activity may well continue, depending on your settings with Norton, regardless of whether or not you have the toolbar installed Norton.

    I currently have a paid for version of Norton installed.

    My understanding is that Norton bar refers to the password management etc for safe research and general connection with the site of Norton.

    • The Norton Toolbar is not compatible with the current beta of firefox 4
    • I don't know if there are other harmful effects on firefox
    • In itself remove the toolbar will not stop Norton software affecting the use of firefox (but this is of course to ensure the safety, I do not pretend you remove, only that you take into account its CPU cost wise)
  • Dllhost.exe consumes too much physical memory and execution of 25% of CPU

    Dllhost.exe use high memory Usages.How to solve this problem?

    Hi Brendan,

    Did you recent hardware or changes to the software to the computer before the show?

    Dllhost.exe is a process belonging to Microsoft Windows Operating System. The dllhost.exe file manages DLL based applications. This program is important for the stable and safe running of your computer and should not be terminated. DLLhost using lots of CPU may indicate a malware issue.

    You can refer to Korupulu Maestracci suggestion in the following link and check if it helps.

    http://answers.Microsoft.com/en-us/Windows/Forum/Windows_7-performance/dllhostexe-COM-surrogate-constantly-running-10-12/320d1831-a9c4-4374-BBC4-70a8f145b1d2

    Note: The Microsoft Safety Scanner ends 10 days after being downloaded. To restart a scan with the latest definitions of anti-malware, download and run the Microsoft Safety Scanner again.

    Note: The data files that are infected must be cleaned only by removing the file completely, which means that there is a risk of data loss.

    I hope this helps.

    Please report if the problem persists and we will be happy to help you further.

  • I'm trying to install the Flight Simulator and get a 1607 installshield error

    I kep getting an error 1607 and don't know why it does not work

    Hello

    Welcome to the Microsoft community.

    I see you found a "1607 installshield" error when you try to install Flight Simulator.

    Quick questions:

    1. This is the complete error, you get "error - 1607: unable to install InstallShield Scripting Runtime"?
    2. What version of flight simulator you trying to install?

    You can try the steps in the following article and check if you are able to install Flight Simulator.

    Microsoft games: InstallShield Error Messages

    http://support.Microsoft.com/kb/910816

    It will be useful.

    Please let us know if you need help on this problem or any questions related to Windows.

    We will be happy to help you.

  • Computer hangs and get the DellDock.exe error is preventing reboot

    Hello world

    I use a Dell XPS M1330 laptop, 4 GB of Ram, 320 HARD drive, processor 2, 2MbL2 Cache.

    The problem is it blocks every time and some a few times it hangs on reboot. After a lil research I understood and received a message that DellDock.exe prevents restart. While, it just hangs, nothing works, his blocking type. Nobody knows what's the problem.

    Please help with some advice. My laptop has become a junk. And I'm losing confidence on Dell and Windows.

    Dinkar Reddy

    Have you tried Dell's Support?
    http://support.Dell.com/

    Delldock uninstalling and reinstalling will work?
    http://www.DellDock.com/

    t-4-2

  • windows error code live mail 0 x 2011 80070057 unsent messages in your Outbox cannot send email. How can I solve this problem and get rid of this error message.

    Remember - this is a public forum so never post private information such as numbers of mail or telephone!

    Ideas:

    • You have problems with programs
    • Error messages
    • Recent changes to your computer
    • What you have already tried to solve the problem

    Problems with Windows Live, ask Windows Live experts.

    Here: http://www.windowslivehelp.com/

    HTH

    If I brought you joy, vote! If I answered your question, click, propose as answer! > WT

  • Sampling rate - too much data points

    Hello community,

    I use a sensor signal strength of pressure on DAQmx labview through 2014. My rate from the hardware synchronization function is 50 KHz. The samples per channel of timing and read screws are the same set to 5 Khz when the channels are a continuous sampling. The problem I'm having is that when I run labview for a few seconds, say 5 seconds, I'm half million points of data. I tried to run for 10 seconds and points were more than a million where it is difficult to analyze. I think that the vi generates too much data points and the buffer is large. Am I wrong? Can you please help me solve this problem?

    Kind regards

    Mike

    You are now ready to learn a little of the power of LabVIEW and data flow programming.  LabVIEW is an inherently parallel language - two loops can run independently and in parallel, allowing you to make time-sensitive (such as sampling data) and a lot of time (such as data logging and tracing) at the same time, using queues to pass data between the loops and ensure the buffering required.

    If you open LabVIEW and click on the file menu in the toolbar, and then select new... (the points are important!), you will be able to create new ones (VI) from the model.  Choose a Framework, Design Patterns, producer/consumer Design Pattern (data).  It's what you want to do.

    You basically set up a "pure DAQ Acquisition Loop" (without logging TDMS) as producer, creation of 5000-element arrays of data every tenth of a second (if you are sampling at 50 kHz).  You create a queue of data outside the loop of producer whose elements are an array of 1 D of waveforms (the output of your Read DAQmx) and instead to send the data to a waveform graph, you put it in the queue.

    You are under this loop, a parallel loop that gets the same queue and remove items.  This loop will be sitting idle (no time taking CPU) until the data is queued.  He then it takes away the poster and registers (logs) in a PDM file.  Either way, you should open the TDMS file before entering this loop (consumer), write to the file inside the loop and close the file when the loop exits.  Study the example of the VI, you create with the model and see how it works.

    The beauty of this is that you can certainly 'keep up' with the writing of the data points in a TDMS file to 50 kHz.  You might not be able to display all the points, but there is nothing to prevent you from data processing (by, say, decimating or "block average" it) to a more 'user-friendly' display (your eyes ' sees' a 50 KHz signal?) -you have a set of 100 msec prior to the next package arrives in the queue.  Also note that the loop of producer probably takes very little time CPU - most of the time the material is waiting for its clock to 'tick', collection of points in a buffer, then transferring to the loop.

    Now you can have your cake and the computer display, too.

    Bob Schor

  • I am tryiong to get on acebook and get an http error 500-how can I fix that I see others are on facebook, is it just me or is it a facebook problem

    I'm putting it on facebook and get a http 500 error. Is this a problem acebook or is mine and how to fix it?

    http://www.Facebook.com/help/

  • Outlook Express keeps trying to compact my messages. I'm unable to post messages and get the Error 0x800ccc0d code and I can not remove outlook Express

    Outlook Express keeps trying to shoot my messages several times per day.
    I'm unable to view messages in Outlook Express and get the code of Error 0x800ccc0d
    I'm unable to remove Outlook Express from my computer, I did not need it that I use Windows live mail.
    Any ideas on how to stop this nuisance.

    Windows Search is installed?

    You must tell Windows Search to stop indexing OE.

    In the control panel. Indexing Options. Change. Clear the check box for Outlook Express.

  • I get script error java application "too much recursion" and they come in 4. This happened after the upgrade to firefox

    Hello

    I've recently upgraded to firefox 35, after this upgrade, whenever I log on tumblr, I get this "java script application error too much recursion" and they come in 4 (I have to click on each one on top of the other). I am able to connect and do my normal stuff, but whenever I move to another page inside of tumblr, the same java script error appears and I have to click again to make them disappear.
    This seems to happen only on this website (tumblr).

    any help will be appreciated.
    Thank you

    for anyone else having this problem... Fixed it got...
    Xensemble app for tumblrto tumblr users, if the application that is causing the prob ' java script application error too much recursion ".
    Xensemble has finally solved the extension of the application and all what you need to do is to download the fixed xensemble extension on their site.

    Thank you

  • Hello, I am a student and I bought already cs6 (dvd) and would like to ask - is it possible to get an upgrade for cs6 premium and how much it costs and how are they managing?

    Hello

    I am a student and I bought already cs6 (dvd) and would like to ask - is it possible to get an upgrade for cs6 premium

    and how much it costs and how are they managing?

    http://www.Adobe.com/au/products/creativesuite/UpgradeInfo.html

Maybe you are looking for

  • iOS 9.3.3 Bug?

    I recently updated my iPhone to iOS 9.3.3 6s I can't send or receive iMessages on cellular data. I can't make/receive FaceTime calls over the cellular data. My push notifications are also does not work as well for all applications 3rd party. However,

  • If please help me solve a 400 error message that I receive for a site I've visited several times and is accessible via the Safari browser.

    I am an owner fitbit and downloaded their app on my macbook pro several weeks ago. I have consulted this app to review the progress of fitbit several times a day since. Today, I can't do that. I can not even access the Fitbit site. I get an error 400

  • Satellite A300 - 1-3 - question on CPU Fan

    I have a Toshiba Satellite A300 - 1 3, recently I had problems with my laptop in which the laptop suddenly stops working, when I checked the forum, I was advised to clean the cooling system, which I did and all is now ok; recently, I noticed that CPU

  • Authorization

    Why do I get the following message appears when I open Microsoft Office Outlook?  It seems quite useless, and even if it's a small thing, I find it very irritating.  What can I do to prevent it? "You want the following program to make changes to this

  • There is no entries or exits on the DAQ assistant to connect to

    Hello world I'm new to labview and have encountered difficulties with the DAQ assistant.  I'm under v8.0, v8.7.1 OR-DAQmx labview and have an acquisition data PCI-6224 installed.  It seems that every time I have let down the DAQ assistant (assistant