Help with unloading images AS3

Please can anyone help me. I am new to Action Script and flash and am having a nightmare unloading images. The code below works but I keep getting the following error messages:
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/removeChild()
at index_fla::MainTimeline/clickSection()
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/removeChild()
at index_fla::MainTimeline/clickSection()
Any help with this would be much appreciated.
var ImgReq01:URLRequest=new URLRequest("images/home/01.jpg");
var ImgReq02:URLRequest=new URLRequest("images/home/02.jpg");
var ImgReq03:URLRequest=new URLRequest("images/home/03.jpg");
var ImgReq04:URLRequest=new URLRequest("images/home/04.jpg");
var ImgReq05:URLRequest=new URLRequest("images/home/05.jpg");
var imgList:Array=[ImgReq01,ImgReq02,ImgReq03,ImgReq04,ImgReq05];
var imgRandom = imgList[Math.floor(Math.random()* imgList.length)];
var imgLoader:Loader = new Loader();
imgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
imgLoader.load(imgRandom);
function onComplete(event:Event):void
  var randomImage:Bitmap = Bitmap(imgLoader.content);
  randomImage.x=187.4;
  randomImage.y=218.1;
  addChild(randomImage);
//handle events for info buttons...
information. addEventListener (MouseEvent.CLICK, clickSection);
home. addEventListener (MouseEvent.CLICK, clickSection);
galleries. addEventListener (MouseEvent.CLICK, clickSection);
function clickSection (evtObj:MouseEvent) {
//Trace shows what's happening.. in the output window
trace ("The "+evtObj.target.name+" button was clicked")
//go to the section clicked on...
gotoAndStop (evtObj.target.name)
// this line is causing errors when navigating between the gallery and information buttons
var Image:Bitmap = Bitmap(imgLoader.content);
  removeChild(Image);

you really should be adding the loader to the displaylist, not the content.
try:
var ImgReq01:URLRequest=new URLRequest("images/home/01.jpg");
var ImgReq02:URLRequest=new URLRequest("images/home/02.jpg");
var ImgReq03:URLRequest=new URLRequest("images/home/03.jpg");
var ImgReq04:URLRequest=new URLRequest("images/home/04.jpg");
var ImgReq05:URLRequest=new URLRequest("images/home/05.jpg");
var imgList:Array=[ImgReq01,ImgReq02,ImgReq03,ImgReq04,ImgReq05];
var imgRandom = imgList[Math.floor(Math.random()* imgList.length)];
var imgLoader:Loader = new Loader();
imgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
imgLoader.load(imgRandom);
function onComplete(event:Event):void
imgLoader.x=187.4;
imgLoader.y=218.1;
  addChild(imgLoader);
//handle events for info buttons...
information. addEventListener (MouseEvent.CLICK, clickSection);
home. addEventListener (MouseEvent.CLICK, clickSection);
galleries. addEventListener (MouseEvent.CLICK, clickSection);
function clickSection (evtObj:MouseEvent) {
//Trace shows what's happening.. in the output window
trace ("The "+evtObj.target.name+" button was clicked")
//go to the section clicked on...
gotoAndStop (evtObj.target.name)
// this line is causing errors when navigating between the gallery and information buttons
if(this.contains(imgLoader){
  removeChild(imgLoader);

Similar Messages

  • Help with unloading images

    Please can anyone help me. I am new to Action Script and flash and am having a nightmare unloading images. The code below works but I keep getting the following error messages:
    TypeError: Error #2007: Parameter child must be non-null.
    at flash.display::DisplayObjectContainer/removeChild()
    at index_fla::MainTimeline/clickSection()
    ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
    at flash.display::DisplayObjectContainer/removeChild()
    at index_fla::MainTimeline/clickSection()
    Any help with this would be much appreciated.
    var ImgReq01:URLRequest=new URLRequest("images/home/01.jpg");
    var ImgReq02:URLRequest=new URLRequest("images/home/02.jpg");
    var ImgReq03:URLRequest=new URLRequest("images/home/03.jpg");
    var ImgReq04:URLRequest=new URLRequest("images/home/04.jpg");
    var ImgReq05:URLRequest=new URLRequest("images/home/05.jpg");
    var imgList:Array=[ImgReq01,ImgReq02,ImgReq03,ImgReq04,ImgReq05];
    var imgRandom = imgList[Math.floor(Math.random()* imgList.length)];
    var imgLoader:Loader = new Loader();
    imgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
    imgLoader.load(imgRandom);
    function onComplete(event:Event):void
      var randomImage:Bitmap = Bitmap(imgLoader.content);
      randomImage.x=187.4;
      randomImage.y=218.1;
      addChild(randomImage);
    //handle events for info buttons...
    information. addEventListener (MouseEvent.CLICK, clickSection);
    home. addEventListener (MouseEvent.CLICK, clickSection);
    galleries. addEventListener (MouseEvent.CLICK, clickSection);
    function clickSection (evtObj:MouseEvent) {
    //Trace shows what's happening.. in the output window
    trace ("The "+evtObj.target.name+" button was clicked")
    //go to the section clicked on...
    gotoAndStop (evtObj.target.name)
    // this line is causing errors when navigating between the gallery and information buttons
    var Image:Bitmap = Bitmap(imgLoader.content);
      removeChild(Image);

    you really should be adding the loader to the displaylist, not the content.
    try:
    var ImgReq01:URLRequest=new URLRequest("images/home/01.jpg");
    var ImgReq02:URLRequest=new URLRequest("images/home/02.jpg");
    var ImgReq03:URLRequest=new URLRequest("images/home/03.jpg");
    var ImgReq04:URLRequest=new URLRequest("images/home/04.jpg");
    var ImgReq05:URLRequest=new URLRequest("images/home/05.jpg");
    var imgList:Array=[ImgReq01,ImgReq02,ImgReq03,ImgReq04,ImgReq05];
    var imgRandom = imgList[Math.floor(Math.random()* imgList.length)];
    var imgLoader:Loader = new Loader();
    imgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
    imgLoader.load(imgRandom);
    function onComplete(event:Event):void
    imgLoader.x=187.4;
    imgLoader.y=218.1;
      addChild(imgLoader);
    //handle events for info buttons...
    information. addEventListener (MouseEvent.CLICK, clickSection);
    home. addEventListener (MouseEvent.CLICK, clickSection);
    galleries. addEventListener (MouseEvent.CLICK, clickSection);
    function clickSection (evtObj:MouseEvent) {
    //Trace shows what's happening.. in the output window
    trace ("The "+evtObj.target.name+" button was clicked")
    //go to the section clicked on...
    gotoAndStop (evtObj.target.name)
    // this line is causing errors when navigating between the gallery and information buttons
    if(this.contains(imgLoader){
      removeChild(imgLoader);

  • Help with adding image onclick

    Hey everyone,
    I am making a simple game in AS3 and need help with adding an image once they have click on something.
    On the left of the screen are sentences and on the right an image of a form. When they click each sentence on the left, writing appears on the form. Its very simple. With this said, what I would like to do is once the user click one of the sentences on the left, I would like a checkmark image to appear over the sentence so they know they have already clicked on it.
    How would I go about adding this to my code?
    var fields:Array = new Array();
    one_btn.addEventListener(MouseEvent.CLICK, onClick1a);
    one_btn.buttonMode = true;
    function onClick1a(event:MouseEvent):void
        fields.push(new one_form());
        fields[fields.length-1].x = 141;
        fields[fields.length-1].y = -85;
        this.addChild(fields[fields.length-1]);   
        one_btn.removeEventListener(MouseEvent.CLICK, onClick1a);
        one_btn.buttonMode = false;
        //gotoAndStop("one")
    two_btn.addEventListener(MouseEvent.CLICK, onClick2a);
    two_btn.buttonMode = true;
    function onClick2a(event:MouseEvent):void
        fields.push(new two_form());
        fields[fields.length-1].x = 343.25;
        fields[fields.length-1].y = -85;
        this.addChild(fields[fields.length-1]);
        two_btn.removeEventListener(MouseEvent.CLICK, onClick2a);
        two_btn.buttonMode = false;
        //gotoAndStop("two")

    I don't know where you're positioning the button that should enable/disable the checkbox but for "one_btn" let's just say it's at position: x=100, y=200. Say you'd want the checkbox to be to the left of it, so the checkbox would be displayed at: x=50, y=200. Also say you have a checkbox graphic in your library, exported for actionscript with the name "CheckBoxGraphic".
    Using your code with some sprinkles:
    // I'd turn this into a sprite but we'll use the default, MovieClip
    var _checkBox:MovieClip = new CheckBoxGraphic();
    // add to display list but hide
    _checkBox.visible = false;
    // just for optimization
    _checkBox.mouseEnabled = false;
    _checkBox.cacheAsBitmap = true;
    // adding it early so make sure the forms loaded don't overlap the
    // checkbox or it will cover it, otherwise swapping of depths is needed
    addChild(_checkBox);
    // I'll use a flag (a reference for this) to know what button is currently pushed
    var _currentButton:Object;
    one_btn.addEventListener(MouseEvent.CLICK, onClick1a);
    one_btn.buttonMode = true;
    function onClick1a(event:MouseEvent):void
         // Check if this button is currently the pressed button
         if (_currentButton == one_btn)
              // disable checkbox, remove form
              _checkBox.visible = false;
              // form should be last added to fields array, remove
              removeChild(fields[fields.length - 1]);
              fields.pop();
              // clear any reference to this button
              _currentButton = null;
         else
              // enable checkbox
              _checkBox.visible = true;
              _checkBox.x = 50;
              _checkBox.y = 200;
              // add form
              fields.push(new one_form());
              fields[fields.length-1].x = 141;
              fields[fields.length-1].y = -85;
              this.addChild(fields[fields.length-1]);
              // save this button as last clicked
              _currentButton = one_btn;
         // not sure what this is
        //gotoAndStop("one")
    I'd also centralize all the click handlers into a single handler and use the buttons name to branch on what to do, but that's a different discussion. Just see if this makes sense to you.
    The jist is a graphic of a checkbox that is a MovieClip symbol in your library exported to actionscript with the class name CheckBoxGraphic() is created and added to the display list.
    I made a variable that points itself to the last clicked button, when the "on" state is desired. If I detect the last clicked button was this button, I remove the form I added and the checkbox. If the last clicked button is not this button, I enable and position the checkbox as well as add the form.
    What is left to do is handle the sitation where multiple buttons are on the screen. When a new button is pushed it should remove anything the previous button added. This code simply demonstrates clicking the same button multiple times to toggle it "on and off".

  • Server goes out of memory when annotating TIFF File. Help with Tiled Images

    I am new to JAI and have a problem with the system going out of memory
    Objective:
    1)Load up a TIFF file (each approx 5- 8 MB when compressed with CCITT.6 compression)
    2)Annotate image (consider it as a simple drawString with the Graphics2D object of the RenderedImage)
    3)Send it to the servlet outputStream
    Problem:
    Server goes out of memory when 5 threads try to access it concurrently
    Runtime conditions:
    VM param set to -Xmx1024m
    Observation
    Writing the files takes a lot of time when compared to reading the files
    Some more information
    1)I need to do the annotating at a pre-defined specific positions on the images(ex: in the first quadrant, or may be in the second quadrant).
    2)I know that using the TiledImage class its possible to load up a portion of the image and process it.
    Things I need help with:
    I do not know how to send the whole file back to servlet output stream after annotating a tile of the image.
    If write the tiled image back to a file, or to the outputstream, it gives me only the portion of the tile I read in and watermarked, not the whole image file
    I have attached the code I use when I load up the whole image
    Could somebody please help with the TiledImage solution?
    Thx
    public void annotateFile(File file, String wText, OutputStream out, AnnotationParameter param) throws Throwable {
    ImageReader imgReader = null;
    ImageWriter imgWriter = null;
    TiledImage in_image = null, out_image = null;
    IIOMetadata metadata = null;
    ImageOutputStream ios = null;
    try {
    Iterator readIter = ImageIO.getImageReadersBySuffix("tif");
    imgReader = (ImageReader) readIter.next();
    imgReader.setInput(ImageIO.createImageInputStream(file));
    metadata = imgReader.getImageMetadata(0);
    in_image = new TiledImage(JAI.create("fileload", file.getPath()), true);
    System.out.println("Image Read!");
    Annotater annotater = new Annotater(in_image);
    out_image = annotater.annotate(wText, param);
    Iterator writeIter = ImageIO.getImageWritersBySuffix("tif");
    if (writeIter.hasNext()) {
    imgWriter = (ImageWriter) writeIter.next();
    ios = ImageIO.createImageOutputStream(out);
    imgWriter.setOutput(ios);
    ImageWriteParam iwparam = imgWriter.getDefaultWriteParam();
    if (iwparam instanceof TIFFImageWriteParam) {
    iwparam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
    TIFFDirectory dir = (TIFFDirectory) out_image.getProperty("tiff_directory");
    double compressionParam = dir.getFieldAsDouble(BaselineTIFFTagSet.TAG_COMPRESSION);
    setTIFFCompression(iwparam, (int) compressionParam);
    else {
    iwparam.setCompressionMode(ImageWriteParam.MODE_COPY_FROM_METADATA);
    System.out.println("Trying to write Image ....");
    imgWriter.write(null, new IIOImage(out_image, null, metadata), iwparam);
    System.out.println("Image written....");
    finally {
    if (imgWriter != null)
    imgWriter.dispose();
    if (imgReader != null)
    imgReader.dispose();
    if (ios != null) {
    ios.flush();
    ios.close();
    }

    user8684061 wrote:
    U are right, SGA is too large for my server.
    I guess oracle set SGA automaticlly while i choose default installion , but ,why SGA would be so big? Is oracle not smart enough ?Default database configuration is going to reserve 40% of physical memory for SGA for an instance, which you as a user can always change. I don't see anything wrong with that to say Oracle is not smart.
    If i don't disincrease SGA, but increase max-shm-memory, would it work?This needs support from the CPU architecture (32 bit or 64 bit) and the kernel as well. Read more about the huge pages.

  • Help with partial image loss from Viewer to Canvas

    Hi--I'm brand new to FCP and would really appreciate any help with my problem. I'm creating 2 second video clips composed of four still images (15 frames...or 500ms each) laid back to back, then rendered. Very simple, I know. The individual images are tiff files that look great in the FCP Viewer. But in the Canvas, part of the image is missing. Specifically, in the center of each image there should be a + sign, about 1cm square. This + should remain constant thoughout the short movie, while the items around it vary (from image to image). (This is a psychology experiment, and the center + is a fixation cross.) The problem is that in the Viewer the + sign is intact, but in the Canvas (and the resulting rendered video), only the vertical bar of the + is present! This is true for every individual tiff, and for the resulting movie. The items around the fixation cross are fine. My question is WHY on earth does the central horizontal bar get "lost" between the Viewer and the Canvas? I've read the manuals, but obviously I've got something set wrong. Also, there is a considerable overall reduction in quality between the viewer and canvas, even though I'm trying my best to maximize video quality. Everything looks a bit blurry. Truly, all ideas are welcome. Sorry if it's obvious. Thanks.
    G5   Mac OS X (10.4.3)  

    steve, i'm viewing on my 23" cinema screen. i read up on quality and know that this is a no-no; that i should only judge quality when viewing on an ntsc monitor or good tv. the problem is that i'll ultimately be displaying these videos on my Dell LCD, so i've got to maximize what i've got. thanks to the discussion boards i have a short list of things to try now. thanks!
    -heather

  • Seeking Help with Album Image Issues in iPod Classic

    Hi folks -
    I have a new 160 iPod Classic and have two album image-related issues I'd appreciate some help with.
    In the case of several albums where I'd associated my own art with them in iTunes, the formatting appeared off in my iPod due to the vertical/horizontal proportions. So I corrected the images, replaced the images via iTunes, and re-synced. All of the old images were replaced - except for two. Is there any way to get my iPod to recognize the change to these two images, as it did for all the others?
    Secondly, my "The Allman Brothers Band Live at Fillmore East" album was appearing twice in both the Cover Flow and Album list. That was strange, except that after the latest sync it now appears six times! It's only in one place in iTunes, and not erroneously set as a compilation or anything. This is the only album displaying this behavior...
    Thanks for any suggestions or advice!
    Frank
    Message was edited by: frank3si

    Yes my e-mail address is [email protected] 
    Thank you for your kind attention to my problem. I am looking for one on one brief consultation with my laptop in Cincinnati. If not then I will compose a clear question with VI.
    These manuals are well known to me NI Visions Concepts ManualIMAQ Vision for LaVIEW User ManuelNI-IMAQ for USB Cameras My problem is moving to the next step of Create an array of USB imagePerform math on array Display results Sincerely,Tom Lohre cell 513-236-1704, [email protected] http://tomlohre.com/images/lafley.jpgAG Lafley, Chairman & CEO of Proctor & Gamble http://tomlohre.com/lafley.htm A.G. Lafley enjoyed hearing of Tom's painting robot and thought it played well to his new book: "The Game-Changer: How You Can Drive Revenue and Profit Growth With Innovation." http://tomlohre.com/newart.htm
    Tom Lohre artist/scientist
    Has a operating painting robot using RoboLab/RCX
    Developing a LabView/ NXT robot that analyzes an image for aesthetic quality.

  • Need some help with ".png" image.

    Good day everyone. Here's the run down. I need to add an
    image (image "A") ontop of another image (image"B"). Image "B" is a
    paterned background. And Image "A" a logo with a transparent
    background.
    As it stands I have image "A" as a "png" and as you know....
    they are fri**ing huge! Haveing it as a "gif" only presents me with
    the IE6 problem of it adding a colored background to the image.
    So I'm stuck! Can any one tell me or point me in the
    difection of a tutorial to tell me the best way to add an image
    with a transparent background in Dreamweaver.
    Really need some help with this!
    Thanks all!

    >Right you can see the work in progress here>
    http://www.stclairecreative.com/DoughBoys_Site_Folder/home.html
    Before going much further I'd recommend reconsidering the use
    of a textured background. They are usually included for the benefit
    of the site owner only, and likely to annoy visitors. Studies on
    the subject suggest they often lead to usability problems. I do
    like to header graphic, but at 200K it's kinda heavy and can
    probably be optimized.

  • Help with swap images using rollovers

    I have a website created using DW CS5. Recently purchased FW CS5 to help with web graphics and design. I am trying to create a list of numbers that will swap with images. The intial page would simply be a list of numbers and 1 static image. Each number, when hovered will change the image with another. I've attempted this by first using DW and not having much success with FW either.
    If able to complete this using FW, is it possible to export the file for use in DW? Then insert into an AP Div?

    You're over-complicating it.
    Simply hit File>Save once you're done in photoshop.
    ian

  • Need help with adding images option

    I was using the add images option a few weeks ago just fine.. using my tablet and uploading the images via usb. then all of the sudden it stopped working.
    please help with this issue.
    Danny

    A few questions. What result are you experiencing? Did PS Touch crash? Have you tried to force quit-and restart PS Touch? -Guido

  • Help with exporting images

    HI
    I have recently shot a wedding with two bodies.  Forgot to sync the bodies before hand and so left with images at massively different times.  in lightroom i then changed to view by capture time and amended all the wrongly timed images.  i am then left with all images in order and looking as i want.  I then put them in a catalogue and a collection to be on the safe side and exported both.  Whatever i do i see the exported images in my pictures in the same order they were in before i changed the capture time.  i have tried to research this until im sick of it.  I just cant figure out what is going wrong.  Just tried to save to dvd instead and saved but again in the order pre correction?  please help

    Hi did that this morning .  I'm viewing in the exported named file in a
    folder on the mac ... I've tried re naming , sort by capture time but the
    minute I export , the exported file looks just the same as before I made
    the capute time amendments .
    Thanks
    Kim

  • Beginner needs help with inserting images in applet.

    //  Name: Sachit Harish
    //  Name of Program: HorseRacing
    //  Date Started: May 15, 2003
    //  Date Finished: 2003
    //  Program Description:
    import java.awt.*;
    import java.applet.*;
    public class HorseRacing extends Applet
    //     Button startGameButton;
         InputField betAmountBox;
         Image redHorse; //<---------//
    //     Button[] drawings = new Button[4];      
    //    String[] labels =  {"Face", "Cheese", "Stick", "Mashed Potatoes"};
        //  Method Name: init()
        //  Parameters Passed: None
        //  Data Returned: None
        //  Method Purpose: Where we initialise the InputBoxes and colors.
        public void init()         
          //     startGameButton=new Button("Click to Start Game");
          //     add(startGameButton);
          /*  for(int i=0; i<drawings.length; i++)
                 drawings=new Button (labels[i]);     
         add(drawings[i]);
    inputBoxes();     
    setBackground(Color.gray); //background color
    setForeground(Color.black); //input field text color
    redHorse = getImage(getCodeBase(), "horse_red.GIF"); //<---------//
    // Method Name: paint()
    // Parameters Passed: Graphics variable screen
    // Data Returned: None
    // Method Purpose: Where the programs calls and collects all the methods.
    //                         If high and low are not integers, an error message
    //                         appears.
    public void paint(Graphics screen)
         //screen.drawString("HORSE RACES!!!!!", 40,60);
         //startGameButton.move(50,300);
         betAmountBox.setPosition(115,200);
         startGame();
         if(betAmountBox.isInt())
              int betAmount=getBetAmount();
         else
    screen.drawString("ERROR: You have not entered an Integer!", 10,110);
    screen.drawString(" Please correct your mistake.", 40,125);
         /*int xPos=10;
         int yPos=10;
         for(int i=0; i<drawings.length; i++)
              drawings[i].move(xPos,yPos);
              xPos+=60;
         screen.drawString("Click each button and get a surprise!", 10,50);*/
    // Method Name: inputBoxes()
    // Parameters Passed: None
    // Data Returned: None
    // Method Purpose: Where we initialise the inputboxes, set the size of
    // the InputField and adds it to the screen. Also
    // initialises the InputField to start with 1's
    void inputBoxes()
    betAmountBox = new InputField(5);
    add(betAmountBox);
    betAmountBox.initialise(50);
    // Method Name: getBetAmount()
    // Parameters Passed: Variable number
    // Data Returned: None
    // Method Purpose: Returns the variable number back to the paint()
    int getBetAmount()
    int betAmount=betAmountBox.toInt();
    return betAmount;
    // Method Name: action()
    // Parameters Passed: Event variable evt, Object varible obj
    // Data Returned: Variable true
    // Method Purpose: This block responds when the user takes an action
    // (such as hitting the return key). It causes the paint
    // block to be done again
    public boolean action(Event evt, Object arg)
    Graphics screen=getGraphics();
    if(evt.target instanceof Button)
         if(arg=="Click to Start Game")
              screen.clearRect(0,0,600,600);
              startGame();
    /*if(evt.target instanceOf Button)
                   if(arg=="Face")
                        screen.clearRect(5,55,400,400);
                        faceDrawing();
                   else if (arg=="Cheese")
                        screen.clearRect(5,55,400,400);
                        cheeseDrawing();
                   else if (arg=="Stick")
                        screen.clearRect(5,55,400,400);
                        stickDrawing();
                   else if (arg=="Mashed Potatoes")
                        screen.clearRect(5,55,400,400);
                        potatoeDrawing();
    return true;
    void startGame()
    Graphics screen=getGraphics();
              //Horse Racing Box
              screen.drawRect(10,10,505,120);
              screen.drawLine(60,10,60,130);
              screen.drawLine(10,40,515,40);
              screen.drawLine(10,70,515,70);
              screen.drawLine(10,100,515,100);               
              screen.setColor(Color.red);
              screen.fillRect(11,11,49,29);
              screen.setColor(Color.yellow);
              screen.fillRect(11,41,49,29);
              screen.setColor(Color.blue);
              screen.fillRect(11,71,49,29);
              screen.setColor(Color.orange);
              screen.fillRect(11,101,49,29);
              screen.setColor(Color.black);
              //Betting Box          
              screen.drawRect(10,150,280,100);     
              screen.drawLine(10,185,290,185);
              screen.drawLine(80,150,80,185);
              screen.drawLine(150,150,150,185);
              screen.drawLine(220,150,220,185);
              screen.setColor(Color.red);
              screen.fillRect(11,151,69,34);
              screen.setColor(Color.yellow);
              screen.fillRect(81,151,69,34);
              screen.setColor(Color.blue);
              screen.fillRect(151,151,69,34);
              screen.setColor(Color.orange);
              screen.fillRect(221,151,69,34);
              screen.setColor(Color.black);
              screen.drawString("BET = ", 40,230);
    screen.drawImage(redHorse, 200,200,300,300,this); //<---------//      
    The picture an't showing up... why? First time trying to insert images. (I made arrows where I did stuff with the image.)
    -sachit

    BTW, ignore the buttons and stuff. I just quickly grabbed this file from an earlier button program. :p
    -sachit

  • Help with buttons in AS3

    Hi Folks,
    I'm stuck with a simple flash movie I need to create in which two images fade in and fade out, and each of them must be clickable and hyperlink to a separate URL.
    I've got the fading going okay, but I cannot for the life of me get even a single button to work on it.
    If it's helpful I can send along what I've got so far.  Any assistance would be greatly appreciated.
    Regards,
    Andrew.

    Hi Ned,
    Thank you for the followup email.
    I think I was close - I was aware of the changes between AS2 and AS3, but I
    think I was putting the Action in the wrong place.
    Next question - if I have 2 buttons (say btn1 and btn2), how do I make btn1
    available for say frames 1-60, and btn2 available from frames 61-120?
    I am primarily a ColdFusion developer, and a complete newbie to flash, so
    sorry if this is a dumb question.
    Regards,
    Andrew.
    2009/5/15 Ned Murphy <[email protected]>
    In AS3, to make a button work with code, you need to add an event listener
    for it.  In the timeline that holds that button, in a separate actions layer
    that you create, in a frame numbered the same as where that button exists,
    you would add the event listener:
    >
    btn1.addEventListener(MouseEvent.CLICK, btn1Click);
    >
    Descriptively, that line of code contains the following:
    >
    buttonInstanceName . displayObjectMethod (eventClass . eventType,
    eventHandlerFunction);
    >
    The name of the function for processing the clicking of that button was
    already defined at the end of the event listener assignment, so now you just
    have to write that function out:
    >
    function btn1Click(evt:MouseEvent):void {
       var /String = "http://www.awebsite.com/awebpage.html";
       var req:URLRequest = new URLRequest(url);
       navigateToURL(req);
    >

  • Help with getting Images to show in a Rock, Paper, Scissors game

    Hi
    I am working on this Rock, paper, scissors java game and the program works, but I can not figure out how to get the images to load onto the program. So my question is how do I get the images to load up with the program? I am using JCreator for this project. I have created the Basic Java Application project, and then added in the 3 .java files that I need to run the program, but I just can not figure out how or where I need to upload the files. The game works without the images, but I would really like them to show up.
    This is the .java file that calls up the images:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class pss extends JPanel implements ActionListener, ItemListener
    private final Color clrBackground = new Color(163,243,255);
    private final Color clrForeground = new Color(0,0,0);
    private JComboBox cboxWeapon;
    private JTextField txtCPUWeapon, txtWins, txtLoses, txtDraws;
    private JLabel lblPlayerWeapon, lblCPUWeapon, lblWins, lblLoses, lblDraws, lblStatus, lblPlayerWeaponIcon, lblCPUWeaponIcon;
    private JButton cmdPlay, cmdReset;
    private ImageIcon[] imgWeapon;
    private JPanel panRoot, panPlayerArea, panPlayerWeapon, panCPUArea, panCPUWeapon, panStatusArea, panGo, panCounters, panWins, panLoses, panDraws;
    private pssEngine engine = new pssEngine();
    private objCreateAppletImage createImage = new objCreateAppletImage();
    private boolean errorWithImages = false;
    public static void main(String[] args) //With applications, you have to specify a main method (not with applets)
    JFrame.setDefaultLookAndFeelDecorated(true); //Make it look nice
    JFrame frame = new JFrame("Paper Stone Scissors"); //Title
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setResizable(false); //Stops the user resizing the window
    JComponent paneMain = new pss();
    paneMain.setOpaque(true);
    paneMain.setPreferredSize(new Dimension(420,350));
    frame.setContentPane(paneMain);
    frame.pack();
    frame.setVisible(true);
    public pss ()
    cboxWeapon = new JComboBox(engine.getWeapon());
    cboxWeapon.addItemListener(this);
    txtCPUWeapon = new JTextField(engine.getStrCPUWeapon(), 5);
    txtWins = new JTextField("0", 5);
    txtLoses = new JTextField("0", 5);
    txtDraws = new JTextField("0", 5);
    txtCPUWeapon.setEditable(false);
    txtWins.setEditable(false);
    txtLoses.setEditable(false);
    txtDraws.setEditable(false);
    lblPlayerWeapon = new JLabel("Choose your weapon", JLabel.CENTER);
    lblCPUWeapon = new JLabel("The CPU's weapon", JLabel.CENTER);
    lblWins = new JLabel("Amount of wins:", JLabel.RIGHT);
    lblLoses = new JLabel("Amount of loses:", JLabel.RIGHT);
    lblDraws = new JLabel("Amount of Drawss:", JLabel.RIGHT);
    lblStatus = new JLabel("", JLabel.CENTER);
    lblPlayerWeaponIcon = new JLabel("", JLabel.CENTER);
    lblCPUWeaponIcon = new JLabel("", JLabel.CENTER);
    lblPlayerWeaponIcon.setPreferredSize(new Dimension(150,150));
    lblCPUWeaponIcon.setPreferredSize(new Dimension(150,150));
    cmdPlay = new JButton("Go!");
    cmdReset = new JButton("Restart");
    cmdPlay.addActionListener(this);
    cmdReset.addActionListener(this);
    try
    imgWeapon = new ImageIcon[3];
    for (int i = 0; i < 3; i++)
    imgWeapon[i] = createImage.getImageIcon(this, ".src/images/" + engine.getWeapon(i) + ".gif", "Icon for " + engine.getWeapon(i), 13000);
    lblPlayerWeaponIcon.setIcon(imgWeapon[0]);
    lblCPUWeaponIcon.setIcon(imgWeapon[0]);
    catch (Exception ex) //The game works without the images, so carry on
    errorWithImages = true;
    setLayout(new BorderLayout());
    panRoot = new JPanel(new BorderLayout());
    panPlayerArea = new JPanel(new BorderLayout());
    panPlayerWeapon = new JPanel(new BorderLayout());
    panCPUArea = new JPanel(new BorderLayout());
    panCPUWeapon = new JPanel(new BorderLayout());
    panStatusArea = new JPanel(new BorderLayout());
    panGo = new JPanel();
    panCounters = new JPanel(new GridLayout(3,1,2,2));
    panWins = new JPanel();
    panLoses = new JPanel();
    panDraws = new JPanel();
    add(panRoot, BorderLayout.CENTER);
    panRoot.add(panPlayerArea, BorderLayout.WEST);
    panPlayerArea.add(panPlayerWeapon, BorderLayout.NORTH);
    panPlayerWeapon.add(lblPlayerWeapon, BorderLayout.NORTH);
    panPlayerWeapon.add(cboxWeapon, BorderLayout.SOUTH);
    panPlayerArea.add(lblPlayerWeaponIcon, BorderLayout.SOUTH);
    panRoot.add(panCPUArea, BorderLayout.EAST);
    panCPUArea.add(panCPUWeapon, BorderLayout.NORTH);
    panCPUWeapon.add(lblCPUWeapon, BorderLayout.NORTH);
    panCPUWeapon.add(txtCPUWeapon, BorderLayout.SOUTH);
    panCPUArea.add(lblCPUWeaponIcon, BorderLayout.SOUTH);
    panRoot.add(panStatusArea, BorderLayout.SOUTH);
    panStatusArea.add(panGo, BorderLayout.NORTH);
    panGo.add(cmdPlay);
    panGo.add(cmdReset);
    panGo.add(lblStatus);
    panStatusArea.add(panCounters, BorderLayout.SOUTH);
    panCounters.add(panWins);
    panWins.add(lblWins);
    panWins.add(txtWins);
    panCounters.add(panLoses);
    panLoses.add(lblLoses);
    panLoses.add(txtLoses);
    panCounters.add(panDraws);
    panDraws.add(lblDraws);
    panDraws.add(txtDraws);
    panRoot.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
    setBackground(clrBackground);
    panRoot.setBackground(clrBackground);
    panPlayerArea.setBackground(clrBackground);
    panPlayerWeapon.setBackground(clrBackground);
    panCPUArea.setBackground(clrBackground);
    panCPUWeapon.setBackground(clrBackground);
    panStatusArea.setBackground(clrBackground);
    panGo.setBackground(clrBackground);
    panCounters.setBackground(clrBackground);
    panWins.setBackground(clrBackground);
    panLoses.setBackground(clrBackground);
    panDraws.setBackground(clrBackground);
    lblPlayerWeapon.setForeground(clrForeground);
    lblCPUWeapon.setForeground(clrForeground);
    lblWins.setForeground(clrForeground);
    lblLoses.setForeground(clrForeground);
    lblDraws.setForeground(clrForeground);
    txtWins.setForeground(clrForeground);
    txtLoses.setForeground(clrForeground);
    txtDraws.setForeground(clrForeground);
    txtCPUWeapon.setForeground(clrForeground);
    public void reset ()
    cboxWeapon.setSelectedIndex(0);
    lblStatus.setText("");
    engine.reset();
    public void actionPerformed (ActionEvent e)
    if (e.getSource() == cmdReset)
    reset();
    else
    lblStatus.setText(engine.play(cboxWeapon.getSelectedIndex()));
    txtCPUWeapon.setText(engine.getStrCPUWeapon());
    txtWins.setText(Integer.toString(engine.getWins()));
    txtLoses.setText(Integer.toString(engine.getLoses()));
    txtDraws.setText(Integer.toString(engine.getDraws()));
    if (!errorWithImages)
    lblCPUWeaponIcon.setIcon(imgWeapon[engine.getCPUWeapon()]);
    public void itemStateChanged (ItemEvent e)
    if (!errorWithImages)
    lblPlayerWeaponIcon.setIcon(imgWeapon[cboxWeapon.getSelectedIndex()]);
    }Here is the other .java file that calls on the Images:
    import java.awt.*;
    import java.io.*;
    import javax.swing.ImageIcon;
    public class objCreateAppletImage
    public void objCreateAppletImage ()
    //If an error occurs (or is thrown by me) it will be thrown to the next level up, and either caught or thrown
    public ImageIcon getImageIcon (Object parentClass, String path, String description, int fileSize) throws Exception
    int count = 0;
    BufferedInputStream imgStream = new BufferedInputStream(parentClass.getClass().getResourceAsStream(path));
    byte buff[] = new byte[fileSize];
    if (imgStream == null) //If doesn't exist
    throw new Exception("File not Found");
    try
    count = imgStream.read(buff);
    imgStream.close(); //Closes the stream
    catch (IOException ex)
    throw new Exception("Corrupt file");
    return new ImageIcon(Toolkit.getDefaultToolkit().createImage(buff), description); //Creates the image from the byte array
    }Could someone please help me? I really have no idea and I would like this to work.
    Thank you
    Frank

    Oh, thank you. I will not do that in the future.
    I am not entirely sure how I would use the getImage method in an Applet. I would prefer to just use the code that I have currently, unless the addition of making the program an Applet only adds a small amount of code. But then even still, I am not entirely sure what I would write in the .class file to make the images load. And then I would not really know how to properly incorporate the pss.java file and the .class file together so they read off of each other.

  • New to AI and need help with individual images

    Hi,
    A client sent me her website mock up as an .eps file.  I can open that in Illustrator but I'm having a hard time "grabbing" the individual images and putting them into Fireworks and then ultimately they need to make their way to Dreamweaver (I know how to do that part!)
    Can I get some help on saving the individual images in the design so that I can use them again?
    Thanks
    Debi

    It's important to note you don't have to use any other app. But if you're unfamiliar with Ai, it may be easier.
    If you've got an item you can't seem to select in Ai you need to check if it's locked, the layer's panel should show a little lock next to any locked object. That's another one of those questions that's practically impossible to answer effectively without seeing the file.

  • Help with Blog image

    Hello BC gurus....
    I have a blog set up on a site of mine:
    http://nganet.businesscatalyst.com/nga-blog
    Quick easy question for all.. With the "{tag_blogpostbody}" in the list layout... Can you set this to display an image with the preview of the copy to then click through to read more?
    No matter what i do i can only get the image to display on the full tag.. I've tried "{tag_blogpostbody,600,... Read More}" but if i do that the image doesn't display.
    Any help and suggestions would be awesome.

    Liam,
    If i do that then it renders the image as the first para and then only displays the "... Read More". I want the image not as the article preview. See the attached.
    Is this a massive fail for BC. Surely there is a way to insert an hero image for article lists without java or additional coding.
    cheers
    Shane

Maybe you are looking for

  • Lost partition

    Hi, I wanted to dual boot ubuntu, so started partitioning my HD. I gave the new one 40gb, and started the process. During the process the system froze, and a message to reboot showed up, and since I couldn't do anything else, followed the instruction

  • Electronic Signatures for my company

    Hello, I am currently researching how to convert my companies practice from printing forms to using electronic forms. I'm wondering what's the best way to create and distribute electronic signature to every user on our network. I do not want people t

  • Problems replacing a nokia 6230i on a BMW 525i

    I will try to be brief. Having recently purchased a BMW 525i the car comes with a standard Nokia 62301 I was forced to abandon my Sony Erricsons K700i and P900i as they would not work with the included car kit. The 6230i broke down after 3 months and

  • Hardware best suited (Windows) to run Photoshop?

    I am looking at upgrading my system to run Photoshop/Lightroom. I was looking at a AMD system with an FX-6300 processor (8 cores), 12gb of memory and the R9 255 graphics card w/ 2mb of dedicated memory. Will this system run those programs quickly and

  • Audio direkt aus Premiere Pro 1.5 mit Audition 1.5 öffnen

    Laut Handbuch Audition lassen sich Audio- und Videodateien direkt aus PPro mit Audition öffnen und bearbeiten (In PPro Menü Bearbeiten/Original bearbeiten). Audition ist entsprechend eingestellt, doch wenn ich die Funktion in PPro ausführe, öffnet si