Need help loading base64 encoded image.

I've got an applet that saves an image into a database by posting a base64 encoded version of the image to an ASP page. Basically, I convert the image to an array of bytes, then encode it and post it to the page. Now, my problem occurs after I read the base64 string from the database and try to display it. When the application is started up, it is supposed to read the image and load it into the canvas of the applet, but I get a NullPointerException when I call displayImage because the fgImage has -1 width and height. If anyone has done this before and has any hints or tips, that would be great. Otherwise, take a look at my code and see if you can find something wrong. Thanks!
public void loadBase64Image(int[] newPixels) {
System.out.println("loading new image...");
try {
if (newPixels == null) {
byte[] imgPixels = new byte[this.getWidth() * this.getHeight() * 4];
URL loadURL = new URL(fgImgURL);
URLConnection imageCon = loadURL.openConnection();
imageCon.setDoOutput( true );
imageCon.setUseCaches(false);
DataInputStream imageIn = new DataInputStream( imageCon.getInputStream() );
BASE64Decoder decodedImage = new BASE64Decoder();
imgPixels = decodedImage.decodeBuffer(imageIn);
imageIn.close();
int w = this.getWidth();
int h = this.getHeight();
int imgPix[] = new int[w * h];
int index = 0;
for(int y=0; y<imgPix.length;y++){
imgPix[y] = imgPixels[4*y]
| (imgPixels[4*y + 1] >> 8)
| (imgPixels[4*y + 2] >> 16)
| (imgPixels[4*y + 3] >> 24);
imgMemSrc = new MemoryImageSource(w, h, imgPix, 0, w);
else
imgMemSrc = new MemoryImageSource(this.getWidth(),this.getHeight(),newPixels,0,this.getWidth());
// Update the fgImage to the current OSC.
if (fgImage != null) fgImage.flush();
fgImage = Toolkit.getDefaultToolkit().createImage(imgMemSrc);
displayImage(fgImage, this.getWidth(), this.getHeight());
catch (Exception e){
System.out.println("BASE64 LOAD ERROR (" + e.getClass() + ": " + e.getMessage() + ")");

Docs for URLConnection
"A URL connection can be used for input and/or output. Set the DoInput flag to true if you intend to use the URL connection for input, false if not. The default is true unless DoOutput is explicitly set to true, in which case DoInput defaults to false."
You have setDoOutput(true), so doInput is by default set to false according to the docs. I would make the change to also setDoInput(true) as well and see if it works.
public void loadBase64Image(int[] newPixels) {
   System.out.println("loading new image...");
   try {
      if (newPixels == null) {
         byte[] imgPixels = new byte[this.getWidth() * this.getHeight() * 4];
         URL loadURL = new URL(fgImgURL);
         URLConnection imageCon = loadURL.openConnection();
         imageCon.setDoOutput( true );
         imageCon.setDoInput( true ); // Make sure you add this line
         imageCon.setUseCaches(false);
         DataInputStream imageIn = new DataInputStream( imageCon.getInputStream() );
         BASE64Decoder decodedImage = new BASE64Decoder();
         imgPixels = decodedImage.decodeBuffer(imageIn);
         imageIn.close();
         int w = this.getWidth();
         int h = this.getHeight();
         int imgPix[] = new int[w * h];
         int index = 0;
         for(int y=0; y<imgPix.length;y++){
            imgPix[y] = imgPixels[4*y] | (imgPixels[4*y + 1] >> 8) | (imgPixels[4*y + 2] >> 16) | (imgPixels[4*y + 3] >> 24);
         imgMemSrc = new MemoryImageSource(w, h, imgPix, 0, w);
      else
         imgMemSrc = new MemoryImageSource(this.getWidth(),this.getHeight(),newPixels,0,this.getWidth());
      // Update the fgImage to the current OSC.
      if (fgImage != null)
         fgImage.flush();
      fgImage = Toolkit.getDefaultToolkit().createImage(imgMemSrc);
      displayImage(fgImage, this.getWidth(), this.getHeight());
   catch (Exception e){
      System.out.println("BASE64 LOAD ERROR (" + e.getClass() + ": " + e.getMessage() + ")");

Similar Messages

  • Need help brainstorming a tricky IMAGE issue

    Hi,
    I've been trying to figure out a simple way around an issue, but as i simply cannot come up with an answer, i thought I'd put it out to the community to see if i can get some ideas back.
    I'm putting a Mobile game together, and I'm still establishing the foundations of it. One element is the idea of having all creatures and character to be able to look different. To this end, my proposal is to have a set of various frames of say different creatures, and with other items (like armour and weapons) in matching poses. For example, You would have say a person running in 4 frames. For each frame, there is a matching set of clothes frames for each pose. One coule be normal clothes, and another armour so when the character is wearing normal clothes, the system would draw to the screen the naked character and then place the clothes over the top. Proper transparency (using the PNG alpha channel) makes this masking effect work as it should and it seems to work okay here.
    Here is the problem. What i want to do is to be able to represent say, a hiding creature as being partially transparent wether through alpha blending or dithering. I have put an efficient class together than can quickly resize and recolour any image and draw it to the screen, and can also modify the transparency via either alpha blending or dithering. Here is the issue: This will NOT work when building the characters onto the screen! the problem if no-one notices here is lets say you then make the system draw the person at 50% opacity to the screen.Great, it works, but now we need to put the clothers on top so we draw THAT at 50% transparency. Uh-oh... Because the clothers are transparent, we get an artifact of the naked character shining through the clothers we just placed on top. So, the solution WOULD be simple: create an offscreen image for buffering, draw the character to it, then draw the results to the screen at 50% opacity... WRONG. The only Mutable off-screen image you can make is one filled with white pixels! Useless: we get an ugly white box around the character.
    The only two solutions i can think of are the following:
    1) Take a snapshot of the box around where we intend to draw the character. This should capture the background. We now build the character onto the screen as we normally would but if we want to make them transparent, we then paste the original background image over the top at a sertain opacity. I see problems with this being a) The design on the game is already very lean on memory requirements. I have built my own image handling classes that only load stuff when needed and discards it when no longer needed and also block wasteful reloading of images into memory, but having to always take a snapshot of a box around a character prior to drawing will slow it all down immensly.
    2) the class i use for transformations, recolouring and resizing does so by copying the image data into an array and then manipulating it. I've designed it very well so that it only ever holds one image at a time and loading a new image into it uses the same array and thus, never creates a new array in memory and then relying on the Garbage collector to reclaim it. Using this, i could render the characters to it, and then draw it to screen but the problem as i see it is that this would be very processor intensive and would most likely slow the entire system down.
    Naturally, the ideal solution is to draw to an offscreen image buffer and go from there, but i think the only way to do that is to use the BufferedImage which is on an API that isn't widely available (at least, it's not on my phone and it is pretty new). I need this to be as compatible as possible, so i don't want to access any optional API's i don't need to. I would prefer to be able to do this transparency trick, but if i can't, i guess i would have to find another way to represent a hiding character in the game (I guess a Black silouette).
    Any help, hints or ideas would be greatly appreciated!

    Okay, imagine you have a character running. The whole purpose of my design idea is to have it so the characters look different based on the gear they are equipped with (+Image a common game like Neverwinter nights, or WoW. Your character looks different based on what they are equipped with and no, I am not trying to create a game of that scale on a Mobile phone+). Naturally, the character isn't a static figure, so they move, run, attack and so fourth. My plan is to have a set of character frames in all the different frames, and matching clothes and equipment frames matching each cell (+we KNOW where their arm will be in the 2nd frame of a run-right action, so we would position say, a shield in the right spot. A clever appraoch is to be taken here for example, a right handed person would weild their shield in their left hand, and if they are running right, the shield would appear behind them and would be facing out, so the system would draw it in the order of "Left_Hand_Item->Character_in_the_Nude->Clothes_for_the_Character->Right_Hand_Item". Simple mirroring can handle any left/right directions as the frames for running in the different directions are also mirrored+). Essentially, the look of the character would need to be built on a per-frame basis. I am hessitant to build all of the frames of the character in memory at load time as I have the following action factors:
    - The character can face in 8 directions being all the diagonals, Vertical and horizontal directions.
    - The character needs the following actions to be available: Running, Standing, Dying -> On the ground (+This also counts falling down or sleeping+), Attacking / Swinging, Ranged attacks (+bow and arrow+).
    - To at least offer some kind or animateable look, there should be at least 2 frames for each action.
    As you can see, there is quite a lot. The approach i have already taken is fairly powerful. I decided to scrap the Java Sprites as it couldn't do what i needed it to do so i created my own caching system. A special MAP file stores the information on all the frames, and another class retrieves this on demand from the file, but only takes certain chunks. A initial class manages file access and loads the entire image into memory, and another uses this class to extract the frame it wants. When the other class is finished, the file-opening class then drops the full file from memory and attempts to reclaim the used memory. So far, it works well. The reason i have taken this appraoch is there is just too much data to have it all laoded into memory, it has to be done on demand and store as little information as possible. If i can represent 5 different characters by using a combination of other frames, i should have excellent results. I am trying to find a good balance between memory consumption and CPU usage. So, in a long winded answer:
    --There are a LOT of frames that may need to be transparent at any one time.
    --The amount of memory I'll need is still in the air at this point. As i build it, I am keeping a hawk-like eye on memory consumption and watching for anything being wasted (+using boolean where possible, If i don't need the capacity of an int, i use byte instead, etc+). This incidently ran me into the strong desire to utilize unsigned values as i don't need negatives anywhere, but I will have to live with that wasted bit.
    --I am aware that not all devices support Alpha blending which is why I also aim to support dithering. For example at 50% transparency, more than half the pixels are fully transparent (+Some may already be transparent, so we're not going to go and make them visible!)+
    --The transparent character is used to represent a character that is hiding. For example, you may have an Ally character being stealthy, so to make sure YOU the player can still see them, but represent clearly that they are in a special state, i wanted them to be transparent. Also, if there is an enemy stealthing, but you have detected them. I need to be able to represent that they have indeed been detected and that they can be seen, but they are still trying to be stealthy. So yes, one substitute would be to make them entirely black pixels and maybe even just draw the naked character black without any armour or equipment as a stealthing character would assume reduced detail.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • URGENT : Please HELP : Loading a first image too slow

    Hello,
    I want to load an image to save it just before in a JPG format so as to obtain finally a byte[] array of this JPG image result.
    So, to do it, I tried to load my Image from different ways but I have always a strange comportement... My problem come from the reading :
    First, I use the imageio classes...
    FileImageInputStream fiis = new FileImageInputStream(file);
    BufferedImage input = ImageIO.read(fiis);
    And then, I use the oldest method :
    Image image = new ImageIcon(file.getAbsolutePath()).getImage();
    BufferedImage input = new BufferedImage(image.getWidth(panel), image.getHeight(panel),BufferedImage.TYPE_INT_RGB);
    and also :
    Image image = new ImageIcon(file.getAbsolutePath()).getImage();
    BufferedImage input = toBufferedImage(picture);
    But finally, I understood my problem is that the first time I load an image (no matter the format, JPG, BMP, TIFF... or other) the loading phase is very slow and lasts at least 30 sec. But then, every loading that I do will gonna be really fast. (No more than 1 sec.) It's look like if the first time there was a kind of dinamical alocation or something like that.... but I tried to find some configuration parameters to set it... But without success. :-(
    If someone could have an idea to suggest me... it would help me very much.
    Thanks in advance for your help,
    Anthony

    Please someone can help me ?!? A suggestion ?
    I have tried today one more time to resolve this issue... but without success... Anything I do with the loading of an image... by imageio or other ways... it's still the same problem... the first time I load an image, it takes me 40 - 50 sec to load it and after this first load, it is very fast with others... and with every formats. It's not a question of format but of memory allocation, I think... but I'm not sure...
    PRECISION : I work with an applet, is there something to configurate to allocate some memories or another thing ?!?
    Thanks in advance for your help, I really need it just right now... I have to finish this job extremly fast !!!
    Regards,
    Anthony

  • Need Help Loading SWF in a FLA

    I simply want to call a swf into an existing fla. I have
    tried everything. When dragging the timeline, you see the swf. When
    you preview, it is not there. Background - I have an exisiting fla
    that contains the image background for all. I want to set a
    transparent carousel menu on top of the background that is in the
    fla and leave the existing background and lower objects in place.
    The carousel.swf will need to call java and an xml file on the web
    server.....all external to the "summed" final. If I could layer
    flashed in DW, then the problem would also be solved. Please be
    detailed, I am obviously not a developer.

    although I'm not certain why you would not just 'place' the
    background 'image' on the stage in the fla (probably because you
    wish to change it dynamically down the road) - you need to 'load'
    the swf, not 'place' it within the other file. you do this with the
    MovieClipLoader class.
    with the swf that you wish to load in the same directory as
    the swf of the carousel file, place something like the following in
    the first frame, on a layer called actions, in the actions panel:

  • Need help restoring a partition image

    Setup: OSX 10.7
    One OSX partition, one Windows 7 Bootcamp partition.
    Initially, I made a backup image of the windows partition using disk utility and saved that to an external drive.  For some reason, using any format besides DVD master would result in an "invalid argument" error.*  So now I have an ISO image sitting around, the same size as the entire partition.  I can mount this image and see all my Windows files and directories inside.
    What I want to do is image this ISO file back over my original windows partition to restore it to an earlier state.  However, when I use disk utility, this is what happens:
    Select .iso as source, greyed out (unmounted) partition as destination.
    press restore, agree to erase
    DU asks to scan, and then fails with "unable to scan.  Invalid argument"
    I can also open the image so that now in finder there is the icon of a disk, surrounded by a rectangle with a corner folder over, and underneath is an image of an external disk drive.  If I choose this as the source, I get "restore failure.  Invalid argument."
    All I want to do is write my partition image back to the actual partition.
    *That's weird, I just tried to image the partition again right now to a .dmg, and it seemed to start ok.  Oh well.  Still doesn't help with my current problem, though.

    OK, I managed to fix it using old fashioned techniques.
    First, I needed to check that the image I had was an actual disk image, and not something else contained in a wrapper.
    In terminal, I used the command "file" on the image file and it saw a boot sector + other stuff.  That's good.
    Next, I checked that the size of the image file is exactly the same as the size of the partition I was going to write to using "diskutil info (name of partition)".  That checked out as well.
    Finally, I just did the usual dd if=image file of=target bs=4096 to write the image file back in.  Magically, it worked.  I guess it was good that in the process the partition table was not damaged.
    All the other GUI programs like disk utility, winclone, etc refused to touch my iso image file.
    I should have saved myself the headache and grabbed the original source image using dd as well.

  • Need help loading DLL in labVIEW project

    I have a DLL that was written in C# that I want to load it to my labVIEW project. I have never done this before, so I need help. I chose Connectivity-Call Library Function Node then loaded my DLL. After, under function name, I typed in the function name from the code. I don't know what to do with other like Parameters.
    They don't let me attach dll file 
    Can someone explain how to set the parameters and etc?

    Well, it seems that you really need to learn quite a bit about .NET (ActiveX is very similar!) first.
    The constructor node in your code creates an object in your .NET CLR (Common Language Runtime). This object exposes properties and/or methods. Use Property Node(s) and Invoke Node(s) to access these. Usually, you get references to other objects which you can work this.
    Remember the golden rule for ActiveX and .NET:
    Close all references you created in your LabVIEW code on your own (using Close Reference)!
    Norbert
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

  • I need help loading a swf file in a flash website

    Hi,
    I am an interactive design student working on a flash portfiolio and need help. I can't figure out how to load a game I made in flash into my porfolio so that it loads after clicking on a button, becomes playable, then have a button to leave the game and go back to my portfolio. I'm working in Actionscript 2.0 because that's all my teachers will show me and I have minimal actionscript knowledge.
    Thanks,
    Emily

    I thought I got it to work with loadMovie, but it only plays the intro, and then either repeats or exits as soon as the first bit of actionscript starts

  • Need help loading data from Excel data file to oracle tables

    i need to load an Excel spreadsheet to Oracle table.
    The spreadsheet contains 20 columns, the first 8 columns contains basic info, but the rest 12 columns contains info like
    1stQtr_08, 2ndQtr_08, 3rdQtr_08, 4thQtr_08
    1stQtr_09, 2ndQtr_09, 3rdQtr_09, 4thQtr_09
    1stQtr_10, 2ndQtr_10, 3rdQtr_10, 4thQtr_10
    So what i need to accomplish is:
    break that one record(with 20 fields) in Excel to 3 records for each fiscal year in the Oracle table, so each record in the database table will look like
    8 basic field + fiscal_year + 1stQtr_08, 2ndQtr_08, 3rdQtr_08, 4thQtr_08
    8 basic field + fiscal_year + 1stQtr_09, 2ndQtr_09, 3rdQtr_09, 4thQtr_09
    8 basic field + fiscal_year + 1stQtr_10, 2ndQtr_10, 3rdQtr_10, 4thQtr_10
    There are about 10000 rows in the data file, so how can i use sqlldr to perform such task? beside sqlldr, any other good suggestions?
    thx

    External Tables is just an Oracle API for sqlloader. If you going to load this data over and over again, External tables would be a good idea, but if it's a one time thing, sqlldir is simpler, unless you just want to learn how to use External Tables.
    I used to run a data warehouse, so I have done, at least similar, to what you are doing in the past.

  • (HELP) - Loading multiple external images error #1010

    I'm a newbie at Flash and spent the whole day trying to fix this one problem and can't seem to fix it no matter what I do.
    I'm using Action Script 3.0, CS5 on Windows 7.
    I'm trying to load two external images (thumbnail images) in the loader "see image below for reference", where the full image size will be. However, I am getting this error when testing my movie. What am I doing wrong?
    Test Movie error message:
    "port1_btn
    TypeError: Error #1010: A term is undefined and has no properties.
        at index_fla::MainTimeline/fl_MouseClickHandler_6()"
    "port2_btn
    TypeError: Error #1010: A term is undefined and has no properties.
        at index_fla::MainTimeline/fl_MouseClickHandler_7()"
    FYI:
    Loader instance name: mainLoader
    Thumbnail #1 instance name: port1_btn
    Thumbnail #2 instance name: port2_btn
    This is my code

    Go into your Flash Publish Settings and select the option to Permit Debugging.  Then the error messages could include an indication of which lines are causing the problem.
    And just for the sake of asking since the code is somewhat minimal... is the mainLoader inside a container named portfolioBkgd?

  • Need help Loading images with selection on a form field?

    So I'm kind of a newb.. I can do basic forms but I need to set up a form field drop down box that will give me the ability to load images correlating to the users choice. I'm at a total loss for where to start, so ANY help would be appreciated. If you know of any good books or tutorials on the subject please share.
    Thanks in advance
    Sincerely,
    Stumped4now 

    P.S. I think I'm getting a better understanding of OCGs after lots of research today. However I still seem to be missing something
    var docOCGs = this.getOCGs();
    for (var x=0; x < docOCGs.length; x++)
      if(docOCGs[x].name == "Layer1")
      docOCGs[x].state = !docOCGs[x].state;

  • [noob needs help] Loading image from a URL

    Hey everyone. I'm new here. And I'm new at J2ME as well.
    I have a simple school project and I have doubts about it. I've searched everywhere on the net yet I could not find the solution. Anyways, I do understand the concept of loading images by putting the files in the "res" folder and use:
    try
    img = Image.createImage("/burgerimgsmall.jpg");
    catch (Exception e)
    e.printStackTrace();
    But my project requires me to load an image from a URL. How do I go about doing that? If it helps, here's the URL:
    http://img.photobucket.com/albums/v703/punkgila/burgerimgsmall.jpg
    Thanks guys!

    Don't worry, downloading image from http is also simple. Look into Photoalbum demo in wtk2.5

  • Need help - Loading Multiple instance of the same image

    Hi guys,
    I have been trying for days now, to get this working but i'm not able to do so, i have been trying to get actionscript to load multiple instance of an image file using a for loop.
    Would anyone be able to enlighten me on this?  the other functions are located on a seperate actionscript file.
    many thanks
    part of the code is as follows: (it works if i use the graphic class)
    function makeRoad():void{
        var row:int = 0;//the current row we're working on
        var block;//this will act as the block that we're placing down
        for(var i:int=0;i<lvlArray.length;i++){//creating a loop that'll go through the level array
            if(lvlArray[i] == 0){//if the current index is set to 0
                block = new EmptyBlock();//create a gray empty block
                block.graphics.beginFill(0x333333);
                block.graphics.drawRect(0,0,25,25);
                block.graphics.endFill();
                addChild(block);
                //and set the coordinates to be relative to the place in the array
                block.x= (i-row*22)*25;
                block.y = row*25;
                } else if(lvlArray[i] == 1){//if there is supposed to be a row
                //just add a box that will be a darker color and won't have any actions
                block = new Shape();
                block.graphics.beginFill(0x111111);
                block.graphics.drawRect(0,0,25,25);
                block.graphics.endFill();       
                block.x= (i-row*22)*25;
                block.y = row*25;   
                roadHolder.addChild(block);//add it to the roadHolder
            } else if(lvlArray[i] is String){//if it's a string, meaning a special block
                //then create a special block
                block = new DirectBlock(lvlArray[i],(i-row*22)*25,row*25);
                addChild(block);
            for(var c:int = 1;c<=16;c++){
                if(i == c*22-1){
                    //if 22 columns have gone by, then we move onto the next row
                    row++;

    @Kalisto - i don't think that is the real issue here since we cannot see what is in the DirectBlock class and the OP has not mentioned any compiler errors.
    Desmond - it appears as though you are constructing this in the form of a 'grid' - correct?  but the problem i believe is that the positioning is not being determined properly - to do something like you want here (i think) you would use what known as a 'nested loop' - this means the 'outer' loop handles iteration of the 'rows' and an 'inner' loop handles the iteration of the columns.  the way you have this set up above, you are attempting to use the 'row' value to position both the row and column - this wont work and it's likely that everything is getting 'stacked' on top of one another.
    may want to structure things a bit more like this:
    function makeRoad():void {
         var index:int = 0;
         for(var row=0; row<22; row++) {
              for(var col=0; col<22; col++) {
                   index = (row*22)+col;
                   if(lvlArray[index] == 0) createBlock(0x333333, col*25, row*25);
                   if(lvlArray[index] == 1) createBlock(0x111111, col*25, row*25);
                   if(lvlArray[index] is String) roadHolder.addChild( new DirectBlock(lvlArray[index], col*25, row*25) );
    function createBlock(color, xp, yp):void {
         var block:Shape = new Shape();
         block.graphics.beginFill(color);
         block.graphics.drawRect(0,0,25,25);
         block.graphics.endFill();
         block.x = xp;
         block.y = yp;
         roadHolder.addChild(block);
    note: i do not know how many 'rows' you intend to have and are stored in the array so the row<22 will need adjustment

  • Need help centering different sized images being loaded from a container

    stop();
    mainArea_mc.visible = false;
    home_btn.addEventListener(MouseEvent.CLICK, function () { gotoAndStop("Home Template")} );
    var totalImages:int = 0;
    var imageDirectory : String = "";
    var currentImage:int = 1;
    var filePrefix : String = "";
    var loader1 : Loader = new Loader(); // 2 loaders so we can fade an image on top of the other
    var loader2 : Loader = new Loader();
    pic_mc.addChild(loader1);
    pic_mc.addChild(loader2);
    loader1.name = "loader1";
    loader2.name = "loader2";
    loader1.contentLoaderInfo.addEventListener(Event.COMPLETE , resizeFadeImage);
    loader2.contentLoaderInfo.addEventListener(Event.COMPLETE , resizeFadeImage);
    info_mc.title_txt.autoSize = TextFieldAutoSize.LEFT;
    if (presModeSlides)  // Setup slide viewer vars
        totalImages = slides[currentSlideNumber].numSlides
        imageDirectory = "Data/slides/"+slides[currentSlideNumber].directory+"/";
        filePrefix = "slide";
        info_mc.title_txt.text = slides[currentSlideNumber].title
        info_mc.speaker_txt.text = slides[currentSlideNumber].speaker
        info_mc.university_txt.text = slides[currentSlideNumber].university
    else  // Setup picture viewer vars
        totalImages = 233;
        imageDirectory = "Data/pictures/";
        filePrefix = "picture";
        info_mc.title_txt.text =  "3rd International BioPlex® 2200 User Meeting";
        info_mc.speaker_txt.text = "Pictures";
        info_mc.university_txt.text = "";
    info_mc.speaker_txt.y += info_mc.title_txt.height;  // Position sublines so they are directly under title
    info_mc.university_txt.y += info_mc.title_txt.height;
    leftArrow_btn.addEventListener(MouseEvent.CLICK, prevImage);
    rightArrow_btn.addEventListener(MouseEvent.CLICK, nextImage);
    showImage(currentImage)
    function showImage(num:int)
        if (pic_mc.getChildIndex(loader1) > pic_mc.getChildIndex(loader2))  // Place the jpg into which ever container is on top at the moment
            loader1.load(new URLRequest(imageDirectory+filePrefix+currentImage+".jpg"));
        else
            loader2.load(new URLRequest(imageDirectory+filePrefix+currentImage+".jpg"));
    function resizeFadeImage(e:Event)
        e.currentTarget.loader.alpha = 0;
        Tweener.addTween(e.currentTarget.loader, {alpha:1, time:0.4, onComplete: removeOtherImage , onCompleteParams:[e.currentTarget.loader]});
        e.currentTarget.loader.scaleX = 0.75;
        e.currentTarget.loader.scaleY = 0.75;
        var bitMap : Bitmap = Bitmap(e.currentTarget.loader.content);
        bitMap.smoothing = true;
    function removeOtherImage(l:Loader)
        if (l.name=="loader1")
            pic_mc.setChildIndex(loader1,0);
            if (loader2.content != null)
                if (loader2.content is Bitmap)
                    (loader2.content as Bitmap).bitmapData.dispose();
        else
            pic_mc.setChildIndex(loader2,0);
            if (loader1.content != null)
                if (loader1.content is Bitmap)
                    (loader1.content as Bitmap).bitmapData.dispose();
    function nextImage(e:Event)
        if ((!Tweener.isTweening(loader1)) && (!Tweener.isTweening(loader2)))
            if (currentImage < totalImages)
                currentImage ++;
            else
                currentImage = 1;
            showImage(currentImage);
    function prevImage(e:Event)
        if ((!Tweener.isTweening(loader1)) && (!Tweener.isTweening(loader2)))
            if (currentImage > 1)
                currentImage --;
            else
                currentImage = totalImages;
            showImage(currentImage);

    function resizeFadeImage(e:Event)
        e.currentTarget.loader.alpha = 0;
        Tweener.addTween(e.currentTarget.loader, {alpha:1, time:0.4, onComplete: removeOtherImage , onCompleteParams:[e.currentTarget.loader]});
        e.currentTarget.loader.scaleX = 0.75;
        e.currentTarget.loader.scaleY = 0.75;
    e.currentTarget.loader.x = (stage.stageWidth-e.currentTarget.loader.width)/2;
    e.currentTarget.loader.y = (stage.stageHeight-e.currentTarget.loader.height)/2;
        var bitMap : Bitmap = Bitmap(e.currentTarget.loader.content);
        bitMap.smoothing = true;

  • Noob needs help with Media Encoder Settings

    Hi All,
    Please be gentle with me. I am very new to this.
    I am using PPCS4 full version on which I am trying to edit and export video from my Canon HF 10 using their AVCHD format.
    The Mac is a MAC PRO 2 x QuadCore 3.0Ghz, 1 x 320GB SATA and 3 x 1TB SATA disks with a 30" Apple Cinema Display.
    I can import and see the video running in the source window, it can be a bit choppy but i am putting dowm to the lack of RAM (more the way). My real problem is that when I export the files the result is, well bad. I either get what appears to be a line effect every other line on the screen or by using other settings it appears grainy.
    My Cam should be recording in 1080i HD and i expect to be able to put this stuff on a DVD / Blue-Ray disk or file and see as good an image as I see in the viewfinder. This I cannot seem to do.
    Any ideas?
    Thanks
    J

    Hi
    I don't understand...please let me know...
    did media encoder work before and it just suddenly stopped working ?  Or  is this the first time you tried using it and it just doesnt work from  your original installation ?  In other words , did it EVER work for you using the HD ?
    What source material are you using ? In other words, what type of video.  MOV and AVI can have many different types of video inside those file extensions...they are called "wrappers" insomuch as they can have a lot of different "codecs" being used in the video.  Can you tell us what the video is that you're using when AME fails to work ?
    Also tell more about your computer setup...how many hard drives? Did you set up your system like recommended in many threads here in the forums ?
    There are a lot of really good and smart people here who can help you, but they need as much information as possible so they can begin to understand what is going on with your problem. It does take some time and work on your part to put all that info into a message, but it's worth it because most times problems are solved because of it.
    ps...not meant to be a criticism because you were angry about problem, but some people probably didnt respond to your trouble right away because of your initial mssg being a little bit scary..  most people here are just users like you and help each other. nobody wants to risk being yelled at or deal with someone who is just angry and isn't really supplying enough information to help solve the problem.  That's just my opinion, and I'm glad your response to my mssg was less angry sounding.  Whew !

  • Need help in displaying an Image in a JLabel

    Hi everyone,
    I am using a JLabel to display images on a particular screen. I am facing some problem while doing so..
    On my screen there are images of some garments. When the users select colors from a particular list, i should color this garment images and load it on the screen again with the colors. I have a floodfill class for filling the colors in the images. The problem I am facing is I am able to color the image properly with my floodfill class but when displaying the image on the same jlabel, the image gets distorted somehow.
    Everytime I color the image, I create an ImageIcon of the image and use the seticon method from the JLabel class. First I set the icon to null and then set it to the imageicon created. here is the code I use.
    If 'image' is the the image i have to load
    ImageIcon imgicon = new ImageIcon(image);
    jlabel.setIcon(null);
    jlabel.setIcon(imgicon);I am setting the icon to null because I have not found any other method to clear the previous image from the jlabel.
    Can anyone who has worked on images before and faced a similar situation help me with this?? Is there some other container I can use besides the JLabel to display the images perhaps?
    Thanks in advance.....
    Bharat

    And the thing is when I first go into that screen with the selected colors it is displaying the images perfectly.
    It is only giving problems when I pick different colors on the screenit really sounds like the problem is in your floodfill class.
    I have no idea what's in floodfill, but if you were e.g. using a JPanel and paintComponent,
    you would need to have as the first line in paintComponent()
    super.paintComponent(..);
    to clear the previous painting.
    if not, you would be just drawing over the top of the previous paintComponent(), and if the calculation of the
    painting area is not 100% exact, you may get the odd pixel not painted-over, meaning those pixels will display
    the old color.

Maybe you are looking for