Set Image Source to change image file for an Image control : Image « Graphics « Flex






Set Image Source to change image file for an Image control

Set Image Source to change image file for an Image control
            
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" backgroundColor="#eeeeee">

  <mx:Script>
    
      [Embed(source="logo.jpg")]
      [Bindable]
      public var flowerImage1:Class;
      [Embed(source="logo.jpg")]
      [Bindable]
      public var flowerImage2:Class;
  
  </mx:Script>

  <mx:Image id="myImage" source="{flowerImage1}"/>
  <mx:Button label="Change Image" click="myImage.source=flowerImage2"/>
  
</mx:Application>

   
    
    
    
    
    
    
    
    
    
    
    
  








Related examples in the same category

1.Use inline item renderer to display imageUse inline item renderer to display image
2.Bind Image to a variableBind Image to a variable
3.Explicit sizing for the Image control and default sizing for the Button controlExplicit sizing for the Image control and default sizing for the Button control
4.uses explicit sizing for the Image control and default sizing for the Button controluses explicit sizing for the Image control and default sizing for the Button control
5.Change Image source in button actionChange Image source in button action
6.Image as Button skinImage as Button skin
7.When the user clicks the button, the action sets the visible property of the image to true to make it appear
8.Use load() method to replace a small image with a large image when the user clicks a buttonUse load() method to replace a small image with a large image when the user clicks a button
9.Using GIF file as both a skin for the Button control and a source for the tag
10.Embedding three images and applies those images as skins to an instance of a Button controlEmbedding three images and applies those images as skins to an instance of a Button control
11.Button with Embedded imageButton with Embedded image
12.Maintain Image Aspect RatioMaintain Image Aspect Ratio
13.Add image based border skin for CanvasAdd image based border skin for Canvas
14.Load image from a URLLoad image from a URL
15.Working with different media typesWorking with different media types
16.Setting visibilitySetting visibility
17.Import a green square from a SWF file that contains a library of different shapes
18.Resize logo to the exact values of the height and width properties without regard for its aspect ratioResize logo to the exact values of the height and width properties without regard for its aspect ratio
19.Assigning an image to a variable to decouple its locationAssigning an image to a variable to decouple its location
20.Use Image control to display imageUse Image control to display image
21.Use a relative path to reference an image in an assets directoryUse a relative path to reference an image in an assets directory
22.Reference an image using a URLReference an image using a URL
23.Create image thumbnailsCreate image thumbnails
24.Set height and width of the image to 150 by 200 pixelsSet height and width of the image to 150 by 200 pixels
25.Resize Image to exact height and widthResize Image to exact height and width
26.x and y properties specify the upper-left corner of imagex and y properties specify the upper-left corner of image
27.Use ActionScript to set image propertiesUse ActionScript to set image properties
28.Use load() method to replace imageUse load() method to replace image
29.Text can flow around the imageText can flow around the image
30.Layout images in a CanvasLayout images in a Canvas
31.Png image based skinPng image based skin
32.Use Image control in an MXML fileUse Image control in an MXML file
33.skin based on png imagesskin based on png images
34.Do not maintain Aspect Ratio when displaying image with ImageDo not maintain Aspect Ratio when displaying image with Image
35.Use source for Image controls and other controls that point to an external fileUse source for Image controls and other controls that point to an external file
36.Compare Two Bitmap ImagesCompare Two Bitmap Images
37.Image source fileImage source file
38.Load image file for an Image control with load methodLoad image file for an Image control with load method
39.Image control io error
40.Image BindingImage Binding
41.Image DemoImage Demo
42.Load Image With Load method from a disk fileLoad Image With Load method from a disk file
43.Move ImageMove Image
44.Load image with Loader and Paint image with graphics
45.Display Images and SWFs in HTMLDisplay Images and SWFs in HTML
46.Load and Display an ImageLoad and Display an Image
47.Display a Custom Loader while Loading ImagesDisplay a Custom Loader while Loading Images
48.skin with imageskin with image
49.Use the backgroundImage style to specify an image as the background of the containerUse the backgroundImage style to specify an image as the background of the container
50.Access a JPEG image at run timeAccess a JPEG image at run time
51.Reference an image by using a URLReference an image by using a URL
52.By specifying a height and width of 20 by 20 pixels, you create a thumbnail of the image.By specifying a height and width of 20 by 20 pixels, you create a thumbnail of the image.
53.Load a simple image from a local locationLoad a simple image from a local location
54.Using the tag and how text can flow around the imageUsing the <img> tag and how text can flow around the image
55.Use @Resource directive anywhere a String might supply the location of the image.
56.Set image transform center to the right edge, corresponding to the transormX property having a value of 100Set image transform center to the right edge, corresponding to the transormX property having a value of 100
57.Image ClassImage Class
58.Read and Save a User's Webcam ImageRead and Save a User's Webcam Image
59.Embed a JPEG image into a Flex applicationEmbed a JPEG image into a Flex application