Flex: Smooth a Dynamic Image coming from Flickr


/ Published in: ActionScript 3
Save to your folder(s)

Lee Brimelow show's how to smooth an image that is loading from Flickr.


Copy this code and paste it in your HTML
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <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">
  3.  
  4. <fx:Script>
  5. <![CDATA[
  6. import mx.events.FlexEvent;
  7. import flash.net.navigateToURL;
  8. protected function image1_clickHandler(event:MouseEvent):void
  9. {
  10. navigateToURL(new URLRequest("http://www.flickr.com/photos/"+this.data.owner+"/"+this.data.id));
  11. }
  12.  
  13. [Bindable]
  14. public var loaderContext:LoaderContext;
  15.  
  16. private function imageInit():void {
  17.  
  18. loaderContext = new LoaderContext();
  19. loaderContext.checkPolicyFile = true;
  20. im.load("http://farm"+data.farm+".static.flickr.com/"+data.server+"/"+data.id+"_"+data.secret+"_s.jpg");
  21. }
  22.  
  23. ]]>
  24. </fx:Script>
  25.  
  26. <s:states>
  27. <s:State name="normal"/>
  28. <s:State name="hovered"/>
  29. <s:State name="selected"/>
  30. </s:states>
  31.  
  32. <mx:Image creationComplete="imageInit()" smoothBitmapContent="true" loaderContext="{loaderContext}" id="im" toolTip="{data.title}"
  33. click="image1_clickHandler(event)" buttonMode="true" width="50" height="50"
  34. d:userLabel="Layer 10 copy 4" x="0" y="0" maintainAspectRatio="false"/>
  35.  
  36. <s:Rect d:userLabel="Item Highlight" width="50" height="50">
  37. <s:stroke>
  38. <s:SolidColorStroke weight="2" color.normal="0x666666" color.selected="0xFFFFFF" color.hovered="0xFFFFFF"/>
  39. </s:stroke>
  40. </s:Rect>
  41. </s:ItemRenderer>

URL: http://latinflashtour.com/srcview/source/components/RepeatedItem4.mxml.html

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.