Using addThis in flash as3 builds
This may exist elsewhere, it may not ( I couldn't find it), but here's a super simple static class for tying addThis functionality to your flash applications. This is a real basic release that is offered as-is. Currently it only has 5 static constants for the msot popular sites, obviously you can add to that list.




June 1st, 2009 - 15:26
Hi – I just came across this and this is exactly what I’ve been looking for.
But…I’m getting this error:
“packages cannot be nested”
Any idea of what I’m doing wrong?
Thanks so much!
June 1st, 2009 - 15:35
diane:
My first blush guess would be that you copied the code from the .as file into the timeline – is that what you did? that will always generate the 1037 package nesting error, as any code on the timeline is related to the document class, so a package referecne within timeline is effectively nesting packages. Simple solution is use the class as-is, externally. AS3 is generally nor done on the timeline but in external AS files. do this:
import com.jeffdePascale.addthis.AddThis;
AddThis.invoke([add the params here]);
That should do it if you add the com folder in the zip file to your publish directory.
Hope that helps!
-Jeff
July 23rd, 2009 - 15:04
Jeff,
This works great, do you know how to get the mail link working?
Thanks,
-Nick
July 23rd, 2009 - 15:18
Nick:
The addThis email functionality uses a custom window with a form – the same thing could be built within flash, but to send the mail off via addThis, I’d search their forums to see fi you can find an exposed mailto service in their API, i haven’t looked yet. So the short answer is…No, I dont know how to get the mail link working, sorry! If I get a minute to dig I’ll see if I can find anything.
September 11th, 2009 - 07:29
Hi Jeff
I have downloaded the addthis_as3.zip file, but im dont know how to implement this so pls kindly send me brief steps with screen shots…
With Regards
R.Anandhakumar
September 14th, 2009 - 14:44
1 – drop the com folder in your classpath (if you havent defined one, do so in preferences->actionscript->actionscript 3 settings).
2 – import com.jeffdePascale.AddThis;
3 – make your call as AddThis.invoke( [params go here] ).
It’s a relatively basic static class implementation, if you need more information on using static classes, check out the docs at Adobe for using static methods.
September 15th, 2009 - 08:40
Hi,
I have understood 1st 2 steps…
In 3rd step I didn’t understood…
Were I have to make call of AddThis.invoke…
and What do u mean [Params go here]…
Plz kindly send me a demo file…
Mail at : ranandh85 at gmail dot com
With Regards,
R.Anandha Kumar
September 16th, 2009 - 17:26
I think you may have missed what this class does – it does not throw open the addThis panel you are used to seeing. Rather, this is designed to allow you to custom design your own visuals for the front end, circumventing the usage of the AddThis panel in the first place (although you should place their logo in the panel since you are using their service), and tie the click functionality of the button to the addThis api. So, if you make a button with the facebook logo, in the event handler you would call AddThis.invoke(). The parameters, if you look at the class provided, are:
- type: which service to send the link to (these are statically defined in the class for a few but you can call any service they connect to)
- url: the url you are bookmarking
- title: the text you want to appear in the bookmark title area
- id: a unique identifier for your addThis campaign. its used by addThis for determining when tags are collective, doesnt really do much for us as users of the service.
So…your call in the event handler may look like this (this example would add a link to yahoo on a users facebook page):
AddThis.invoke(AddThis.FACEBOOK, “http://www.yahoo.com”, “My link to yahoo”, “myCampaignIdentifier”);
there’s no point in sending a code example because that’s basically it above, all you need to do is customize that call for you and place it in a button click event handler. From there its up to you to style and place the visuals how you like. Hope that helps.
October 16th, 2009 - 20:23
Jeff,
This is exactly what I have been looking for thank you! You have saved me hours of messing round!
It’s a pity some of the guys above can’t just read your instructions they’re pretty clear.
Much appreciated,
Adam