Loading images into memory

I have an applet that I need to load images into memory. For instance, lets say I am in the first section of the applet. While that section is being showed, I want to load the background image of the second section into memory.
To load the initial image into momory, I am just using a Mediatracker. No problem there. But I don't want to load all 20 backgrounds into memory at the same time as they take a lot of time. My understanding is that if I create a new MediaTracker while the first chapter is running, it will potentially cause some chaos, as that will stop my thread from running while I have an image loading.
Somebody told me perhaps I could create a new thread and have that thread load the backgroudn into momory? Perhaps something like this?
public class TestClass extends JApplet {
     private TestClass thisClass;
     public void init() {
          thisClass = this;
          Runnable r = new Runnable() {
               public void run() {
                    MediaTracker tracker = new MediaTracker(thisClass);
                    Image nextImage = getImage( getDocumentBase(), getImagePath() +"img1.jpg");
                    tracker.addImage(nextImage,0);
                    try {
                         tracker.waitForID(0);
                    } catch (InterruptedException ie) {
                         System.out.println(ie.toString());
          Thread t = new Thread(r);
          t.setDaemon(false);
          t.start();
          while(t.isAlive()) {
               int i = 1;     
          t.stop();
          t.destroy();
}No idea if I am on the right track or not? Another friend told me something about swing helpers but couldn't tell me much more?
Thanks in advance!

I use media tracker when I need information about how percent the image is loaded. you can use JLabel to load the images since it has own image observer in it.
hope you just want to deal with it. easiest way I can offer :)

Similar Messages

  • Problem loading image into texture memory

    Hi there, I am currently porting our new casual PC game over to the iPad using the pfi, the game was written in Flash so the porting process isn't that hard thankfully, it's mainly just optimizing the graphics.
    So far things are going smoothly, I was initially worried about graphical performance, but since we put everything into the GPU that's no longer a concern- it runs super smooth at 60fps at 1024x768, we can have a hundred large bitmaps rotating and alphaing at once with no slowdown.
    However there is one weird problem which is really worrying me at this point- it seems that the speed at which images are loaded into video memory as textures is vastly different depending on what else is being run on the iPad, for example:
    * If I run my game with nothing else in memory, it will run fine at 60fps, and load up large images into texture memory very fast.
    * If I run another App, in this case a Virtual piano app for a while, then close that App via the Home button (so the piano app is still in memory but suspended due to the multitasking), then when I run my game, it will run ok initially, but when I try to load a large (1024x512) image into texture memory it pauses the whole game for several seconds.
    * To make matters worse, if I repeat the same test using the RAGE app from ID software (which is very graphically intense), my game actually slows down to 1 fps and runs extremely slowly as soon as I run it and the frame rate never returns to normal. If I then double-click the home button, shut down RAGE, then go back to my game, it will run fine.
    I have read that sometimes when you load images into texture memory it will have to reclaim that memory from other apps, but that doesnt exaplain why it slows down every time I want to load something, or why the game would slow right down to a crawl.
    So then it seems that having other Apps in memory is slowing down my game, or stopping it from working altogether. Obviously this is not ideal and would stop us from releasing, so is there any way I can stop this, has anyone come across the problem? Please help!
    PS. this problem also happens on an iPhone 4, as I have performed the same tests.

    Hi _mz84
    First thing I noticed, is that you did not close your
    <embed> tag
    <embed src="gallery1.swf" bgcolor="#421628" width="385"
    height="611" wmode="transparent" />
    If that doesn't solve your troubles, try the following
    container.
    <object type="application/x-shockwave-flash" height="611"
    width="385" align="middle" data="gallery1.swf">
    <param name="allowScriptAccess" value="never" />
    <param name="allowNetworking" value="internal" />
    <param name="movie" value="gallery1.swf" />
    <param name="quality" value="high" />
    <param name="scale" value="noscale" />
    <param name="wmode" value="transparent" />
    <param name="bgcolor" value="#421628" />
    </object>
    hope this helps out.

  • Flash CS5 Could not load scene into memory. Your document may be damaged.

    Hello everyone!
    Just bought the new CS5 Flash and was eager to begin my first document. I opened a new document Saved As to begin and then setup my basic page with only one imported graphic. Hit Save and received an error message: Could not load scene into memory. Your document may be damaged. When I closed and reopened the document this same error appears twice in my Output Menu.
    I have noticed other people with several of simular issues and am not sure where to start to find an answer. Any help is greatly appreciated.
    Thanks in Advance,
    Biddler1

    Thought I'd add to this since I have a file with a similar problem. I'm carrying the files home to work on in the evening. I've noticed at work that when I update an image in the library flash shows me a path going all the way out to the root of the network share and then back to the file. The file is just one folder away. Maybe Flash has recorded an absolute path instead of a relative path to the asset.
    At home, Flash can't find the asset at all since it's recorded a non-portable path.
    The question is, if the asset has been imported to the project file, why is flash checking the original in the first place?

  • Installing Flash CS5.5 corrupted my CS5 Fla - Could not load scene into memory. Your document may be

    I have a FLA that worked fine in CS5, I have copies of the file going back 6 months.  Every file I open gives me this error: Could not load scene into memory. Your document may be damaged.
    How could every fla I've backed up give the same error? They all worked fine in CS5.  Does anyone know of a fix?  Or do I have to go back to CS5?
    Thanks!

    I reinstalled Flash Pro CS5 and it opens up all my FLA's (of the same project) perfectly.  But Flash Pro CS5.5 gives me this error: Could not load scene into memory. Your document may be damaged.
    So is CS5.5 unusable?
    cheeres.

  • Photoshop CC 2014 - Stack Mode Disabled - Load Image Into Stack Has No "Convert To Smart Object" Option

    Hi,
    I have just installed Photoshop CC 2014.1 and I have "Stack Mode" command disabled.
    Also, I have no option to convert layers into smart object  when I run "Load Image Into Stack" command.
    Can you please tell me how to enable these features?
    Thank you very much.
    Luca

    The 512 MB are a minimum requirement, not some optional thing. Without it, 3D will never work.
    Mylenium

  • Load image into Photo Album

    I'm new to Oracle.
    Can I load image into database by using Photo Album by no writing any code?
    And how?
    If not,how to load image into database?

    Yes you can. You can load media into the database into the photo album tables.
    Is this what you want to do? What exactly are you trying to accomplish.
    You can also use PL/SQL to put images into the database into your own schema (as with other database information)
    http://www.oracle.com/technology/sample_code/products/intermedia/htdocs/bulkload.html
    Larry

  • How to load image into picturebox

    Hi! Does anyone know how to load image into picturebox by using J2ME? And how to crete the picturebox in the forst place?
    Thanks!
    Regards,
    Jaceline

    You want java.awt.Toolkit.getImage() and java.awt.Graphics.drawImage().
    Ted.

  • Missing/empty symbols, "Could not load scene into memory. Your document may be damaged." CS6

    Hey folks,
    we've been getting this problem a lot. We had it in Flash CS5.5 and still have it CS6.
    We're animating a series in Flash and this problem keeps cropping up way to often, but seems totally random.
    Basically I'll be working on a .fla saving regular versions through out the day, no problems. I'll close the file down. Then I (or someone else on a different computer) will open it up and I'll get the error msg "Could not load scene into memory. Your document may be damaged." Everything will be fine except for a few missing graphic symbols. Sometimes just the one, sometimes a whole bunch. So where the symbol should be on the stage, instead you get a small white square, but it still contains the animation information. So it will still move about the stage. If I bring in the same symbol from an old scene I can swap them out and the problem is fixed, (until it does it again on a totally different graphic symbol).
    If i select the symbol in the library the preview is white/blank and i can't go into it to edit. When I select the symbol on the stage, the "instance of:" gives me a blank "_ _ _" in the properties tab. How ever if i right click show in library it does show me the correct (although broken as in blank) symbol in the library.
    I havent been able to reproduce this problem on purpose but I'd say it happens in roughly one scene out of 10. Its seems to happen at random, I know there must be something in common but i havent figured out what. Its going on in heavy scenes (large library multipule characters), lite scenes (just the one character). Its not like it happens to the same symbol, different ones each time. Everything is local to the scene, all elements are created in flash. We are working across a network but as everything is local to the scene i don't see how that would be a problem. Also we don't have duplicate named symbols. It also won't necessarily affect something that has been changed since the last version. could be a background element thats been there, untouched since the first version of the scene.
    One point on how we set up our scenes which may be relevant. Start with empty scene, copy and paste symbols from other scenes to populate. Save.
    The problem could appear on say version 4 or version 36. Older versions are usually fine.
    So to sum up. Flash file is fine when we save it, open it up again later and a symbol will have disappeared. It's happening far too often.
    I know how to fix the problem, thats not what I'm asking. I need to know WHY its doing it so we can stop this from happening in the first place.
    Phew! Thanks for reading this far. Any help would be highly appreciated.
    Sander/

    Can you elaborate on how you use the network? Are you working from FLA/XFLs stored on a machine across a network (and saving them across the network)? I had plenty of those issues and Adobe has always warned not to work across a network. I just fell into the habit of copying over what I need to work on locally, then updating the file servers at the end of the day. Nothing was corrupt after that.
    Also lately in CS5.5 (not CS6 yet) I had noticed that I could change some graphics assets, close the document in OS X and open in Windows only to find freshly updated graphics reverted back. What's even more odd is if the OS X machine that made the changes opens it the changes are still made. This happens vice versa as well. My only solution on that was not to work cross-platform with other machines on a network unless absolutely necessary.

  • Load image into holderMC

    Hi,
    I'm working on an application which places instances from my
    library onto the stage. Every instance has a movieclip inside it
    which is called holderMC. What I want to do is to load external
    images into holderMC except I can't seem to get it working. How
    does one load images into a pre-defined movieclip?

    Oh, sorry, wasn't looking properly. You cannot load images
    into MovieClips like in AS2, you have to use a Loader or the
    UILoader component.
    If you want to be able to position the loader visually, then
    you can give an instance of the UILoader component and instance
    name within the THEPhoto MC, and use the following code:
    MovieClip(photo).holder.load(photoRequest); //where holder is
    the instance name of the loader.
    OR
    Within the ThePhoto class you could create a new Loader:
    public var imgLoader:Loader = new Loader();
    public function ThePhoto () {
    imgLoader.x = 0;
    imgLoader.y = 0;
    addChild(imgLoader);
    and then use:
    MovieClip(photo).imgLoader.load(photoRequest);

  • How to dynamically load images into Flash

    I have a movie clip on the stage that I want to dynamically
    load images into (that constantly change), how would I go about
    doing this? Thanks.

    Use the Loader class to load in images.
    Then use addChild to add the Loader class into your MovieClip
    on the stage.
    As far as &amp;quot;constantly change&amp;quot; what
    do you mean by that? You could use setInterval, ther enterFrame
    event, or any other means to trigger a new image to be loaded into
    the Loader instance.
    Finally, you can use the Tween class to create some nice
    effects for the images (fade it, blur in, photo blend, masks,
    etc)

  • Making a loaded swf-file loading images into the movie..

    Trying to convert my problem from norwegian into english
    isn't always that easy... :)
    Anyway..
    I've created som cool buttons that I want to be loaded into a
    movie (let's call i MainMovie.swf) and from there I want the
    buttons to be able to load images into a movieclip (ImageContainer)
    inside the MainMovie.swf.
    Is it possible to make the MainMovie.swf communicate with the
    the loaded buttons (each button is a swf-file containing the
    actionscript, objects, etc.) so when the buttons are clicked they
    load different images into the ImageContainer?
    My idea here is to include an as.file into the MainMovie.swf
    as well containing the url's to the images that I want to be loaded
    into ImageContainer.
    I've tried to create a button on a layer above the buttons
    that's loaded into the MainMovie.swf but I end up with the loaded
    buttons not working properlu because of the button that I've
    created and placed above them.
    Now, I don't want the url's inside the buttons thats loaded
    into the MainMovie.swf as I want the ability to be able to replace
    those buttons-files without having to use too much time writing the
    url's in each button.
    Thanks folks.

    are all your swfs using as3 or as2? if as3, you won't be
    loading into a movieclip: you'll use a loader instance and you can
    reference (or communictae with) the loaded as3 objects using the
    content property of your loader once you cast it as a
    movieclip.

  • "Could not load scene into memory. Your document may be damaged." Lost whole timeline.

    Please help me - I have been working on a Flash CS6 file for a while now, and just got the message "Could not load scene into memory. Your document may be damaged." The file is not big, all it contains is 3 layers - one embedded video FLV file and 2 layers on top that only contain brushstrokes. The file is on my external hard-drive and now I get the message when I open it on either of my computers. I read feedback that I should re-link or re-import my assets, so I re-made the FLV file and imported it to replace the old one that it said couldn't be found. The problem is the timeline is completely empty. Even once I import the new video, the timline only has one "layer 1" with only one blank keyframe. Where is the rest of my work? I am good with backing up but was just away for a week and got a lot of work done so I couldn't back it up until I was back home... and obviously that isn't happening now.
    Please help if you have any idea where my work has disappeared to.

    Hi GregirArt,
    Can you please check your PublishSettings.xml file whether is there any duplicate profile entries?
    You can check the same by renaming your .fla to .zip and extract the zip file to open the PublishSettings.xml
    If you find multiple duplicate profile entries then please remove all the duplicate entries from the file and rename the file back to .fla and see if that helps.
    Thanks!
    Mohan

  • Flash Pro CC saved fla project - "Could not load scene into memory. Your document may be damaged."

    Hi all, I've been working on a project in Flash Professional CC in windows 7 that was started in a previous version of Flash Pro and occasionally after I've saved the project and tried to open it the next day I get the "Could not load scene into memory. Your document may be damaged." message and only a blank Scene 2 in the project. I've previously been reverting back to the old saved project file and starting over. Its wasted a lot of time so far.
    I can still open the same exact project in CS6 on another older computer but not in CC. I can also save the fla in CS6, transfer it to the other computer and then it will work again (for now). This isn't going to be an option in the future as CS6 was a trial version that is on its last use today.
    I've tried to create a new flash pro cc project and just copied and pasted the library and scene layout from the old project into the new project. This worked for a couple of saves/ opens but the error has happened again.  I'm scared that now that I've reached the point in the project were my work in the animation/ visual side will start to be more intensive that I will continuosly have to worry about losing all of my work. I'm using a document class so the AS3 code hasn't been an issue thankfully. Any help would be appreciated.

    Thanks for the reply Amy, that is essentially what I am doing already only I'm not using version control software I'm just managing it on my own since its a solo project, though I have been considerring using git anyway. It still doesn't explain why I can open and save the supposedly damaged project (according to CC) in CS6 and only then will it work again in CC. Also I'm not gettting a chance to save as a new version over and over for long. Its only a couple of days max, usually just over one day, and I've primarily been working on the code in Flash Builder with little functional change in the actual fla project. Its primarily changing movieclips instance names, which in this project is tedious and time consuming. Having to revert back to the older working version is exaclty what I'm trying to avoid. I shouldn't have to commit the project to a repository every little change that I make to the fla file.

  • Damaged Flash CC files ("Could not load scene into memory.")

    I just installed Creative Cloud the other day, and had the following problem immediately.
    I create a brand new .FLA and import a few assets from another person's Illustrator CC file, then write some ActionScript for basic interactivity. I can work for hours with that file. But when I save, quit and reopen the file (either 2 seconds later or the next day), I get a warning that says "Could not load scene into memory. Your file may be damaged." The library is empty, no instances of symbols on the stage, nothing. I can't open the file with Flash CS6 or anything: it's shot. I repeated the process several times with brand new Flash files, but always get the same results. I even deleted everything and reinstalled and still got the same results.
    I switched to using Flash CS6, but when I imported artwork from Illustrator CC, I was getting corrupted artwork and periodically I'd get an error that said something to the effect of "You can't import artwork from a newer version of Illustrator into Flash CS 5.5. (WTF? I'm in Flash CS6.)
    Any ideas? I'm on a Mac, OS X 10.8.4. Thanks very much.

    Hi Gregir ,
    Is it possible for you to share the file or the illustrator assets with us? We can take a look and get back on it.
    Can you check the size of the PublishSettings.xml file which would be present after unzipping the zip created from the fla renaming it as .zip.
    Thanks and Regards,
    Sudeshna Sarkar
    Adobe Flash Professional Team

  • How to find out memory consumption for table in HANA without load it into memory

    Hi,
    To determine the memory consumption for a table in HANA, you can query table M_CS_TABLES, however, it requires load table into memory first, I just wonder if there has another table store memory consumption information for all HANA tables regardless it load into memory or not. Below is screenshot for one of table in my system, since that table is partially loaded into memory, "Total Memory Consumption (KB):" tell me the memory consumption of the portion load into memory, what I am looking for is something like "Estimated Maximun Memory Consumption (KB)" which provides me total memory consumption for that table including portion doesn't load into memory, of course I can use this Esitmated information, but consider I have close to thousand tables in my HANA system already, it's not pratical to check tables one by one.
    Thanks,
    Xiaogang.

    Hi Xiaogang,
    Estimated Memory Size that you see in the Table Run time Information - same is available in M_CS_TABLES also
    If you don't get the size of any Table in M_CS_TABLES View, then the same will also not be available in Runtime information of the Table
    Even if tables are not loaded into memory, you can get the Estimated Size, just try running the query with filter LOADED = 'NO'
    Regards,
    Vivek

Maybe you are looking for