Author Topic: How to apply java script on NavigationalBar functio button  (Read 8152 times)

rbaybayan

  • Full Member
  • ***
  • Posts: 54
How to apply java script on NavigationalBar functio button
« on: February 03, 2010, 08:33:31 AM »

Hi Florian,

I am trying to figure out on how can I add-in a java script to the button.
Inspired by lightbox; a readily API function from Addthis.com have this code and
wanted only the box to be shown during mouse over and mouse click on the selected button (see attached picture)

Below is the code which can be found from( http://addthis.com/web-button?type=bm&where=website&url=&bm=bn3&analytics=0):

<!-- AddThis Button BEGIN -->
<a class="addthis_button" href="http://addthis.com/bookmark.php?v=250&amp;username=xa-4b69202364f0fc86"><img src="http://s7.addthis.com/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/>[/url]<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#username=xa-4b69202364f0fc86"></script>
<!-- AddThis Button END -->


I appreciate if you can give working sample to add-in the above code.

Thanks,

Ruel

Florian Nücke

  • κρύα πόδια
  • Administrator
  • Hero Member
  • *****
  • Posts: 1979
  • MegaZine3 Developer
    • MegaZine3
Re: How to apply java script on NavigationalBar functio button
« Reply #1 on: February 03, 2010, 10:48:06 PM »
Well, I don't know what the script does, but it's not possible to load external JavaScript files "into" Flash, so that won't work. Assuming it does nothing important (no actual functionality, just GUI behavior) you could just rebuild the button via ASUL, though, e.g.
  1. <box width="125" height="16" title="Bookmark and Share" url="http://addthis.com/bookmark.php?v=250&amp;username=xx-1234567890" background="image(Themes/default/images/smflogo.png)" x="25" y="20"/>



You'll want to use another image of course. You probably won't be able to link to the one's on the appthis.com domain directly due to crossdomain loading restrictions in Flash, so you'll have to copy them to your server.

If the JavaScript is actually necessary (e.g. for click tracking or so) you can't go that way. Either you need a precaller function that's triggered by the button (url="javascript:yourFunc();") which then does the tracking stuff, or write a small plugin in which you load the addthis Flash API (there appears to be one, just had a quick look at their site).
For the Snark was a Boojum, you see.

Before you ask a question
          After you get an answer
  • please document your problem with the answer in the Project Wiki. (e.g. in the FAQs)
  • help others out if you can, by answering their questions on the forum.

rbaybayan

  • Full Member
  • ***
  • Posts: 54
Re: How to apply java script on NavigationalBar functio button
« Reply #2 on: February 10, 2010, 06:15:32 PM »
Hi,

I intend to have a pop-up box but not too sure on how to do the plugin for external calling. on the widget.js

My intention is to have the customized button click pop-up windowd generated by the addthis widget.js. There is also a swf available but how to incorporate this external swf plugin.

I 've got the swf in other forum:
http://blog.robertabramski.com/2009/07/08/addthis-popup-menu-in-flash/

It is also available from addthis website
http://addthis.com/help/custom-buttons

Thanks for your help and I appreciate if you can provide the guidelines. I try to follow your instruction but somehow my AS3 swf does not work.