The following example shows how you can set the resize mode on a Flex Gumbo BitmapO,age object by setting the resizeMode property to one of the static constants in the BitmapImageResizeMode class.
Full code after the jump.
To use the following code, you must have Flash Player 10 and a Flex Gumbo SDK installed in your Flex Builder 3. For more information on downloading and installing the Gumbo SDK into Flex Builder 3, see “Using the beta Gumbo SDK in Flex Builder 3″.
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/halo">
<s:layout>
<s:VerticalLayout />
</s:layout>
<fx:Script>
<![CDATA[
import mx.events.IndexChangedEvent;
import spark.primitives.BitmapImageResizeMode;
protected function dropDownList_selectionChanged(evt:IndexChangedEvent):void {
bitmapImg.resizeMode = dropDownList.selectedItem;
}
]]>
</fx:Script>
<mx:ApplicationControlBar width="100%" cornerRadius="0">
<mx:Form styleName="plain">
<mx:FormItem label="resizeMode:">
<s:DropDownList id="dropDownList"
prompt="Please select a resize mode:"
selectionChanged="dropDownList_selectionChanged(event);">
<s:dataProvider>
<s:ArrayList>
<fx:String>{BitmapImageResizeMode.NORMAL}</fx:String>
<fx:String>{BitmapImageResizeMode.REPEAT}</fx:String>
<fx:String>{BitmapImageResizeMode.SCALE}</fx:String>
</s:ArrayList>
</s:dataProvider>
</s:DropDownList>
</mx:FormItem>
<mx:FormItem label="percentWidth:">
<s:HSlider id="sliderH"
minimum="10"
maximum="90"
liveDragging="true" />
</mx:FormItem>
<mx:FormItem label="percentHeight:">
<s:HSlider id="sliderV"
minimum="10"
maximum="90"
liveDragging="true" />
</mx:FormItem>
</mx:Form>
</mx:ApplicationControlBar>
<s:Group width="100%" height="100%">
<s:BitmapImage id="bitmapImg"
source="@Embed('assets/fx_appicon-tn.gif')"
percentWidth="{sliderH.value}"
percentHeight="{sliderV.value}"
horizontalCenter="0"
verticalCenter="0" />
</s:Group>
</s:Application>

{ 4 comments… read them below or add one }
Note there’s currently a bug related to embedding a graphic when it’s scale-9 values are set. The resize mode of scale does not respect the scale-9 grid: http://bugs.adobe.com/jira/browse/SDK-17289
Hi,
I would like to be able to implement support for partial downloads of large files in my app. (i.e. if the connection broke or user stopped the download partway etc)
It appears as if there are no solutions for being able to use content-range, range-request HTTP headers in either UrlStream w/UrlRequestHeader or anything in AIR/Flex/AS3? Is this true?
Any pointers appreciated as to how this could be implemented or if anyone knows of any existing libs/tools out there that do this.
darron,
Bug SDK-17289 was fixed in SVN revision #4612.
Peter
Example updated to Flex SDK build 4.0.0.7378.