• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to call external javascript file in actionscript file

 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I want to call a function in an external javascript file from actionscript file. This javascript function is common to most of the pages so we separated that code and saved it as a .js file. Now I want to call this from action script, so that I can get the value received by javascript function in actionscript and set that value to datagrid.

for example the location of the .js file is in webcontent/scripts folder. And actionscript file is in src/com/abc.flex/result.as

Can anyone guide me in acheiving this.
 
Ranch Hand
Posts: 93
Python Redhat Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use ExternalInterface.call() method, 1st argument is the name of the javascript function.

 
Raaja Gotluru
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI Karthik,

Thanks for the reply. Does this will call a js file from other location. How the actionscript will know the location of the JS file. Some where we need to refer right.

Please clarify me.
 
Karthik Jayachandran
Ranch Hand
Posts: 93
Python Redhat Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry for late reply.

You need to include javascript file in your html template file. Template file will be most likely in Project folder-->html-template-->index.template.html
 
Raaja Gotluru
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Karthik,

Thanks for the solution. But I solved it in the reverse way using



and in Javascript I used

 
Did you just should on me? You should read this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic