How can I tell when a method or property was added in Flash Player or Flex SDK?

I recently found a method ( ByteArray.clear () ) that is complaining about FlexBuilder, possibly undefined; however, this method is actually documented in Flex LiveDocs. It must be added to a later SDK version than I have installed. I am not asking about this particular method, but I am giving it an example of a documentation problem that I am trying to solve. My questions:

  • How do I determine which version of the SDK or Flash player was added to a method or property?
  • How do I find out which SDK versions are supported by Flash Player versions?

I want to be able to determine from the documentation, instead of compiler or runtime errors, which SDK and Flash Player versions are needed to support newly added methods.

In Java, I'm looking for the @since javadoc tag when I need to know this, but I can't find an equivalent function in the Flex docs.

+2


source to share


3 answers


Often the documentation states that this property is available as the Flashyer xyz version. Unfortunately, even if you can look at the documentation, and the documentation can CLAIM for the function to exist (and in the case of ByteArray, of course it does ), sometimes the compiler just glitches and throws a hiss.

Your best bet is to make sure you have the most recent Flex dev version. and make sure you are publishing the latest release (Flash> = 10). This is done by relying on the documentation here: http://livedocs.adobe.com/flex/3/langref/index.html .



After that, this is the cross fingers and pray method. Unfortunately.

+1


source


Based on what James suggested you use this code:

        try
        {
            // Use the clear method if the flash player supports it (10+)
            this.swf['clear']();
        }
        catch (e:Error)
        {
            // Must be flash player 9 or lower so free the variable
            this.swf = new ByteArray();
        }

      



There might be a better way to clear / free the ByteArray memory in older versions of the player, so let me know if there is one.

0


source


ByteArray is a Flash Player class, not a Flex class. Flash Player APIs are implemented at runtime, so they are tied to specific Flash Player releases. Usually ASDoc indicates when the API was added. But in this case it seems that it is not. So, here are a few things to try:

  • Compiler error workaround (may result in a runtime error if you are using FP version that does not have a clear method): byteArray['clear']()

  • Change the FP version used in Flex to 10 to see if this was possibly added in FP 10 and for some reason it was not listed in the ASDoc.
  • Flex uses the playerglobal.swc file as stubs for the FP API. It is possible that the SWC does not include something that is needed. In this case, you should record the error .
-1


source







All Articles