Image Load Event : Image Event « Graphics « Flex






Image Load Event

Image Load Event
           

<!--
Code from Flex 4 Documentation "Using Adobe Flex 4".

This user guide is licensed for use under the terms of the Creative Commons Attribution 
Non-Commercial 3.0 License. 

This License allows users to copy, distribute, and transmit the user guide for noncommercial 
purposes only so long as 
  (1) proper attribution to Adobe is given as the owner of the user guide; and 
  (2) any reuse or distribution of the user guide contains a notice that use of the user guide is governed by these terms. 
The best way to provide notice is to include the following link. 
To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/

-->



<!-- sparktextcontrols/LoadImageEvent.mxml -->
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:mx="library://ns.adobe.com/flex/mx"
    xmlns:s="library://ns.adobe.com/flex/spark" creationComplete="initApp()">
    <fx:Script>
         
        import flashx.textLayout.events.StatusChangeEvent; 
        import flashx.textLayout.elements.*; 
        import flashx.textLayout.*; 
        [Bindable] 
        private var textFlow:TextFlow; 
        private var img:InlineGraphicElement; 
        private function initApp():void { 
            textFlow = new TextFlow(); 
            textFlow.addEventListener(StatusChangeEvent.INLINE_GRAPHIC_STATUS_CHANGE,sizeGraphic); 
            var p:ParagraphElement = new ParagraphElement(); 
            img = new InlineGraphicElement(); 
            img.source = "a.gif"; 
            p.addChild(img); 
            textFlow.addChild(p); 
        } 
        private function sizeGraphic(e:StatusChangeEvent):void { 
            if (e.status == "ready" || e.status == "sizePending") { 
                img.height = img.measuredHeight; 
                img.width = img.measuredWidth; 
            } 
        } 
      
    </fx:Script>
    <s:layout>
        <s:VerticalLayout />
    </s:layout>
    <s:Panel title="Sizing Inline Graphic Image" width="90%" height="90%"
        horizontalCenter="0" verticalCenter="0">
        <s:RichEditableText id="richTxt" textAlign="justify" width="100%"
            textFlow="{textFlow}" />
    </s:Panel>
</s:Application>

   
    
    
    
    
    
    
    
    
    
    
  








Related examples in the same category

1.Image resize eventsImage resize events
2.Use default event mode to track loading progress of an image using the Image controlUse default event mode to track loading progress of an image using the Image control
3.Image click eventImage click event
4.Use default event mode to track the progress of loading an image by using the Image controlUse default event mode to track the progress of loading an image by using the Image control