views:

21

answers:

0

Hi

I created a 9-scalled background in Flash CS5 which is working fine in Flash CS5

But when i imported it as embeded graphic in Flex, and change dimensions in runtime, 9-scalling doesnt work.

Here is my code.

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
              xmlns:s="library://ns.adobe.com/flex/spark" 
              xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
 <fx:Script>
      <![CDATA[
           import mx.events.FlexEvent;



           [Embed(source='mgraphic.swf', symbol='Bck')] 
           [Bindable] 
           public var imgCls:Class;


           protected function button1_clickHandler(event:MouseEvent):void
           {
                nineScalled.width = 100 + (this.width - 100) * Math.random(); 
                nineScalled.height = 100 + (this.height - 100) * Math.random();
           }

      ]]>
 </fx:Script>
 <s:layout>
      <s:VerticalLayout verticalAlign="middle" horizontalAlign="center"/>
 </s:layout>

 <s:Button label="change" click="button1_clickHandler(event)"/>
 <s:BorderContainer id="nineScalled" backgroundImage="{imgCls}" backgroundImageFillMode="scale" width="469" height="187"/>
 </s:Application>

Here is the fla file of my 9-scalled file http://rapidshare.com/files/405441500/9scalledgraphic.fla

Thanks