Tuesday, September 7, 2010

Skype in Flash (Actionscript 3)

Today we will learn how to call someone on Skype, start a chat, send a file, send a voicemail, add to contacts and view profile using Actionscript 3!

Here is a little application I made (to use it, you'll need Skype client and a Skype account):


It might ask your permission to open the program, you should allow.

Adding Skype functions to your Flash is actually very simple. It's just a link. Look:

btn_call.addEventListener(MouseEvent.CLICK, cl_call);

function cl_call(evt:MouseEvent):void {
    navigateToURL(new URLRequest("skype:SkypeName"));
 }

If you use the code above, you will call a person with a Skype username of SkypeName. You can also pass parameters through the URL. This code does the same thing as the one above:

btn_call.addEventListener(MouseEvent.CLICK, cl_call);

function cl_call(evt:MouseEvent):void {
    navigateToURL(new URLRequest("skype:SkypeName?call"));
 }

You can also call numbers. Just enter a number instead of the Skype username with a plus in front. For example, +123123123.

You can start a chat by putting ?chat as the parameter:

navigateToURL(new URLRequest("skype:SkypeName?chat"));

You can send voicemails:

navigateToURL(new URLRequest("skype:SkypeName?voicemail"));

You can view his profile:

navigateToURL(new URLRequest("skype:SkypeName?userinfo"));

You can add him to contacts:

navigateToURL(new URLRequest("skype:SkypeName?add"));

Or send a file:

navigateToURL(new URLRequest("skype:SkypeName?sendfile"));

You can also start a call conference with multiple users. You have to pass them all as the parameters:

navigateToURL(new URLRequest("skype:SkypeName1;SkypeName2;SkypeName3?call"));

But you can also chat with them, if you like:

navigateToURL(new URLRequest("skype:SkypeName1;SkypeName2;SkypeName3?chat"));

If the user does not have Skype installed and tries to use any of these functions, his browser will warn him about not having the program.

Hope this helped! Thanks for reading.

3 comments:

Tod Poirier said...

do you have to be running the flash document through a browser or will a flash app also do this? I've got a project coming up where the client wants me to do this.

Kirill Poletaev said...

It works the same everywhere.

Isabel said...

im trying to connect from my app in the ipad to skype in my ipad... would this work?

Post a Comment