views:

273

answers:

0

I'm new at this and I've been trying to dynamically load images/swf files into a HorizontalList. As the user scales the application, the HorizontalList scales, but the images don't.

I've been able to get images to scale within a Canvas object, but I've had no luck with the HorizontalList.

Note, I'm using ObjectProxy to get rid of weird warnings.

Here is the code so far:

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication
  xmlns:mx="http://www.adobe.com/2006/mxml"
  horizontalAlign="center"
  verticalAlign="middle"
  layout="absolute"
  creationComplete="main()">

  <mx:Array id="imageDataProvider" />

  <mx:VBox
         horizontalAlign="center"
         width="100%" height="100%"
         verticalGap="0" borderStyle="solid"
         horizontalScrollPolicy="off"
         verticalScrollPolicy="off">
    <mx:HorizontalList
      borderStyle="solid"
      borderColor="#ff0000"
      width="100%"
      height="100%"
      dataProvider="{imageDataProvider}">
      <mx:itemRenderer>
        <mx:Component>
          <mx:Image scaleContent="true" maintainAspectRatio="true" percentWidth="100" percentHeight="1
        </mx:Component>
      </mx:itemRenderer>
    </mx:HorizontalList>
  </mx:VBox>
  <mx:Script>
<![CDATA[
import mx.utils.ObjectProxy;

public function main():void
{
  var element:Object = new Object();
  element.label = "Woot";
  element.image_url = "http://www.google.com/intl/en_ALL/images/logo.gif";

  imageDataProvider.unshift( new ObjectProxy( element ) );
} // end of main
]]>
  </mx:Script>
</mx:WindowedApplication>

related questions