Copy link to clipboard
Copied
I would like to support both 'an' and 'fl' (yes i know it's trivial, but if adobe decides to get rid of 'fl' then im set). Is this the correct code to use?
var ANIMATE_VERSION = ( fl.version.split(" ")[1].split(",")[0] >= 13 ) ? "CC" : "CS" ;
var AN = ( ANIMATE_VERSION == "CC" ) ? an : fl ;
Okay, first, this is pointless. The probability that Adobe will ever drop "fl" is basically zero. It costs nothing to keep around, and would break countless scripts if removed. There is literally no reason to drop it, and a massive reason to keep it.
That being said, IF there was any need for this (which there isn't), version checking is the wrong approach (your code wouldn't even work if fl didn't exist because it uses fl to access the version number). Always go with feature detection if you
...Copy link to clipboard
Copied
Hi,
Currently, we use "fl" everywhere in our code, but I was concerned about this issue in the future, too. I am curious - how you plan to switch between "fl" and "an" dynamically?
On your question - yes, I think so. In my opinion, "an" was introduced in AA2014, so the version number you shoud check about is 13.
Best regards!
Copy link to clipboard
Copied
If you look at the code above, I use AN instead of fl or an
Copy link to clipboard
Copied
Okay, first, this is pointless. The probability that Adobe will ever drop "fl" is basically zero. It costs nothing to keep around, and would break countless scripts if removed. There is literally no reason to drop it, and a massive reason to keep it.
That being said, IF there was any need for this (which there isn't), version checking is the wrong approach (your code wouldn't even work if fl didn't exist because it uses fl to access the version number). Always go with feature detection if you can.
fl = typeof fl === "object" ? fl : an;
But seriously, don't actually use this.
Copy link to clipboard
Copied
While you're probably right, I've seen companies make drastic changes like this. I would even argue that it's equally pointless to introduce 'an' in Animate, but there it is.
Thanks for your solution btw!
Copy link to clipboard
Copied
They probably only added "an" because doing so was trivial. Just a "an = fl" somewhere in the code.