Slow preloading on server

Hi guys,.

I made an app that uses a lot of sounds and images files and I implemented a feature to preload these files before you run the program to ensure the proper functioning on my program. There are about 10 MB of images and sound clips

When the application running on the spot of course all preloads very quickly (about 10 seconds), but when I downloaded on a server it takes about a minute or two to preload 10 MB of files. Of course, this is not normal?

Here is my code:

function preLoaderSound (): void

{

snd1 = new Sound (new URLRequest(this["array"+k][0][m]));

snd1.addEventListener (Event.COMPLETE, preLoadComplete);

}

function preLoaderImages (): void

{

Image1. URL = this ["array" + k] [l] [m];

imageLoader1.load (image1);

imageLoader1.contentLoaderInfo.addEventListener (Event.COMPLETE, preLoadComplete);

}

preLoadComplete increments k, l and m and keeps a track of how many files have been loaded

Can anyone help?

See you soon

Chris

In view of your data structure and do not enter the topic of it needs improvements, below is a loading block based on your tables.

Please note that this code assumes that the only goal is to preload all assets at the beginning and then use the cache. If you want to more efficient application - you want to store loaded active elsewhere and access it if necessary. But this is a different topic.

I tried to comment code as much as possible.


import flash.display.Loader;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.EventDispatcher;
import flash.events.IOErrorEvent;
import flash.media.Sound;
import flash.net.URLRequest;

var array1:Array;
var array2:Array;
/**
 * Number of arrays with convention array in the scope
 */
var numArrays:int = 2;
/**
 * Total umber of assets to load
 */
var numAssets:int = 0;

init();

function init():void
{
          array1 = new Array();
          array2 = new Array();
          array1[0] = ["", "GuitarMicArray/Center.mp3", "GuitarMicArray/15.mp3", "GuitarMicArray/45.mp3", "GuitarMicArray/60.mp3", "GuitarMicArray/90.mp3"];
          array1[1] = ["", "MicPics/SM57.jpg", "MicPics/SM57.jpg", "MicPics/SM57.jpg", "MicPics/SM57.jpg", "MicPics/SM57.jpg"];
          array1[2] = ["", "MicPosPics/Center.jpg", "MicPosPics/15.jpg", "MicPosPics/45.jpg", "MicPosPics/60.jpg", "MicPosPics/90.jpg"];
          array1[3] = ["", "GuitarPic/LesPaul.jpg", "GuitarPic/LesPaul.jpg", "GuitarPic/LesPaul.jpg", "GuitarPic/LesPaul.jpg", "GuitarPic/LesPaul.jpg"];
          array1[4] = ["", "AmpPics/Marshall.jpg", "AmpPics/Marshall.jpg", "AmpPics/Marshall.jpg", "AmpPics/Marshall.jpg", "AmpPics/Marshall.jpg"];
          array2[0] = ["", "GuitarMicArray/Center.mp3", "GuitarMicArray/15.mp3", "GuitarMicArray/45.mp3", "GuitarMicArray/60.mp3", "GuitarMicArray/90.mp3"];
          array2[1] = ["", "MicPics/SM57.jpg", "MicPics/SM57.jpg", "MicPics/SM57.jpg", "MicPics/SM57.jpg", "MicPics/SM57.jpg"];
          array2[2] = ["", "MicPosPics/Center.jpg", "MicPosPics/15.jpg", "MicPosPics/45.jpg", "MicPosPics/60.jpg", "MicPosPics/90.jpg"];
          array2[3] = ["", "GuitarPic/LesPaul.jpg", "GuitarPic/LesPaul.jpg", "GuitarPic/LesPaul.jpg", "GuitarPic/LesPaul.jpg", "GuitarPic/LesPaul.jpg"];
          array2[4] = ["", "AmpPics/Marshall.jpg", "AmpPics/Marshall.jpg", "AmpPics/Marshall.jpg", "AmpPics/Marshall.jpg", "AmpPics/Marshall.jpg"];

          preloadAssets();
}

