Button of Image first loading?

Hi,
i've written a piece of code and it works fine accept for one thing! :S When the applet has started, only the image is visible and the button appears when you click on the area where it should be.
I've tried to add the imagePanel to the getContentPane before adding the button, but then the button becomes as big as the applet window! So that doesn't work either. Can somebody help me?
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import java.net.*;
import java.applet.*;
import javax.swing.*;
import javax.swing.event.*;
public class PaintDemo4 extends JApplet implements ActionListener {
     JButton colorChangeButton;
     ImagePanel imagePanel;
     static String imageFile = "Ruimte.jpg";
     public PaintDemo4() {
          colorChangeButton = new JButton();
          colorChangeButton.setBackground(Color.red);
          colorChangeButton.setBounds(50, 50, 100, 40);
          colorChangeButton.addActionListener(this);
          getContentPane().add(colorChangeButton);
          Image image = Toolkit.getDefaultToolkit().getImage(PaintDemo4.imageFile);
          imagePanel = new ImagePanel(image);
          imagePanel.setBounds(0,0,477,323);
          getContentPane().add(imagePanel);
     class ImagePanel extends JPanel {
          Image image;
          public ImagePanel(Image image){
               this.image = image;
          public void paintComponent(Graphics g){
               super.paintComponent(g);
               g.drawImage(image, 0, 0, this);
     // button click switches between red & green (does nothing for now)
     public void actionPerformed(ActionEvent e) {
}

The JApplet's default layout manager is a BorderLayout. By calling twice the getContentPane().add() method without specifying the location, your button and your image are both placed in the central part of your applet.
Try this:
getContentPane().add("North", colorChangeButton);
getContentPane().add("Center", imagePanel);

Similar Messages

  • Flash button with images

    hi,
    I want to create a flash button,& for the button
    different images should load for press & release events. also I
    want to reuse this button. Please can someone tell me how to do
    that

    you'll need to use server-side scripting to handle part of the file upload and the file name retrieval from the upload folder.  assigning the uploaded files names you'll do from flash.  you'll use another script to retrieve the file names and in flash load and display which ever subset you want.

  • How to to get Struts Action at very first loading

    Hi, All;
    I was working on Jsp with Struts framework, I do not know how to get the Struts action to run during the very first loading if it is no submit buttons.
    When first load of page, I'd like to retrieve data from Action class (or other class) with request, then drop it to request attributes or create a bean.
    Because, normally Action class will be invoked in submit on page form which predefined in config files, but my page should get data from class with request at very first loading (without button submit), so can anyone know the way to do this kind of things? Is there other thing need to do in strust-config.xml. I really appreciate your ideas or examples.

    Sure. In the url just call that Action's path (e.g /app/myAction.do) which will first fill the data and then send to the desired JSP.
    Click Here
    When the user clicks on the link the Action would be automatically called. And you can do whatever you need in the Action.

  • How do I get a image to load first on website?

    Not sure if this is possible, but I have created a website
    and I have a image as the background. The only problem is that all
    the other iamges load up before the background. How can I get the
    background image to load first (so the viewer, when visiting the
    site for the first time, sees the background image first) before
    the other images load? Is this possible?

    > Not sure if this is possible, but I have created a
    website and I have a
    > image
    > as the background. The only problem is that all the
    other iamges load up
    > before
    > the background. How can I get the background image to
    load first (so the
    > viewer, when visiting the site for the first time, sees
    the background
    > image
    > first) before the other images load? Is this possible?
    Possible? Probably. Practical? No. Necessary? No.
    I'd suggest making your background COLOR a tone that reflects
    the image to
    some extent. Then, make sure you REALLY compress that
    background image.
    -Darrel

  • How to specify SWF instead of an image in loading

    I hope it is not too much over my head as I would like to make it work. Some time ago I recieved help in constracting an interactive image thumb scroller using greensock features.
    My biggest problem at the moment is that I can not figure out how to change the code so the thumbs would bring up the swf files and not jpg files. In other words my small thumbnails are small jpg files (as they were intended to be), but my bigger visuals (the ones which are being brought by clicking on the small thumbnails) I would like to change to an swf file (as it contains its separate animation and additional set of buttons)
    Here is the original code I am trying to modify:
    [CODE]
    package {
    import com.greensock.TweenLite;
    import com.greensock.events.LoaderEvent;
    import com.greensock.loading.ImageLoader;
    import com.greensock.loading.LoaderMax;
    import com.greensock.loading.XMLLoader;
    import com.greensock.plugins.AutoAlphaPlugin;
    import com.greensock.plugins.ColorTransformPlugin;
    import com.greensock.plugins.GlowFilterPlugin;
    import com.greensock.plugins.TweenPlugin;
    import flash.display.MovieClip;
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.events.MouseEvent;
    public class SlideshowExample extends MovieClip {
      private static const _THUMB_WIDTH:Number = 100;
      private static const _THUMB_HEIGHT:Number = 64;
      private static const _IMAGE_WIDTH:Number = 550;
      private static const _IMAGE_HEIGHT:Number = 355;
      private static const _THUMB_GAP:Number = 4;
      private static const _SCROLL_SPEED:Number = 12;
      private static const _SCROLL_AREA:Number = 150;
      private var _progressBar:MovieClip;
      private var _arrowLeft:MovieClip;
      private var _arrowRight:MovieClip;
      private var _slides:Array;
      private var _curSlide:Slide; //Slide that is currently displaying
      private var _loadingSlide:Slide; //only used when a Slide is supposed to show but hasn't been fully loaded yet (like if the user clicks "next" many times before all the images have loaded). We keep track of the one that's in the process of loading and should be shown as soon as it finishes, then we set _loadingSlide back to null.
      private var _imagesContainer:Sprite; //the Sprite into which the full-size images are placed (this helps manage the stacking order so that the images can always be behind everything else and yet we can addChild() each image so that it shows up on top of the previous one)
      private var _thumbnailsContainer:Sprite; //the Sprite into which the thumbnail images are placed. This also allows us to slide them all at the same time.
      private var _destScrollX:Number = 0; //destination x value for the _thumbnailsContainer which is used for scrolling it across the bottom. We don't want to use _thumbnailsContainer.x because it could be in the process of tweening, so we keep track of the end/destination value and add/subtract from it when creating our tweens.
      private var _minScrollX:Number; //we know the maximum x value for _thumbnailsContainer is 0, but the mimimum value will depend on how many thumbnail images it contains (the total width). We calculate it in the _setupThumbnails() method and store it here for easier/faster scrolling calculations in the _enterFrameHandler()
      public function SlideshowExample() {
       super();
       //activate the plugins that we'll be using so that TweenLite can tween special properties like filters, colorTransform, and do autoAlpha fades.
       TweenPlugin.activate([AutoAlphaPlugin, ColorTransformPlugin, GlowFilterPlugin]);
       _progressBar = this.getChildByName("progress_mc") as MovieClip;
       _arrowLeft = this.getChildByName("arrowLeft_mc") as MovieClip;
       _arrowRight = this.getChildByName("arrowRight_mc") as MovieClip;
       _arrowLeft.visible = _arrowRight.visible = false;
       _imagesContainer = new Sprite();
       this.addChildAt(_imagesContainer, 0);
       _thumbnailsContainer = new Sprite();
       addChild(_thumbnailsContainer);
       _thumbnailsContainer.y = _IMAGE_HEIGHT;
       _thumbnailsContainer.alpha = 0; //we want alpha 0 initially because we'll fade it in later when the thumbnails load.
       _thumbnailsContainer.visible = false; //ensures nothing is clickable.
       var xmlLoader:XMLLoader = new XMLLoader("assets/data.xml", {onComplete:_xmlCompleteHandler});
       xmlLoader.load();
      private function _xmlCompleteHandler(event:LoaderEvent):void {
       _slides = [];
       var xml:XML = event.target.content; //the XMLLoader's "content" is the XML that was loaded.
       var imageList:XMLList = xml.image; //In the XML, we have <image /> nodes with all the info we need.
       //loop through each <image /> node and create a Slide object for each.
       for each (var image:XML in imageList) {
        _slides.push( new Slide(image.@name,
              image.@description,
              new ImageLoader("assets/thumbnails/" + image.@name + ".jpg", {name:image.@name + "Thumb", width:_THUMB_WIDTH, height:_THUMB_HEIGHT, scaleMode:"proportionalInside", bgColor:0x000000, estimatedBytes:13000, onFail:_imageFailHandler}),
              new ImageLoader("assets/images/" + image.@name + ".jpg", {name:image.@name + "Image", width:_IMAGE_WIDTH, height:_IMAGE_HEIGHT, scaleMode:"proportionalInside", bgColor:0x000000, estimatedBytes:820000, onFail:_imageFailHandler})
       //now create a LoaderMax queue and populate it with all the thumbnail ImageLoaders as well as the very first full-size ImageLoader. We don't want to show anything until the thumbnails are done loading as well as the first full-size one. After that, we'll create another LoaderMax queue containing the rest of the full-size images that will load silently in the background.
       var initialLoadQueue:LoaderMax = new LoaderMax({onComplete:_initialLoadComplete, onProgress:_progressHandler});
       for (var i:int = 0; i < _slides.length; i++) {
        initialLoadQueue.append( _slides[i].thumbnailLoader );
       initialLoadQueue.append(_slides[0].imageLoader); //make sure the very first full-sized image is loaded initially too.
       initialLoadQueue.load();
       _setupThumbnails();
      private function _initialLoadComplete(event:LoaderEvent):void {
       //now that the initial load is complete, fade out the progressBar. autoAlpha will automatically set visible to false once alpha hits 0.
       TweenLite.to(_progressBar, 0.5, {autoAlpha:0});
       //fade in the thumbnails container
       TweenLite.to(_thumbnailsContainer, 1, {autoAlpha:1});
       _setupArrows();
       //setup the ENTER_FRAME listeners that controls the thumbnail scrolling behavior at the bottom
       this.stage.addEventListener(Event.ENTER_FRAME, _enterFrameHandler, false, 0, true);
       //now put all the remaining images into a LoaderMax queue that will load them one-at-a-time in the background in the proper order. This can greatly improve the user's experience compared to loading them on demand which forces the user to wait while the next image loads.
       var imagesQueue:LoaderMax = new LoaderMax({maxConnections:1});
       for (var i:int = 1; i < _slides.length; i++) {
        imagesQueue.append( _slides[i].imageLoader );
       imagesQueue.load();
       //now start the slideshow
       _showNext(null);
      //loops through all the thumbnail images and places them in the proper order across the bottom of the screen and adds CLICK_THUMBNAIL listeners.
      private function _setupThumbnails():void { 
       var l:int = _slides.length;
       var curX:Number = _THUMB_GAP;
       for (var i:int = 0; i < l; i++) {
        var thumbnail:Sprite = _slides[i].thumbnail;
        _thumbnailsContainer.addChild(thumbnail);
        TweenLite.to(thumbnail, 0, {colorTransform:{brightness:0.5}});
        _slides[i].addEventListener(Slide.CLICK_THUMBNAIL, _clickThumbnailHandler, false, 0, true);
        thumbnail.x = curX;
        thumbnail.y = 4;
        curX += _THUMB_WIDTH + _THUMB_GAP;
       _minScrollX = _IMAGE_WIDTH - curX;
       if (_minScrollX > 0) {
        _minScrollX = 0;
      private function _setupArrows():void {
       _arrowLeft.alpha = _arrowRight.alpha = 0;
       _arrowLeft.visible = _arrowRight.visible = true;
       _arrowLeft.addEventListener(MouseEvent.ROLL_OVER, _rollOverArrowHandler, false, 0, true);
       _arrowLeft.addEventListener(MouseEvent.ROLL_OUT, _rollOutArrowHandler, false, 0, true);
       _arrowLeft.addEventListener(MouseEvent.CLICK, _showPrevious, false, 0, true);
       _arrowRight.addEventListener(MouseEvent.ROLL_OVER, _rollOverArrowHandler, false, 0, true);
       _arrowRight.addEventListener(MouseEvent.ROLL_OUT, _rollOutArrowHandler, false, 0, true);
       _arrowRight.addEventListener(MouseEvent.CLICK, _showNext, false, 0, true);
      private function _showNext(event:Event=null):void {
       //if there's a _loadingSlide we should assume that the next Slide would be AFTER that one. Otherwise just get the one after the _curSlide.
       var next:int = (_loadingSlide != null) ? _slides.indexOf(_loadingSlide) + 1 : _slides.indexOf(_curSlide) + 1;
       if (next >= _slides.length) {
        next = 0;
       _requestSlide(_slides[next]);
      private function _showPrevious(event:Event=null):void {
       //if there's a _loadingSlide we should assume that the previous Slide would be BEFORE that one. Otherwise just get the one before the _curSlide.
       var prev:int = (_loadingSlide != null) ? _slides.indexOf(_loadingSlide) - 1 : _slides.indexOf(_curSlide) - 1;
       if (prev < 0) {
        prev = _slides.length - 1;
       _requestSlide(_slides[prev]);
      private function _requestSlide(slide:Slide):void {
       if (slide == _curSlide) {
        return;
       //kill the delayed calls to _showNext so that we start over again with a 5-second wait time.
       TweenLite.killTweensOf(_showNext);
       if (_loadingSlide != null) {
        _cancelPrioritizedSlide(); //the user must have skipped to another Slide and didn't want to wait for the one that was loading.
       //if the requested Slide's full-sized image hasn't loaded yet, we need to show the progress bar and wait for it to load.
       if (slide.imageLoader.progress != 1) {
        _prioritizeSlide(slide);
        return;
       //fade the old Slide and make sure it's not highlighted anymore as the current Slide.
       if (_curSlide != null) {
        TweenLite.to(_curSlide.image, 0.5, {autoAlpha:0});
        _curSlide.setShowingStatus(false);
       _curSlide = slide;
       _imagesContainer.addChild(_curSlide.image); //ensures the image is at the top of the stacking order inside the _imagesContainer
       TweenLite.to(_curSlide.image, 0.5, {autoAlpha:1}); //fade the image in and make sure visible is true.
       _curSlide.setShowingStatus(true); //adds an outline to the image indicating that it's the currently showing Slide.
       TweenLite.delayedCall(5, _showNext); //create a delayedCall that will call _showNext in 5 seconds.
      private function _prioritizeSlide(slide:Slide):void {
       TweenLite.to(_progressBar, 0.5, {autoAlpha:1}); //show the progress bar
       _loadingSlide = slide;
       _loadingSlide.imageLoader.addEventListener(LoaderEvent.PROGRESS, _progressHandler);
       _loadingSlide.imageLoader.addEventListener(LoaderEvent.COMPLETE, _completePrioritizedHandler);
       _loadingSlide.imageLoader.prioritize(true); //when the loader is prioritized, it will jump to the top of any LoaderMax queues that it belongs to, so if another loader is in the process of loading in that queue, it will be canceled and this new one will take over which maximizes bandwidth utilization. Once the _loadingSlide is done loading, the LoaderMax queue(s) will continue loading the rest of their images normally.
      private function _cancelPrioritizedSlide():void {
       TweenLite.to(_progressBar, 0.5, {autoAlpha:0}); //hide the progress bar
       _loadingSlide.imageLoader.removeEventListener(LoaderEvent.PROGRESS, _progressHandler);
       _loadingSlide.imageLoader.removeEventListener(LoaderEvent.COMPLETE, _completePrioritizedHandler);
       _loadingSlide = null;
      private function _completePrioritizedHandler(event:LoaderEvent):void {
       var next:Slide = _loadingSlide; //store it in a local variable first because _cancelPrioritizedSlide() will set _loadingSlide to null.
       _cancelPrioritizedSlide();
       _requestSlide(next);
      private function _progressHandler(event:LoaderEvent):void {
       _progressBar.progressBar_mc.scaleX = event.target.progress;
      private function _clickThumbnailHandler(event:Event):void {
       _requestSlide(event.target as Slide);
      private function _rollOverArrowHandler(event:Event):void {
       TweenLite.to(event.currentTarget, 0.5, {alpha:1});
      private function _rollOutArrowHandler(event:Event):void {
       TweenLite.to(event.currentTarget, 0.5, {alpha:0});
      private function _enterFrameHandler(event:Event):void {
       if (_thumbnailsContainer.hitTestPoint(this.stage.mouseX, this.stage.mouseY, false)) {
        if (this.mouseX < _SCROLL_AREA) {
         _destScrollX += ((_SCROLL_AREA - this.mouseX) / _SCROLL_AREA) * _SCROLL_SPEED;
         if (_destScrollX > 0) {
          _destScrollX = 0;
         TweenLite.to(_thumbnailsContainer, 0.5, {x:_destScrollX});
        } else if (this.mouseX > _IMAGE_WIDTH - _SCROLL_AREA) {
         _destScrollX -= ((this.mouseX - (_IMAGE_WIDTH - _SCROLL_AREA)) / _SCROLL_AREA) * _SCROLL_SPEED;
         if (_destScrollX < _minScrollX) {
          _destScrollX = _minScrollX;
         TweenLite.to(_thumbnailsContainer, 0.5, {x:_destScrollX});
      //if an image fails to load properly, remove it from the slideshow completely including its thumbnail at the bottom.
      private function _imageFailHandler(event:LoaderEvent):void {
       var slide:Slide;
       var i:int = _slides.length;
       while (--i > -1) {
        slide = _slides[i];
        if (event.target == slide.thumbnailLoader || event.target == slide.imageLoader) {
         slide.dispose();
         _slides.splice(i, 1);
         _setupThumbnails();
         return;
    [/CODE]
    I could figure out that I have to change the line
    [CODE]
    new ImageLoader("assets/images/" + image.@name + ".jpg", {name:image.@name + "Image", width:_IMAGE_WIDTH, height:_IMAGE_HEIGHT, scaleMode:"proportionalInside", bgColor:0x000000, estimatedBytes:820000, onFail:_imageFailHandler}
    [/CODE]
    and instead of ".jpg" put ".swf" (making sure that the names of the files are identical except for their extensions)
    The problem is that I get an error message in the output that flash could not convert my swf file to the bitmap.
    I suspect that I have to change the hard coding to specify that Loader Max should treat loading bigger swf files as swf and not as image/jpg files.
    I don't have enough expertise to decipher all the lines where this has to be changed.
    It feels that I am close to accomplishing what I need. Is it possible to point out where this change has to take place?
    Here is my thought process:
    I don't need to specify SWFLoader as LoaderMax is already specified (line 5)
    I don't need to change anything in lines 31-34 as "Sprite" and "Slide" could be an .swf file (line31-34)
    I don't need to change anything in line 50 for the same reason (line 50)
    I don't need to change lines 66 and 68 as image list may contain swf files (line 66 and 68)
    I do need to change ".jpg" to ".swf" in line 72 (line 72)
    No sure if there are any changes in line 82 (line 82)
    LoaderMax has var as imagesQueue does that need to be changed into SFWLoader? (lines98-102)
    I don't think anything need to be changed in lines 138-173 as " Slide" can incorporate an SWF file (lines 138-173)
    Not sure if there has to be a change in lines 175-177 as it specifies that slide is an image (lines 175-177)
    Not sure if there has to be a change in lines 182-200 from imageLoager to SWFLoader (lines 182-200)
    Not sure if there has to be a change in lines 239-245 in specifying SWFLoader (lines 239-245)
    I am attaching the .xml and .as documents as well

    This was my very first step.
    The problem is that I get an error message in the output that flash could not convert my swf file to the bitmap.
    I suspect that I have to change the hard coding to specify that Loader Max should treat loading bigger swf files as swf and not as image/jpg files.
    I don't have enough expertise to decipher all the lines where this has to be changed.
    It feels that I am close to accomplishing what I need. Is it possible to point out where this change has to take place?
    Just in case here is my xml code:
    <?xml version="1.0" encoding="iso-8859-1"?>
    <data>
              <image name="agencynet" description="agencynet description text goes here." />
              <image name="buick" description="buick description text goes here." />
              <image name="cocacola" description="cocacola description text goes here." />
              <image name="cu3er" description="cu3er description text goes here." />
              <image name="diva" description="diva description text goes here." />
              <image name="dow" description="dow description text goes here." />
              <image name="erkyperky" description="erkyperky description text goes here." />
              <image name="flexa" description="flexa description text goes here." />
              <image name="happyplanetshots" description="happyplanetshots description text goes here." />
              <image name="holdencruze" description="holdencruze description text goes here." />
              <image name="ironman" description="ironman description text goes here." />
              <image name="mercedes" description="mercedes description text goes here." />
              <image name="micromaniac" description="micromaniac description text goes here." />
              <image name="overtheatlantic" description="overtheatlantic description text goes here." />
              <image name="saab" description="saab description text goes here." />
              <image name="silverpistol" description="silverpistol description text goes here." />
              <image name="softse" description="softse description text goes here." />
              <image name="target" description="target description text goes here." />
              <image name="tonydorio" description="tonydorio description text goes here." />
              <image name="prius" description="prius description text goes here." />
              <image name="waterlife" description="waterlife description text goes here." />
    </data>

  • Flash hijacking HTML links while images are loading

    I've designed a slide show player using Flash and Actionscript 3.0 which loads several external images. While the images are loading, the HTML links on my page (outside of the Flash movie) don't work. As soon as all the images are loaded, the links start working again. It seems like the Flash player is hijacking the browser while the images are loading which can take the better part of a minute depending on my connection speed. I can click an HTML link once during the loading time and as soon as the images have loaded, the browser loads the new page (the one the HTML links to). Once all the images are in my Temporary Internet Files folder, this problem ceases to exist (since the images no longer need to be downloaded). It's only first-time viewers that will have this problem, but it's a pretty major problem.
    To see what I'm talking about, go to:
    http://www.ericlindberg.com/indexTemp.html
    Click the Images button after the "Loading..." animation disappears but before all the images are loaded. As the images load the thumbnails at the bottom of the Flash player go from 50% to 100% opaque. If  you click the "Images" button before all the thumbnails are 100% opaque, nothing happens. However, once they are all loaded and the thumbnails are all 100% opaque, the "Images" page loads. You can do the same thing with any of the subpages in the Images section of the site and get the same results.
    Any advice would be greatly appreciated.
    Joe    

    I have something similar on my site.
    http://alt-web.com/gallery.shtml
    You might try using CSS rollovers instead of MM (javascript) rollovers.  Straight HTML links load fast and work immediately.
    http://alt-web.com/DEMOS/CSS-Sprites-II.shtml
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    www.alt-web.com/
    www.twitter.com/altweb

  • Images not loading online

    import java.awt.event.*;
    import java.awt.*;
    import java.applet.*;
    public class EnglishProjApp extends Applet implements ActionListener
         Image current, img1, img2, img3, img4, img5, img6;
         Button next, back, first;
         String s;
         public void init()
              next = new Button("next");
              next.addActionListener(this);
              add(next);
              back = new Button("back");
              back.addActionListener(this);
              add(back);
              first = new Button("first");
              first.addActionListener(this);
              add(first);
              img1 = getImage(getCodeBase(), "img1.gif");
              img2 = getImage(getCodeBase(), "img2.gif");
              img3 = getImage(getCodeBase(), "img3.gif");
              img4 = getImage(getCodeBase(), "img4.gif");
              img5 = getImage(getCodeBase(), "img5.gif");
              img6 = getImage(getCodeBase(), "img6.gif");
              current = img1;
         public void paint(Graphics g)
              g.drawImage(current, 0, 30, this);
              g.drawString(s.valueOf(getCodeBase()), 0, 100);
         public void actionPerformed(ActionEvent e)
              if (e.getSource() == next)
                   if (current == img1) current = img2;
                   else if(current == img2) current = img3;
                   else if(current == img3) current = img4;
                   else if(current == img4) current = img5;
                   else if(current == img5) current = img6;
              else if(e.getSource() == back)
                   if(current == img6) current = img5;
                   else if(current == img5) current = img4;
                   else if(current == img4) current = img3;
                   else if(current == img3) current = img2;
                   else if(current == img2) current = img1;
              else if (e.getSource() == first) current = img1;
              repaint();
    As you can see this code is an applet which loads pictures and lets the user flick through them. It works offline but now i have put it online at http://www.geocities.com/jimr1603/index.html the pictures are not being shown. the pictures are on http://www.geocities.com/jimr1603/img1 to img6. The pictures are not particually large as the total of the page, classfile and pictures is about 80k. Any help on this will be appreciated.

    wow this forum moves fast
    anyway as is my nature i have updated the original code to include a simple game (beats revising) as another class with a popup window
    <code>
    import java.awt.event.*;
    import java.awt.*;
    import java.applet.*;
    import java.util.*;
    public class EnglishProjApp extends Applet implements ActionListener
         Image current, img1, img2, img3, img4, img5, img6;
         Button next, back, first, game;
         gameWindow gameW = new gameWindow();
         public void init()
              next = new Button("next");
              next.addActionListener(this);
              add(next);
              back = new Button("back");
              back.addActionListener(this);
              add(back);
              first = new Button("first");
              first.addActionListener(this);
              add(first);
              game = new Button("play a game");
              game.addActionListener(this);
              add(game);
              img1 = getImage(getCodeBase(), "img1");
              img2 = getImage(getCodeBase(), "img2");
              img3 = getImage(getCodeBase(), "img3");
              img4 = getImage(getCodeBase(), "img4");
              img5 = getImage(getCodeBase(), "img5");
              img6 = getImage(getCodeBase(), "img6");
              current = img1;
         public void paint(Graphics g)
         g.drawImage(current, 0, 30, this);
         public void actionPerformed(ActionEvent e)
              if (e.getSource() == next)
                   if (current == img1) current = img2;
                   else if(current == img2) current = img3;
                   else if(current == img3) current = img4;
                   else if(current == img4) current = img5;
                   else if(current == img5) current = img6;
              else if(e.getSource() == back)
                   if(current == img6) current = img5;
                   else if(current == img5) current = img4;
                   else if(current == img4) current = img3;
                   else if(current == img3) current = img2;
                   else if(current == img2) current = img1;
              else if (e.getSource() == first) current = img1;
              else if (e.getSource() == game){
                   gameW.setVisible(true);
                   gameW.setSize(300, 200);
              repaint();
    class gameWindow extends Frame implements ActionListener
         Button button1;
         TextField text1;
         Label lbl1;
         Random rn = new Random();
         int me, you, tries;
         gameWindow()
              super("guess the number");
              me = rn.nextInt(1000);
              setLayout(new FlowLayout());
              text1 = new TextField("type your guess here");
              add(text1);
              button1 = new Button("guess");
              add(button1);
              button1.addActionListener(this);
              lbl1 = new Label("i'm thinking of a number between 0 and 1000");
              add(lbl1);
              addWindowListener(new WindowAdapter() {public void
                 windowClosing(WindowEvent e) {setVisible(false);}});
         public void actionPerformed(ActionEvent ev)
              if (ev.getSource() == button1)
                   tries++;
                   try
                        you = (Integer.parseInt(text1.getText()));
                        if (you == me){
                             text1.setText("you got it in " + tries );
                             me = rn.nextInt(1000);
                             you = 0;
                             tries = 0;
                             lbl1.setText("i'm thinking of a new number");
                        else if (you < me) lbl1.setText
                        ("higher");
                        else if (you > me) lbl1.setText
                        ("lower");                    
                   catch(Exception ex)
                        lbl1.setText("enter a number first");
    }</code>
    it works offline but (again) i am having trouble with the conversion to online. Both class files produced are online and in the same folder but the applet does not load and gives this in the console:
    java.lang.NoClassDefFoundError: gameWindow$1
         at gameWindow.<init>(EnglishProjApp.java:106)
         at EnglishProjApp.<init>(EnglishProjApp.java:10)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
         at java.lang.reflect.Constructor.newInstance(Unknown Source)
         at java.lang.Class.newInstance0(Unknown Source)
         at java.lang.Class.newInstance(Unknown Source)
         at sun.applet.AppletPanel.createApplet(Unknown Source)
         at sun.plugin.AppletViewer.createApplet(Unknown Source)
         at sun.applet.AppletPanel.runLoader(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    java.lang.NoClassDefFoundError: gameWindow$1
         at gameWindow.<init>(EnglishProjApp.java:106)
         at EnglishProjApp.<init>(EnglishProjApp.java:10)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
         at java.lang.reflect.Constructor.newInstance(Unknown Source)
         at java.lang.Class.newInstance0(Unknown Source)
         at java.lang.Class.newInstance(Unknown Source)
         at sun.applet.AppletPanel.createApplet(Unknown Source)
         at sun.plugin.AppletViewer.createApplet(Unknown Source)
         at sun.applet.AppletPanel.runLoader(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Ive just realised that i think it wants the class file called gameWindow$1 to be uploaded but i was uploading gameWindow but geocities says gameWindow$1 is an invalid file name
    p.s i tried media tracker with this and it didnt work, if anyone has code examples of media tracker (or simpler :-) ) working please tell me

  • FireFox images not loading in local folders (firebug error-Failed to load given URL)

    I am having difficulty when developing websites in local folders (Windows7 computer). The webpages I make are showing images in IE9 & Chrome but not FireFox (nor Safari nor Opera).
    In FireFox I get Firebug "Failed to load given URL" prompt.
    I am using html5 & external linked css stylesheet & the html/html5 & css code validates.
    I have tried using rel path ie images/image.gif & absolute path references ie C:/RPD_Programming/RPD WEB/amwcsnew/index.html
    and have tried using % to eliminate whitespace in references but I cannot get FireFox to display images!!
    This has been a problem for me for around 2 weeks now & is very frustrating. Some website code/templates I have downloaded from the internet display the websites properly (ie load images fine) when I open them locally in FireFox. Why does my code not allow the images to load in FireFox (paths/permissions/other issue??). How can I fix this?
    Here is example css & html5 not displaying images from local directory in FireFox (fine in IE9 & Chrome):
    style.css
    /* CSS Document */
    /*Basic Reset*/
    margin:0;
    padding:0;
    html{
    /* HTML5 display-role reset for older browsers */
    article, aside, details, figcaption, figure,
    footer, header, hgroup, menu, nav, section {
    display: block;
    body{
    width:1200px;
    margin:0 auto;
    header{
    height:450px;
    background:url("C:/RPD_Programming/RPD WEB/amwcsnew/images/header.gif");
    background-repeat:no-repeat;
    #mid{height:750px;
    background:url('C:/RPD_Programming/RPD_WEB/amwcsnew/images/mid.gif')no-repeat;
    footer{height:286px;
    background:url('C:/RPD_Programming/RPD WEB/amwcsnew/images/footer.gif')no-repeat;
    index.html
    <!doctype html><!-- simplified doctype works for all previous versions of HTML as well -->
    <!--html5 template from www.impressivewebs.com_modified by RPD-->
    <!-- Paul Irish's technique for targeting IE, modified to only target IE6, applied to the html element instead of body -->
    <!--[if lt IE 7 ]><html lang="en" class="no-js ie6"><![endif]-->
    <!--[if (gt IE 6)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]-->
    <head>
    <!-- simplified character encoding -->
    <meta charset="utf-8">
    <title>amwcs-new</title>
    <meta name="description" content="amwcs">
    <meta name="author" content="rpd">
    <!-- Delete these two icon references once you've placed them in the root directory with these file names -->
    <!-- favicon 16x16 -->
    <link rel="shortcut icon" href="/favicon.ico">
    <!-- apple touch icon 57x57 -->
    <link rel="apple-touch-icon" href="/apple-touch-icon.png">
    <!-- Main style sheet. Change version number in query string to force styles refresh -->
    <!-- Link element no longer needs type attribute -->
    <!-- <link rel="stylesheet" type="text/css" media="all" href="css/style.css" />-->
    <link rel="stylesheet" href="css/style.css?v=2">
    <!-- Modernizr for feature detection of CSS3 and HTML5; must be placed in the "head" -->
    <!-- Script tag no longer needs type attribute -->
    <script src="js/modernizr-1.6.min.js"></script>
    <!-- Remove the script reference below if you're using Modernizr -->
    <!--[if lt IE 9]>
    <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    </head>
    <!-- If possible, use the body as the container -->
    <!-- The "home" class is an example of a dynamic class created on the server for page-specific targeting
    <body class="home">-->
    <body>
    <!-- ******************************************************************** -->
    <!-- The content below is for demonstration of some common HTML5 elements -->
    <!-- More than likely you'll rip out everything except header/section/footer and start fresh -->
    <!-- First header has an ID so you can give it individual styles, and target stuff inside it
    <header id="hd1"> No way Hosay-not by default! Default is <header> tag (RPD edit) -->
    <header>
    <!-- "hgroup" is used to make two headings into one, to prevent a new document node from forming -->
    <hgroup>
    <h1>amwcs</h1>
    <h2>tagline</h2>
    </hgroup>
    <!-- Main nav, styled by targeting "#hd1 nav"; you can have more than one nav element per page -->
    <nav>
    <ul>
    <li><a href="#">Home</a></li>
    <li><a href="#">About</a></li>
    <li><a href="#">Services</a></li>
    <li><a href="#">Contact</a></li>
    </ul>
    </nav>
    </header><!--End header & or #hd1 header div id if used-->
    <!-- This is the main "div" that wraps the content generically; don't use "section" for this -->
    <div id="mid">
    <!-- The first of two "section" elements for demo purposes; optional class added for styling (hs1 = "home section 1") -->
    <section class="hs1">
    <!-- Each section should begin with a new h1 (not h2), and optionally a header -->
    <!-- You can have more than one header/footer pair on a page
    <header>
    <h1>This is a Page Sub Title</h1>
    </header> -->
    <p>Some content...</p>
    <!-- The h2 below is a sub heading relative to the h1 in this section, not for the whole document -->
    <h2>Demonstrating EM and STRONG</h2>
    <!-- "strong" is used for SEO and contextual hierarchy -->
    <p><strong>This text will have more importance (SEO-wise and contextually)</strong></p>
    <!-- "b" is used for stylistic offset of text that's NOT important contextually -->
    <p><b>This text has visual importance but has no contextual or SEO importance</b></p>
    <!-- "em" is used for colloquial-style emphasis -->
    <p>This is a <em>very</em> colloquial expression.</p>
    <!-- There can be multiple footers on each page -->
    <!-- Secondary headers and footers don't necesarily need ids; they can be targeted via context (i.e. ".hs1 footer")
    <footer>
    <!-- incite a riot: http://24ways.org/2009/incite-a-riot
    <p>Author: <cite>Louis Lazaris</cite></p>
    </footer> -->
    </section><!-- .hs1 -->
    <!-- This is another section; doesn't have header/footer because it's not required -->
    <section class="hs2">
    <h1>This is another section</h1>
    <p>This is some dummy content</p>
    </section><!-- .hs2 -->
    </div><!-- #mid -->
    <!-- The "aside" element could be a sidebar (outside an article or section) -->
    <!-- Or it could reference other tangentially-related content within an article or section
    <aside id="sidebar">
    <p>Sidebar content</p>
    </aside>-->
    <!-- The main footer has an ID for targeting, similar to the main header -->
    <footer >
    <p>copyright &copy; year</p>
    </footer>
    <!-- Remote jQuery with local fallback; taken from HTML5 Boilerplate http://html5boilerplate.com -->
    <!-- jQuery version might not be the latest; check jquery.com -->
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
    <script>!window.jQuery && document.write(unescape('%3Cscript src="js/jquery-1.4.4.min.js"%3E%3C/script%3E'))</script>
    <!-- Below is your script file, which has a basic JavaScript design pattern that you can optionally use -->
    <!-- Keep this and plugin scripts at the bottom for faster page load; combining and minifying scripts is recommended -->
    <script src="js/general.js"></script>
    <!-- asynchronous analytics code by Mathias Bynens; change UA-XXXXX-X to your own code; http://mathiasbynens.be/notes/async-analytics-snippet -->
    <!-- this can also be placed in the <head> if you want page views to be tracked quicker -->
    <script>
    var _gaq = [['_setAccount', 'UA-XXXXX-X'], ['_trackPageview']];
    (function(d, t) {
    var g = d.createElement(t),
    s = d.getElementsByTagName(t)[0];
    g.async = true;
    g.src = ('https:' == location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    s.parentNode.insertBefore(g, s);
    })(document, 'script');
    </script>
    </body>
    </html>
    I am most grateful for help & look forward to replies & fixing this-thanks
    NB
    Is there a FireFox guide/manual in pdf format available anywhere? I have not found one yet & a FireFox reference might be useful!

    You need to use file:// as the protocol instead of C:/. The latter may never work (C:\ might).
    Where is the main HTML located ?
    Easiest if to store the images in a sub folder of the location because you can't go back via ../ beyond that root location for security reasons.
    See:
    *http://kb.mozillazine.org/Links_to_local_pages_do_not_work

  • Getting Images To Load On Web?

    Hi all,
    I have a question about how to get images to load in an applet once it is uploaded to a website. When I run the applet in JGrasp it works fine but if I try to open the applet in a web browser (via an html file on the hard drive) nothing loads. If I take the code out that sets the background image the application loads fine in the web browser.
    The image is in the same directory as the class file and html file. Is there a way I can get this method to work (loading off the hard drive and also off the website when it's uploaded) or do I have to use a jar file? I have spent some time searching for tutorials and demos but haven't been able to get the jar file to work either. I'm fairly new to programming and most of the examples I found were way over my head.
    Any help in getting this problem solved will be greatly appreciated.
    Here is a short sample program to illustrate the problem: For some reason this sample program only loads in IE and not in Firefox.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class Test extends JApplet implements ActionListener
    {     Container     mainWindow;
         public void init()
         {     ImagePanel panel = new ImagePanel(new ImageIcon("Background.jpg").getImage());
              setContentPane(panel);
              mainWindow = getContentPane();
              mainWindow.setLayout(new BorderLayout());
              JLabel label = new JLabel("TESTING");
              mainWindow.add(label, BorderLayout.CENTER);
              setSize(1000, 500);
              setVisible(true);
              mainWindow.validate();
         public void actionPerformed(ActionEvent e) { }
    class ImagePanel extends JPanel
    {     private Image img;
         public ImagePanel(String img)
         {     this(new ImageIcon(img).getImage());
         public ImagePanel(Image img)
         {     this.img = img;
              Dimension size = new Dimension(img.getWidth(null), img.getHeight(null));
              setPreferredSize(size);
              setMinimumSize(size);
              setMaximumSize(size);
              setSize(size);
              setLayout(null);
         public void paintComponent(Graphics g)
         {     g.drawImage(img, 0, 0, null);
    CODE FOR HTML FILE:
    <html><body>
    <CENTER>
         <applet code="Test.class" width="1000" height="500"></applet>
    </CENTER>=
    </body></html>

    Hello again,
    I've got one more small question. I modified the code a little bit so I could create an Image folder (package) which holds all of the images and the ImagePanel class. Since the ImagePanel and images are all in the same folder, I modified the ImagePanel constructor to take a string and then load the file with that name. It works in JGrasp and when I open it in a web browser from my computer, but when I upload it to the site it no longer works. Is there a way to get at these images inside the folder when it's online without drastically changing the method I used in the first place? I saved the original files that I can go back to so if it's not an easy fix then that's no big deal, but I thought I'd ask just in case it is something simple as it would be nice to have the files more organized. Thanks.
    Here's the updated code.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.net.*;
    public class Test extends JApplet implements ActionListener
    {     Container     mainWindow;
         URL               url;
         public void init()
              ImagePanel panel = new ImagePanel("Background.jpg");          // background image
              setContentPane(panel);
                mainWindow = getContentPane();
                mainWindow.setLayout(new BorderLayout());
              JLabel label = new JLabel("TESTING");
              mainWindow.add(label, BorderLayout.CENTER);
              setSize(1000, 500);
              setVisible(true);
              mainWindow.validate();
         public void actionPerformed(ActionEvent e) { }
    class ImagePanel extends JPanel
    {     private Image img;
         public ImagePanel(String img)
         {     this(new ImageIcon(img).getImage());
         public ImagePanel(Image img)
         {     this.img = img;
              Dimension size = new Dimension(img.getWidth(null), img.getHeight(null));
              setPreferredSize(size);
              setMinimumSize(size);
              setMaximumSize(size);
              setSize(size);
              setLayout(null);
         public void paintComponent(Graphics g)
         {     g.drawImage(img, 0, 0, null);
    }Inside "Image" folder:
    package Image;
    import java.awt.*;
    import javax.swing.*;
    public class ImagePanel extends JPanel
         public Image img;
         public ImagePanel(String imageFile)
              Image img = new ImageIcon(getClass().getResource(imageFile)).getImage();
              this.img = img;
              Dimension size = new Dimension(img.getWidth(null), img.getHeight(null));          // set size = size of image
              setPreferredSize(size);
              setMinimumSize(size);
              setMaximumSize(size);
              setSize(size);
              setLayout(null);
         public void paintComponent(Graphics g)
              g.drawImage(img, 0, 0, null);
    }

  • Images as Buttons and Image Resizing in mxml

    Sorry for all the questions but I've run into a problem when trying to create buttons that are just an image in mxml. When I first tried this I couldn't find a way to get the border around the button to dissapear so it ended up looking like my image had an extra black border around it. Then someone here suggested I just set the buttonMode property of an mx:Image to true which ended up working fine to a point. The problem I'm having is that even if I make the tabEnabled property of the image (that I'm using as a button) true, I can't tab over to it. Is there a way to either get rid of the black borders of a button or to make it so I can tab over to an image I'm using as a button?
    My second question has to do with image resizing. Lets say I have an image of a horizontal line that I want to put at the top of the mxml page, and I want it to extend the full length of the page, even after the user has resized the browser. Is there a way to do that? I've tried putting the width as 100% or giving the image a "left" and "right" value so that presumably it would be stretched to fit within those but nothing has worked so far. Is there no way to do this or am I doing something wrong?
    Thank you for any help you guys can give.

    Of course, sorry about that. So the following is a barebones example of how I currently implement buttons and images as buttons:
    <mx:Button id="facebookButton" icon="@Embed(source='image.png')" width="30"/>
    <mx:Image buttonMode="true" id="button" source="anotherimage.png" enabled="true" click="{foo()}"/>
    And within the image I've tried making the tabFocusEnabled property true but to no avail.
    The following is how I've tried stretching out an image across the whole page:
    <mx:Image source="yetanotherimage.png" width="100%" scaleContent="true"/>
    <mx:Image source="yetanotherimage.png" left="10" right="10" scaleContent="true"/>
    Is this more helpful?

  • How to prevent images from loading?

    I am working on creating a web gallery in Dreamweaver CS3.  The thumbnails are in a horizontal strip within a layer above the full sized image layer, in other words the strip is  hiding part of the image, but only when the image is in a vertical orientation. (the strip has no background, so all that is visible are the actual thumbnails) Upon clicking show/hide text , in a toggle configuration, the strip fades, or shows.   On my computer it works perfectly. However, once uploaded, it takes forever to load the images.
    The problem: Although I have the thumbnail images are set to preload,  all of the full size images are loading as well, which takes alot of time. Is there a way to prevent the full sized images from loading, i.e. only when the thumbnail is clicked?
    Frames, in which one frame is thumbnails, and another the is images, is what I normally would use, and have a page for each image. However, for what I have in mind, it will not work (transparency on parts of one frame above another is as far as I can tell not possible).
    So how do I prevent images from loading until called for?  regards~bill-o

    t would help if you posted a link to the page, but I can guess that you have properly diagnosed the cause - the page is encumbered with the weight of all of the full-sized images.
    The only way to not have this happen would be to dynamically write the link to the full sized-images on demand, as it were.  In other words, the link ISN'T EVEN ON THE PAGE until you have clicked on the corresponding thumbnail, and only at that point is the weight of that image experienced.  One easy way to do this is to use the SetText of Container behavior that is part of DW's native arsenal of behaviors.  When the thumb is clicked, the SetText behavior is called to write the image link into the enlarged image's container. Need to see a demo?  Look here -
    http://dreamweaverresources.com/tutorials/settextoflayer.htm
    The behavior is called "Set Text of Container", and using it will meet all of your requirements.
    To use it, you will have to have the following:
    1.  A page with a 'container' which is to receive the enlarged image - this could be a table cell, a paragraph tag, a div, or even a span tag.
    2.  That container will have to be identified with an ID attribute and a valid value, e.g., <div id="enlargedImage">.
    3.  A dummy page containing each enlarged image, placed sequentially on the page.
    To implement the effect, do the following:
    1.  Open the dummy page in Code view, and select the first image's tag, e.g., <img src="images/foo.jpg" width="123" height="256" alt="whatever" /> (XHTML syntax shown here).
    2.  Switch to the actual page, select a thumb that will 'open' this enlarged image, and enter "javascript:;" (that's colon semicolon) in the 'Link' field of the Property inspector to make this thumbnail image a null link.
    3.  Apply the Set Text of Container behavior.
    4.  Paste the clipboard into the dialog for the behavior, and click OK to close the dialog.
    5.  Examine the Behavior panel to see which mouse event has been defaulted - probably 'onclick'.  If you would rather have this be 'onmouseover' use the Behavior panel Event selector (the dark triangle to the right of the event name) to select 'onmouseover'.
    5.  Repeat from #1 above until all thumbs have been treated.
    Let us know if this does not make sense

  • Movie clip resize not working when image is loaded

    Hello,
    I'm having some strange luck in building an image slide
    show. I load the image paths into an array from an XML
    page and then step through the array elements w/ forward and
    back buttons.
    I have an empty image clip on the stage where I create an
    empty movie clip inside each time a new image is loaded. I load the
    image into the second movie clip like this:
    [code]
    _root.picsPage_mc.mc_pic_loader.mc_individual_pic_loader.unloadMovie();
    _root.picsPage_mc.mc_pic_loader.createEmptyMovieClip(
    'mc_individual_pic_loader', 1 );
    _root.load_movie_and_stop(
    _root.picsPage_mc.mc_pic_loader.mc_individual_pic_loader,
    _root.photo_array[_root.photo_index].image,
    _root.picsPage_mc.mc_pbar, 'regular_load');
    [/code]
    The load_movie_and_stop function is as follows:
    [code]
    function load_movie_and_stop( target_mc:MovieClip,
    movie_clip_to_load:String, p_bar:MovieClip, action:String )
    mc_loader._width = 0;
    mc_slider_bar.mc_drag_pan._x = 0;
    if( action != 'simple_load' )
    p_bar._visible = true;
    p_bar.bar._width = 0;
    var mclListener:Object = new Object();
    mclListener.onLoadStart = function( target_mc )
    if( action != 'simple_load' && action !=
    'regular_load' ){ target_mc.stop(); }
    if( action == 'load_and_play' ){ target_mc.play(); }
    mclListener.onLoadInit = function( target_mc )
    _root.resize_movie_clip(target_mc, 160, 120, 250, 190);
    if( action == 'load_and_stop' ){ target_mc.stop(); }
    mclListener.onLoadProgress = function( target_mc )
    if( action != 'simple_load' )
    percentLoaded = Math.floor( (
    target_mc.getBytesLoaded()/target_mc.getBytesTotal() )*100);
    p_bar.bar._xscale = percentLoaded;
    p_bar.txt_percent = percentLoaded + "% loaded.";
    mclListener.onLoadComplete = function( target_mc ){
    p_bar._visible = false; }
    var my_mcl:MovieClipLoader = new MovieClipLoader();
    my_mcl.addListener(mclListener);
    my_mcl.loadClip( movie_clip_to_load, target_mc );
    }//___endFunc___
    [/code]
    After the image is loaded into the movie clip, I then resize
    the image to be a specific width.
    The image resizing is done w/ this function:
    [code]
    function resize_movie_clip(clip_loader_name:MovieClip,
    max_width:Number, max_height:Number )
    orig_width = clip_loader_name._width;
    orig_height = clip_loader_name._height;
    aspect_ratio = orig_width / orig_height;
    if( (orig_width > max_width) || ( orig_height >
    max_height ) ) // If either dimension is too big...
    if( orig_width > orig_height ) // For wide images...
    new_width = max_height;
    new_height = new_width / aspect_ratio;
    else if( orig_width < orig_height )
    new_height = max_height;
    new_width = new_height * aspect_ratio;
    else if( orig_width == test_height )
    new_width = max_width;
    new_height = max_width;
    else { trace( "Error reading image size."); return false; }
    else { new_width = orig_width; new_height = orig_height; }
    clip_loader_name._width = Math.round(new_width);
    clip_loader_name._height = Math.round(new_height);
    [/code]
    Now, 98% of the time this works perfectly, but there is some
    certain times where the image resizing is completely ignored and
    the image gets loaded as it's normal size.
    Can anyone see why the image sizing get's ignored in some
    instance?
    Thanks for any help,
    Clem

    Found the solution that worked (used ._xscale and ._yscale
    instead of ._width and ._height
    [code]
    function resize_movie_clip(clip_loader_name:MovieClip,
    max_width:Number, max_height:Number, center_offset:Number )
    if( (clip_loader_name._width > max_width) || (
    clip_loader_name._height > max_height ) ) // If either dimension
    is too big...
    if( clip_loader_name._width > max_width )
    _root.picsPage_mc.txt_test = "func if 1";
    clip_loader_name._width = max_width;
    clip_loader_name._yscale = clip_loader_name._xscale;
    if( clip_loader_name._height > max_height )
    _root.picsPage_mc.txt_test = "func if 2";
    clip_loader_name._height = max_height;
    clip_loader_name._xscale = clip_loader_name._yscale;
    else { new_width = orig_width; new_height = orig_height; }
    [/code]

  • Behaviors - 1 button = multiple image sequence...how?

    I have a portofolio I want to show on my site, I want one button to click through all the images. I've tried doing this in behaviors but it won't sequence. Everytime I click on the button only the first image shows up, it will not click through all my images. How do I make this work sequentially in behaviors?

    Is this the effect you're looking for?
    http://www.dynamicdrive.com/dynamicindex4/stepcarousel.htm
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    www.alt-web.com/
    www.twitter.com/altweb
    www.alt-web.blogspot.com

  • Change First Load and Menu Disappear with scroll

    Hello,
    Im in a crossroad trouble and think that one of my problems is that i can resolve it changying the first load of my site and relink to one anchor link.
    My other problem is that i want to recreate the behavior of the menu of this web http://www.smallstudio.com.au/ with no success, this disappear when scrolls the site.
    Thanks for anticipate, im thinking that maybe can modify the html or do with Edge Animate, but maybe someone can help me because im walking in circles with this site.
    Gracias!

    Thank you, knorretje. Had no problems with logging on 2003. Lot of lines, but I propose that critical part<br>
    0[220f140]: nsHttpChannel::OnCacheEntryAvailable [this=3f6f400 entry=5236740 access=3 status=0]<br>
    0[220f140]: nsHttpChannel::Connect [this=3f6f400]<br>
    0[220f140]: nsHTTPChannel::CheckCache enter [this=3f6f400 entry=5236740 access=3]<br>
    0[220f140]: nsHttpResponseHead::Parse [this=6b113c0]<br>
    0[220f140]: nsHttpResponseHead::ParseVersion [version=HTTP/1.1 200 OK]<br>
    0[220f140]: Have status line [version=11 status=200 statusText=OK]<br>
    0[220f140]: ParseContentType [type=image/gif]<br>
    0[220f140]: nsHttpResponseHead::MustValidate ??<br>
    0[220f140]: no mandatory validation requirement<br>
    0[220f140]: Not validating based on expiration time<br>
    0[220f140]: nsHTTPChannel::CheckCache exit [this=3f6f400 doValidation=1]<br>
    As I understand, all partial checks say that cache is good. But ending doValidation=1, probably, means that request will be sent. Do not see any reason.

  • How about a sign that images are loading?

    I am a user of Elements 8.0 for image cateloging and some light editing and CS4 for major editing. I think I'm going to switch from Elements to LR 3.
    When I try to load existing pictures on my hard drive (about 60 GB), I get no sign from LR 3 that the images are loading. After a LONG time, I give up waiting and close the program. Then I get a message telling me it's still loading pictures. Now I just load them in small batches, maybe 100 pictures at a time. Still no sign the program is doing anything, but the pictures load quickly so I know something is happening. Loading 16,000 some images a hundred or two at a time will be time consuming.
    I recommend an hour-glass, or better yet, a bar graph showing something is happeing on how long it may lake to load pictures. Kind of like when you burn a DVD or CD from Elements. At least you know your computer hasn't crashed.
    Program looks pretty good otherwise.
    Mike Davis

    That will require some javascript and depending on the current slide script you use, that may be more difficult than it's worth.
    First, make sure your images are saved at their display size. If you have a 3000x3000 pixel image downsized to 150x150 in the html, it still loads like a 3000x3000 image (very slowly on low speed connections). Downsize the image to the actual viewed size you intend to use, you can drop MB files to a couple KB.
    Next, optimize the images using Photoshops Save for Web feature Ctrl + Alt/Cmnd + Shift + S or File > Save for Web.
    When the SFW dialogue box appears, there will be the options: Original Optimized 2-Up and 4-Up across the top.
    Opening the 4-Up tab allows you to have 4 versions of the image displayed. Click on any given image and change the settings on the right of the dialogue window. Reduce the settings to the lowest possible, while still appearing "good" to you.
    With that "lowest good" window selected (black outline around it), click Save and that optimized version will be the copy you get. This can drop a several hundred KB file to just a handful of KB, making your images load almost instantly, no more white box.

Maybe you are looking for

  • Goods receipt and EDI invoice

    Hi all, I have a problem concerning receipts of EDI invoices and goods. Frequently our vendors send their EDI invoices to us before we get the goods. As we process the inbound EDI-invoices they are stuck in BD87 as an EDI-error saying that the PO hav

  • N97 (and general S60 v5 - 5800, etc) iphone style ...

    Howdy all! k, this post has two purposes. first of all, i'm wondering if anyone knows a good iphone-style conversation app (c'mon, you know it's the only thing they have over us, we all want one) that integrates well with the built in "new message" p

  • How to detect duplicate for custom object 1

    Hi expert, are there any fields in custom object can detect duplicates If These Fields Match? we thought it should be "Name" but it's not. Thanks, sab.

  • 2LIS_02_ITM enhacement add EKPO-BUKRS but we get Purchase Order Line for 2

    Hi All    We have active extractor 2LIS_02_ITM, This exctractor has an enhacenment, we add field EKPO-BUKRS before activate this extractor...    Now... in Production system we look that we have the combination of SAPR/3- purchase order - line item -

  • Creating TabStrip control with VisualComposer

    Hi, I am NW04 version for Visual Composer. I want to create a TabStrip control on which I want to show two table from a RFC. Is there any facility available to create this like NW2004s. I found from some posts that NW04 verson doesn't have capabiliti