Highlighted

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

Explorer ,
Dec 04, 2019

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 ;



Adobe Community Professional
Correct answer by ClayUUID | Adobe Community Professional

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.

Topics

ActionScript, Code, Exchange extensions

Views

567

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

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

Explorer ,
Dec 04, 2019

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 ;



Adobe Community Professional
Correct answer by ClayUUID | Adobe Community Professional

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.

Topics

ActionScript, Code, Exchange extensions

Views

568

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Explorer ,
Dec 04, 2019

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!

 

 

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Explorer ,
Dec 04, 2019

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Dec 04, 2019

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Explorer ,
Dec 04, 2019

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!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
ClayUUID LATEST
Adobe Community Professional ,
Dec 04, 2019

Copy link to clipboard

Copied

They probably only added "an" because doing so was trivial. Just a "an = fl" somewhere in the code.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...