function preloadAssets():void
{
          /**
           * 1. Since mime types are mixed up in the same data provider - we should separate mime types into different more logical entites
           * 3. Since array contain redundant assets - we shoul avoid loading assets more than once
           * 2. We should define how many assets to be loaded
           */
          var sounds:Array = [];
          var images:Array = [];
          for (var i:int = 1; i <= numArrays; i++)
          {
                    // gain reference to array
                    var array:Array = this["array" + 1];
                    // loop through second dimensions
                    for each (var subArray:Array in array)
                    {
                              // loop through elements in the seond dimension
                              for each (var url:String in subArray)
                              {
                                        /**
                                         * We need additional validation
                                         * 1. Make shure that current element is not an empty string
                                         * 2. Identify mime type base on file extension
                                         */
                                        // only if it is not an empty string - proceed
                                        if (url != "")
                                        {
                                                  // increment number of assets that must be loaded
                                                  numAssets++;
                                                  // populate either sounds or image array
                                                  // url.match(/(\w+)$/gi) extracts file extension
                                                  switch (url.match(/(\w+)$/gi)[0])
                                                  {
                                                            case "jpg":
                                                                      // push image url into array of images urls
                                                                      // if url is not present - push it
                                                                      if (images.indexOf(url) == -1)
                                                                      {
                                                                                images.push(url);
                                                                      }
                                                                      break;
                                                            case "mp3":
                                                                      // puch sound url into the array of aounds urls
                                                                      // add only if url does not exist int ht e array
                                                                      if (sounds.indexOf(url) == -1)
                                                                      {
                                                                                sounds.push(url);
                                                                      }
                                                                      break;
                                                  }
                                        }

                              }
                    }
          }
          // at this point we are ready to load all assets
          // invoke images loading
          for each (url in images)
          {
                    trace("image", url);
                    var loader:Loader = new Loader();
                    addListeners(loader.contentLoaderInfo);
                    loader.load(new URLRequest(url));
          }
          // invoke sounds loading
          for each (url in sounds)
          {
                    trace("sound", url);
                    var sound:Sound = new Sound();
                    addListeners(sound);
                    sound.load(new URLRequest(url));
          }
}

function onError(e:IOErrorEvent):void
{
          trace("error", e.target);
          removeListeners(e.target as EventDispatcher);
}

/**
 * Adds loading related listeners
 * @param          ed
 */
function addListeners(ed:EventDispatcher):void
{
          ed.addEventListener(Event.COMPLETE, onLoadComplete);
          ed.addEventListener(IOErrorEvent.IO_ERROR, onError);
}

/**
 * Removes loading related listeners
 * @param          ed
 */
function removeListeners(ed:EventDispatcher):void
{
          ed.removeEventListener(Event.COMPLETE, onLoadComplete);
          ed.removeEventListener(IOErrorEvent.IO_ERROR, onError);
}

function onLoadComplete(e:Event):void
{
          // remove listeners
          removeListeners(e.target as EventDispatcher);
          // decrement numAssets
          numAssets--;
          // when all assets are loaded - numAssets is zero
          if (numAssets == 0)
          {
                    // all assets are loaded and we can go ahead with the rest of application
          }
}

Post edited by: Andrei1

Tags: Adobe Animate

