/ Published in: ActionScript 3
Lee Brimelow show's how to smooth an image that is loading from Flickr.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?xml version="1.0" encoding="utf-8"?> <s:ItemRenderer xmlns:s="library://ns.adobe.com/flex/spark" xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:d="http://ns.adobe.com/fxg/2008/dt" xmlns:mx="library://ns.adobe.com/flex/halo"> <fx:Script> <![CDATA[ import mx.events.FlexEvent; import flash.net.navigateToURL; protected function image1_clickHandler(event:MouseEvent):void { navigateToURL(new URLRequest("http://www.flickr.com/photos/"+this.data.owner+"/"+this.data.id)); } [Bindable] public var loaderContext:LoaderContext; private function imageInit():void { loaderContext = new LoaderContext(); loaderContext.checkPolicyFile = true; im.load("http://farm"+data.farm+".static.flickr.com/"+data.server+"/"+data.id+"_"+data.secret+"_s.jpg"); } ]]> </fx:Script> <s:states> <s:State name="normal"/> <s:State name="hovered"/> <s:State name="selected"/> </s:states> <mx:Image creationComplete="imageInit()" smoothBitmapContent="true" loaderContext="{loaderContext}" id="im" toolTip="{data.title}" click="image1_clickHandler(event)" buttonMode="true" width="50" height="50" d:userLabel="Layer 10 copy 4" x="0" y="0" maintainAspectRatio="false"/> <s:Rect d:userLabel="Item Highlight" width="50" height="50"> <s:stroke> <s:SolidColorStroke weight="2" color.normal="0x666666" color.selected="0xFFFFFF" color.hovered="0xFFFFFF"/> </s:stroke> </s:Rect> </s:ItemRenderer>
URL: http://latinflashtour.com/srcview/source/components/RepeatedItem4.mxml.html