3 Replies Latest reply on Apr 12, 2010 11:03 PM by Shongrunden

    How to set Source of s:BitmapFill dinamicaly? (CODE INSIDE)


      In Flash Builder (flex 4) I try to use next code to set selected by user (from file system) Image as a repeated background. It worked with mx:Image but I want to use cool repited capabiletis of s:BitmapFill.


      BTW: Technic I use also does not work with S:BitmapImage. Also FP does not return any errors. What Shall I do with my code to make it work?


      <?xml version="1.0" encoding="utf-8"?>
      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                  xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"                                     xmlns:net="flash.net.*">
              import mx.controls.Alert;
              import mx.utils.ObjectUtil;
              private  function btn_click(evt:MouseEvent):void  {
                 var arr:Array = [];
                  arr.push(new FileFilter("Images", ".gif;*.jpeg;*.jpg;*.png"));
              private  function fileReference_select(evt:Event):void  {

              private  function fileReference_complete(evt:Event):void {
                  img.source = fileReference.data;

           <net:FileReference id="fileReference"
                           complete="fileReference_complete(event);" />
        <s:Rect id="backgroundRect" left="0" right="0" top="0" bottom="0">
              <s:BitmapFill id="img" source ="@Embed('1.jpg')" fillMode="repeat" />
              <mx:Button id="btn"
                        label="Browse and preview..."
                        click="btn_click(event);" />


      Any ideas?