Similar Questions

  • Slow start of server 2003R2

    I have server 2003R2 installed on a HP DL360 G5, which worked for a few years. About a year ago, the startup time went from normal (a few minutes) to slow (30 minutes), and in the last months of very slow (60 minutes), I tried to boot into safe mode with no difference. Immediately after the restart, I am able to Ctrl-Alt-Delete and then open a session, and it displays "loading your personal settings...". "for about an hour. When I look at the event viewer, nothing distinguishes. I tried to create and connect under a different name without change. I do NOT use this server as a DNS domain, and it is only assigned to a working group. Someone at - it ideas?

    Hello vanjoli,

     
    Since you are on a domain with this problem, please transfer this issue to the address provided below on the Microsoft TechNet Forums. They are better suited to assist in server problems, as Microsoft Answers is oriented to the home user. Thanks in advance and good luck troubleshooting.
     
  • Is to slow down the Server OEM?

    Dear friends,

    Thought to implement OEM for the convinience to keep an eye on the mistakes and the tablespace space problems.

    Once I tried the last time, but all the developers said the database became incredibly slow.

    After that I stopped dbconsole, they all felt better.

    OEM slows down the database if its installed on the same server?

    Thank you very much.

    user645399 wrote:
    It is advisable to use OEM or better to just go with scripts.

    The new project should soon be launched for users and if its slow, then I am responsible.

    OEM is entirely GUI based and very easy to use. Which you can view grphical outputs
    If you prefer Scripts, there are a lot of manual work necessary.

    It depends on how you choose. If you have the option of OEM which is easy to use. So why if you prefer the manual way? As said previously it is not much of an impact as you think.

    If it's only concern then like I said create a new tablespace devote for OEM outside sysaux.

  • Preloader browser/server problem

    Hello.

    I just finished a Flash project for one of my clients. On all swf movies, I put a preloader script that downloads the entire movie until he plays. Out of my IP (1and1 internet) of all the movies load perfectly in all browsers I have IE, FireFox and Chrome. Here is the link:

    http://www.sdmdesign.com/outside.html

    You can click on the houses or the tabs to go to different pages.

    I do not have the actual Html or page creation and design. The person making the html code (they use a cms system) is to have a big problem with movies loading from that IP. They charge that Fire Fox and no other browser. Here's their link:

    http://www.souldecisions.org/

    Does anyone know why this might be happening?

    Their IP servers not would have the correct scripts on them for preloading swf movies?

    The webmaster insists is a cross with the preloading script browser problem, but I just don't believe that the films work in all the browsers of my IP.

    Any help or suggestion of this forum fine would be highly appreciated. Thank you.

    -Shawn

    with ie, I see a black background with black text: this text is replaced by the Flash movie.

    (you do not use swfobject correctly.)

  • Thunderbird is getting extremely slow - OS: Windows Server 2008.

    It takes hours to start, and when you connect, it is almost impossible to change between accounts or local folders.

    I tried the things:
    1) start in safe mode
    (2) compact various accounts and folders

    Please can you help me?

    Thank you

    I got my problem solved by following the advice given by DanRaisch:Thunderbird guard download messages over and over again

  • Very slow install Windows Server 2008 on PowerEdge R900

    Hello guys,.

    I have a problem with the installation process on R900. Its takes about 3-4 hours.
    After the installation of the performance of the system are very low.
    Operating system is installed on the RAID 1 (Perc 6 / i) but by Qlogic card I have connected 100 other disks that I saw on the screen of installation of cane.

    I try to install another system, but is the same. I remove RAID and then create RAID 1 - still the same.
    I used SUUB, but without success.

    Did anyone have simillar problem?

    Before this ws2k8r2 Ent core facility has been installed, and everything was ok.

    Thanks for the help,
    Martin

    Have you tried to use Windows without these cards of fiber channel connected to see if that makes a difference?

  • access licenses client license Clarifications + Server 2012

    Hi all

    I need some clarification in licensing to provide the solution that is right for my customer.

    One of my clients purchased Dell server with preloaded Windows Server 2012 OS (Standard Edition) us (from my company) to replace the
    existing server that has windows Server 2003.

    Now, the thing is customer want to transfer/migrate their client access licenses Server and Terminal Server CALs for Server 2003 to 2012 server.

    But is it possible to transfer/migration of CALs client Server 2003 to 2012?

    In the case of is not possible.
    May I suggest Windows server 2003 to install as a virtual operating system in Hyper-V
    to use their existing CAL?

    And is it as additional permit is required to use Server 2003
    Hyper-V?

    Waiting for your valuable response/solution.

    Thanks in advance.

    Hello

    Post your question in the TechNet Server Forums, as your question kindly is beyond the scope of these Forums.

    http://social.technet.Microsoft.com/forums/WindowsServer/en-us/home?category=WindowsServer

    See you soon.

  • From: W7 64 bit for: 2008 R2 slow RDP

    Windows 7 64-bit Windows Server 2008 R2 Standard. RDP is slow although my rdp settings are very low. I just formatted my pc and it is still slow. My connection is wired and no problems with it. It seems to me something else. Help, please.

    Thank you

    Hi Remrea,

    Thanks for posting your question in the Microsoft Community forums.

    I see from the description of the problem, you have a problem with RDP (Remote Desktop Protocol) very slow on Windows Server 2008 R2.

    The question you posted would be better suited in the Forum of the server. Please visit the link below to find a community that will provide the support you want.

    http://social.technet.Microsoft.com/forums/en/category/WindowsServer/

    Hope this information helps you. If you need additional help or information on Windows, I'll be happy to help you. We, at tender Microsoft to excellence.

  • Slower than Oracle 11 g

    I ran SQLFire installed locally on a system Win 8 with 12 GB of memory...

    I tried to run the comparison on the database of 5 million ranks test; one Oracle 11g one another 1.1 SQLFire (downloaded for evaluation). Just a simple query SELECT on the code.

    Here are the results of the 3 races:

    lines of 2 members (Locator & server1) 5 M ~ 2.5 GB SELECT statement

    Oracle: 16

    SQLFire: 46

    Oracle: 15

    SQLFire: 45

    Oracle: 15

    SQLFire: 45

    It is said that sqlfire works 30 times faster than Oracle 11 g all the test shows that sqlfire 3 times slower.

    Just curious to know what is missing?

    Hello

    Looked at the code, and here are a few comments:

    • The code is just do an executeQuery() and do not consume all the results. Most DBs, including Oracle and SQLFire, flow results gradually as they are consumed and executeQuery() by itself will probably not do much of the work in this case. For a meaningful comparison, the code should consume all results in Oracle and SQLFire (attention: it can take a lot of time with this large number of results). Please update that the look of numbers like for you code as below:

    long tStart = java.lang.System.currentTimeMillis ();
    RSet = stmt.executeQuery ("SELECT COLUMN1, COLUMN2, Column3 FROM table1");

    int numRows = 0;

    While (rset.next ()) {}

    numRows ++;

    }
    long tend = java.lang.System.currentTimeMillis ();

    System.out.println ("Oracle:" + (trend - tStart) + "for" + numrows + "rows.");

    • The code executes the query "SELECT COLUMN1, COLUMN2, Column3 FROM table1" against Oracle but runs 'SELECT id, data, search FOR app.test where (search = 'aA' OR search = 'aa' OR 'AA' = search OR search = 'Aa')' against SQLFire. Is it wanted, because that it is not a fair comparison? I'm assuming that the code runs the same queries against both, then again once need to consume the results completely for a fair comparison. For the request of the latter, you can optimize a lot if you use case-sensitive index added in SQLFire 1.1: vFabric Documentation Center , then the request can be "SELECT id, data, search FOR app.test where search ="aa"
    • SQLFire itself is not well optimized for queries that return a large number of lines for example > 10000 or more lines. It is better optimized for queries returning small average number of lines which, in our view, are much more likely to run in real-world applications. There are still a few models of complex query for which Oracle can do better, but for current releases, we target the most common query patterns. In future releases, we will close the gaps in other areas. That said, we really wanted more on queries that run evil in SQLFire.
    • Another point of difference in the small benchmarks is that SQLFire is a java engine runs first few queries slower than hotspot JIT comes into play, so in general, you will see the first operations of thousand being slower that a server has just started. Real-world applications will be won't on the first operations bit, so it might be preferable to a cue point ignore first few results in a freshly started cluster (or if it a long run cluster, then it's not bad).
    • Finally, the mentioned comparison is made reference to update the PTAC (the one without any limitation of operations) that contains a mixture of queries during each transaction than most close as possible to the real-world applications and updates. It is in such a mixed load that SQLFire really shines more traditional DBs.
  • Slow performance read/write on iSCSI SAN.

    This is a new configuration of ESXi 4.0 running virtual machines off a Cybernetics miSAN D iSCSI SAN.

    Having a high data read the test on a virtual machine, it took 8 minutes vs 1.5 minutes the

    the same VM on a slower 1.0 Server of VMWare host with virtual computers on

    local disk.   I look at my reading speed of the SAN, and

    It's getting a little more than 3 MB/s max in reading, and usage of the disk on the virtual computer is slower 3MB/s...horribly.

    The SAN and the server is both connected to the same switch 1 GB.  I followed this guide

    virtualgeek.typepad.com/virtual_geek/2009/09/a-multivendor-post-on-using-iSCSI-w

    ITH-vmware - vsphere.html

    to get the configuration of multiple paths correctly, but I still do not get good

    performance with my VM.   I know that the SAN and network

    must be able to handle more than 100 MB/s, but I am not getting

    it. I have two network cards of GB on the multipath SAN to GB two network cards on the

    ESXi host.  One NETWORK card per VMkernel.  Is there anything else I can check

    or do to improve my speed?  Thanks in advance for advice.

    Another vote for IOMeter.

    Try to test 32K 100% sequential read (and write) with 64 IOs in circulation, this will give sequential performance.  Should be close to 100 Mbps per active path of GigE, depending on how much the storage system can get out.

    Then 32K 0% sequential read (and write) with 64 traffic against a LUN will IOs (say 4 GB +) good test size give a value for IOPS, which is the main factor for virtualization.  Look at the latency, must remain below approximately 50ms usually in order to be able to work if the default 32 IOs in circulation (by host) is OK (say you had six hosts, the table should be able to deliver the random i/o with a latency)<50ms with="" 192="" outstanding="" ios="" (="">

    Do not use the "test connect rate" and cela effectively tests only cached flow, which we are not so interested in any case.

    Please give points for any helpful answer.

  • Motocast - not reliable

    I found that while the concept of Motocast is a good, it is simply not reliable enough to transfer files or stream movies. It never synchronize a movie - still fails, only sometimes broadcast a film - and requires very high use of the processor of the computer running it.

    I have two PCs at home, my main PC (Core2duo based) and a multimedia PC of Atom. My pc of media atom had no chance - motocast could not listen at all - music has also been uneven. I have now on my main PC and routes around 60% cpu when syncing or streaming...

    When it works, it works really well, and I've been with success able to watch an HD movie, but simply too unreliable to be any use.

    Are there alternatives I could try?

    Thank you

    If watch you movies, especially movies HD, those are encoded in real time by the server of MotoCast before streaming to the unit, to save bandwidth and adjust the flow rate and the resolution on the client device. This of course causes high CPU usage.

    A core2duo or Atom may not be sufficient for this task to happen in seconds, so be prepared for some delays here.

    I had the same problem with the Playstation media server. He started to work very well when I bought an i7.

    Streaming music is another pair of shoes. MP3 and other media that can be played directly by the client device are not re-encoded, so no problems with an atom or a Core2duo here.

    Incompatible, as formats for example FLAC are again encoded in real-time to MP3 256kit to save bandwidth. Again, this could cause delays on slow machines of server.

    This isn't the media server part, which would need a little more processing power. An Atom should be good for this.

    It's the media re-encoding in real time is a little more demanding.

  • (Redirected) Update PowerEdge R310 video/graphic card?

    Recently, we noticed that our server r310 worked very very slow.  This server is running only software milestone of the camera.  It seems that the graphics card is overloaded.  Is there a graphics card is recommended to anyone who would be able to manage more than 30 cameras without be bogged down?

    Hi pullon,.

    Please repost this in the forum of the more expert assistance server.

    http://en.community.Dell.com/support-forums/servers/

  • Download of the JRE problems

    For some reason when I try to download JRE 4.6 or 4.7, it crashes after a few minutes. I think the MAX I could get these to download is 15%. I have tried at different times, even at 03:00, and it made no difference. I tried some changes in my download manager and became pleased when slow down my download, but I was not able to get the full download. I also note that the download does not seem to allow a break and continue. If she could do it, it might be much easier, as I could continue a previous transfer of a few minutes at a time, but he insists on downloading, from the beginning, every time. I managed to download 4.5, but I have a STORM and I really want to 4.7 or perhaps 4.6.

    One thing that just occurred to me is that I have not tried to download while logged in here. I will try that next. In theory, it shouldn't make a difference, but you never know.

    Thanks if you can help.

    -Donald

    Oops, I meant JDE, not JRE... I'm sorry.

    I tried it connected here and it made no difference. I also tried to start Firefox in compatibility mode with XP/SP2 instead of VISTA. Also tried using IE and Safari browsers. All made no difference. Can blackberry place of JRE on a mirror site or SourceForge or something to us beginners can get it.

    I have all the software sun and Netbeans 6.5 with packages of mobility of the Sun. However, they will not have the blackberry API extensions.

    Yet once, anyone with any ideas or knowledge on the subject, please let me know. It is possible that since the Blackberry storm came out that a group of us trying to access these files and it slows down the server?

    Thank you

    -Donald

  • Box of blackBerry Smartphones Microsoft Outlook full of RIM outgoing messages?

    Is this normal? My Outlook 2007 to Microsoft (OUTBOX) is constantly full of 400 messages of RIM more every day. And when I try to send a mail, I never have no idea if they cross or not because my Outbox is full of messages from RIM 400 or more? Is - this slow down my server Outlook? How can I stop this?

    Reason: You have installed Desktop Manager by using the option "Desktop Redirector".

    Step 1: If you are not using redirector, you must uninstall Desktop Manager, and then reinstall it using the BlackBerry Internet Service option.

    Step 2: On your device, go to: Options > Advanced > maintenance book and remove any service books for [office]

  • Details of CAL

    Dear all,

    I have some doubts to the Client Access License (CAL).

    I have to go to implement a dell server (which has preloaded windows server 2012 Std edition OS) in place of client who will act as server authentication.

    It will authenticate just client to access WiFi available in the customer environment.

    Now, doubt is access to the customer of license (CAL) require to use ADDS with DNS integrated or not?

    Also is CAL's need to buy to use DNS (except for use with ADDS) and DHCP or not?

    Awaits a valuable answer/solution.

    Thanks in advance.

    The only time that you do not require a license CAL Windows is when the Windows Server hosted Internet services in a way not authenticated access. Machines using Windows Server for DNS or DHCP require client access licenses Windows. This is confirmed in the Microsoft license documentation

Maybe you are looking for

  • I tried to install Itunes on my new computer and it says that Itunes can not be installed because it does not work on this computer help!

    I just bought a gaming pc and tried to install Itunes... He said that he could not install because this software will not work on this computer... Contact software publisher for a compatible version or something like that... Operating system: Windows

  • How to handle interruptions in SMU-6363

    Hello I'm working on a PXI tester to test the ASICs. I use in the tester, SMU-6363 map and module SPI NI USB-8452 to speak to ASIC chips. The ASIC chip sends a signal of interruption to the SMU-6363 when its finished with a certain measure, for examp

  • Using the batch command file ' for/r' Windows to enumerate directories

    I want to find all directories named '.ttranscoded' in the current tree. But issuing for /r %d in (.transcoded *) echo %d produces no output. What Miss me?

  • Page transition animations

    Is there anything in order to implement the transition page such as flipping, twirling animations, sliding to the bottom to the top, etc. ? I see that it is possible to attach animations to transition to UI controls, but don't see any way to do it fo

  • pain of DSL

    I recently started to use century link dsl opprox every 15-20 min followed by dsl internet grave remains down for about 2-3 minutes. then come back to the top can at - it tell me what the Hells going on and help solve this problem