Skip to main content
Inspiring
December 4, 2019
Answered

Is this the correct way to determine if using 'an' or 'fl' when developing tools in jsfl?

  • December 4, 2019
  • 1 reply
  • 1193 views

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 ;



This topic has been closed for replies.
Correct answer ClayUUID

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.

1 reply

Vladin M. Mitov
Inspiring
December 4, 2019

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!

 

 

- Vlad: UX and graphic design, Flash user since 1998Member of Flanimate Power Tools team - extensions for character animation
Inspiring
December 4, 2019

If you look at the code above, I use AN instead of fl or an

ClayUUIDCorrect answer
Legend
December 4, 2019

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.