Javascript and Flex/Actionscript

Embedding JS code within Flex

Page 1 of 1

3 Replies - 1292 Views - Last Post: 21 January 2009 - 08:34 PM

#1 c44-9w  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 9
  • Joined: 10-November 08

Javascript and Flex/Actionscript

Post icon  Posted 21 January 2009 - 11:25 AM

Hi, I am new to Flex and would like some advice. I have a JS function that I would like to use within my Flex application. Can I embed/include the JS as is? Or do I need to convert the code to Actionscript or Flex? Which is more efficient? The code is triggered by the mouse_move so it needs to be responsive. I would appreciate any suggestions/advice. Thanks -b
Is This A Good Question/Topic? 0
  • +

Replies To: Javascript and Flex/Actionscript

#2 BetaWar  Icon User is offline

  • #include "soul.h"
  • member icon

Reputation: 1105
  • View blog
  • Posts: 6,918
  • Joined: 07-September 06

Re: Javascript and Flex/Actionscript

Posted 21 January 2009 - 04:32 PM

Depending on what the function does you may want to have it in your AS (for the flex/ flash app) but there are some cases where AS can't do what you want it to, at which point it is better to be doing things via JS and using an AS 2 JS communication library. You can find one of those libraries at adobe.com

HTH
Was This Post Helpful? 0
  • +
  • -

#3 c44-9w  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 9
  • Joined: 10-November 08

Re: Javascript and Flex/Actionscript

Posted 21 January 2009 - 05:08 PM

Ok, thanks, I'll check out the library. The function itself is converting a map x/y coordinate from an Albers projection to latitude/longitude value for display. Lots of variables and equations - - pretty much straight mathmatics.
Was This Post Helpful? 0
  • +
  • -

#4 BetaWar  Icon User is offline

  • #include "soul.h"
  • member icon

Reputation: 1105
  • View blog
  • Posts: 6,918
  • Joined: 07-September 06

Re: Javascript and Flex/Actionscript

Posted 21 January 2009 - 08:34 PM

If that is the case you could just port it to Actionscript, that would probably be easiest (as people won't be able to easily steal your work).
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1