4 Replies Latest reply on Feb 3, 2015 7:06 AM by farhadLightRiver

    why MultiDPIBitmapSource in BitmapFill dont work !!!!!

    farhadLightRiver

      here is my code:

      <s:Rect id="background2" left="0" right="0" top="0" bottom="0" percentWidth="100" percentHeight="100" radiusX="20" >
      <s:fill >
      <s:BitmapFill id="bgFill" fillMode="repeat">
      <s:source>
      <s:MultiDPIBitmapSource source160dpi="@Embed('images/backgroundSki/240/abiSefid.jpg')"
        source240dpi="@Embed('images/backgroundSkin/240/abiSefid.jpg')"
        source320dpi="@Embed('images/backgroundSkin/320/abiSefid.jpg')" />
      </s:source>
      </s:BitmapFill>
      </s:fill>
      </s:Rect>

        • 1. Re: why MultiDPIBitmapSource in BitmapFill dont work !!!!!
          Flex harUI Adobe Employee

          Do you get an compile error or runtime error?

          • 2. Re: why MultiDPIBitmapSource in BitmapFill dont work !!!!!
            farhadLightRiver Level 1

            it's not compile error it seems dont read MultiDPIBitmapSource  when it is in bitmapFill

            • 3. Re: why MultiDPIBitmapSource in BitmapFill dont work !!!!!
              Flex harUI Adobe Employee

              Well, it probably won’t help you immediately, but if you ask on the Apache Flex mailing list, maybe somebody will make it work.  And if you have skills to propose the code change to make it work, even better.

              • 4. Re: why MultiDPIBitmapSource in BitmapFill dont work !!!!!
                farhadLightRiver Level 1

                work with flash builder some times become so much complicated than another sdk's like visual stadio... we should take care about detail for example in MultiDPIBitmapSource help of flash builder say's:

                This class provides a list of bitmaps for various runtime densities.

                It is supplied as the source to BitmapImage or Image and as the icon of a Button . The components will use the Application.runtimeDPI to choose which image to display.

                so we cant use MultiDPIBitmapSource in bitmapFill in rect . also we maybe want use this code for solve problem:

                  <fx:Script> <![CDATA[ . . switch( FlexGlobals.topLevelApplication.runtimeDPI) { case DPIClassification.DPI_240 : bgFill.source = "images/backgroundSkin/160/image.jpg break; case DPIClassification.DPI_160 : bgFill.source = "images/backgroundSkin/160/image.jpg break; case DPIClassification.DPI_320 : bgFill.source = "images/backgroundSkin/160/image.jpg break; } . . ]]> </fx:Script> . . <s:Rect id="background2" left="0" right="0" top="0" bottom="0" width="100%" height="100%" > <s:fill> <s:BitmapFill id="bgFill" fillMode="repeat" /> </s:fill> </s:Rect> 

                but you can see this code also dont work i think the id of BitmapFill is anknown in script code .. any way the only way that worked for me was using of loader : . .

                .switch( FlexGlobals.topLevelApplication.runtimeDPI) { case DPIClassification.DPI_240 : loader.load(new URLRequest("images/backgroundSkin/240/image.jpg")); loader.contentLoaderInfo.addEventListener(Event.COMPLETE,loaderComplete); break; case DPIClassification.DPI_160 : loader.load(new URLRequest("images/backgroundSkin/160/image.jpg")); loader.contentLoaderInfo.addEventListener(Event.COMPLETE,loaderComplete); break; case DPIClassification.DPI_320 : loader.load(new URLRequest("images/backgroundSkin/320/image.jpg")); loader.contentLoaderInfo.addEventListener(Event.COMPLETE,loaderComplete); break; } } public function loaderCompleteHandler(evt:Event):void { bgFill.source = evt.target.content; }