0 Replies Latest reply on Mar 8, 2011 8:19 AM by bon_t

    How to resize display of audio waveform

    bon_t

      Hi All,

       

      I found the following code in Adobe Cookbooks for drawing an audio waveform from an MP3 file:

      http://cookbooks.adobe.com/post_Draw_an_audio_waveform_from_an_MP3_file-16767.html

       

      The MXML code to hold the display of the waveform is as follows:


      <mx:Canvas id="graph" backgroundColor="0xFFFFFF" backgroundDisabledColor="0xFFFFFF" width="100%" height="100%" backgroundAlpha="0">
         <mx:UIComponent id="slate" height="100%" width="100%"/>
      </mx:Canvas>

       

      I included in myMXML code a slider beneath the waveform display. Also, the display is inside a Group, which is itself inside a Canvas:


      <s:Group id="grpAudioFile" width="98%" height="10%" top="0" left="10" right="10">
         <mx:UIComponent id="slate" width="100%" height="100%" left="0" right="0"/>
         <s:HSlider id="audioSlider_2" y="46" width="100%" left="0" right="0" minimum="0" liveDragging="true" thumbDrag="dragStartHandler(event)" thumbRelease="dragDropHandler(event)" changeStart="sliderChangeStartHandler( event )" changeEnd="sliderChangeEndHandler( event )" stepSize="0.25"/>
      </s:Group>

       

      The issue that I'm having is that the display of the waveform does not resize at all when the container window is being resized, even though it has the same left and right attributes set as the slider, which resizes properly. The first screenshot shows a full-sized window, and hence the display of the waveform is fine. However, the second screenshot shows a resized window; the waveform display remains static and hence has the other resized components go over it.

       

      full-sized_window_waveform_display_OK.JPG

       

      resized_window_waveform_display_not_resized.JPG

       

      I read the following:
      The UIComponent class is not used as an MXML tag, but is used as a base class for other classes.

       

      Hence I looked at all of the subclasses of UIComponent to see if one is suitable for my task. I tried Graphic, but it didn't work either.

       

      Your help is much appreciated!
      Bonnie