Load image with Loader and Paint image with graphics : Image « Graphics « Flex

Home
Flex
1.Chart
2.Components
3.Container
4.Data Model
5.Development
6.Effects
7.Event
8.Graphics
9.Grid
10.Style
Flex » Graphics » Image 




Load image with Loader and Paint image with graphics
            
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
    <mx:HBox width="400" height="300" creationComplete="init()">
        <mx:Script>
            
    
                import flash.net.URLRequest;
    
                private var loader:Loader;
    
                private function init():void
                {
                    loader = new Loader();
                    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeLoad);
                    loader.load(new URLRequest("logo.jpg"));
                }
    
                private function completeLoad(event:Event):void
                {
                    var bm:BitmapData = new BitmapData(loader.width, loader.height, true,0x000000);
                    bm.draw(this.loader);
                    var m:Matrix = new Matrix();
                    m.createBox(this.width/loader.width, this.height/loader.height);
                    this.graphics.beginBitmapFill(bm, m, true, true);
                    this.graphics.drawRoundRectComplex(00this.width, this.height,20202020);
                    this.graphics.endFill();
                }
    
          
        </mx:Script>
    </mx:HBox>
</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.Set Image Source to change image file for an Image controlSet Image Source to change image file for an Image control
43.Load Image With Load method from a disk fileLoad Image With Load method from a disk file
44.Move ImageMove Image
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
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.