Posted By

chrisaiv on 11/04/09


Tagged

flickr Flex as3


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

mali
quan


Flex: Smooth a Dynamic Image coming from Flickr


 / Published in: ActionScript 3
 

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

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

  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>

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: kanukukreja on December 4, 2009

Getting error : Cannot resolve attribute 'smoothBitmapContent' for component type mx.controls.Image.

Posted By: chrisaiv on December 9, 2009

My first question to you is, are you using the Flex 4 SDK? If so, are you using Flash Builder 4?

If both of your answers are "yes", then within Flash Builder 4, you should be able to use code hinting to see what is the problem with the attributes.

You need to login to post a comment.