4 Replies Latest reply on Aug 3, 2009 11:02 AM by Paul Reilly

    Subclassing Vector

    ryanberdeen

      Hi,

       

      The API documentation for the Vector class explicitly mentions creating a Vector subclass: http://livedocs.adobe.com/flex/3/langref/Vector.html#splice(): "Note: To override this method in a subclass of Vector, use…"

       

      However, when I try to create a vector subclass, I encounter one of two problems:

       

      package com.ryanberdeen.soundtouch {
          public class FifoSampleBuffer extends Vector.<Number> {
          }
      }

       

      This compiles without error or warning using mxmlc 3.3.0. However, when loaded (in the debug player), I get the error "VerifyError: Error #1103: Class com.ryanberdeen.soundtouch::FifoSampleBuffer cannot extend final base class."

       

      Or,

       

      package com.ryanberdeen.soundtouch {
          public class FifoSampleBuffer extends Vector {
          }
      }

       

      This causes an error when compiling:

      src/com/ryanberdeen/soundtouch/FifoSampleBuffer.as(2): col: 43 Error: Base class is final.
      
          public class FifoSampleBuffer extends Vector {
                                                ^

       

      Which are wrong?

      • the ASDoc which says you can subclass Vector
      • mxmlc, which compiles a class that won't load
      • AVM2, which won't load the Vector subclass
      • me, who possibly did something stupid

       

      Thanks