Build a Facebook Like for Flash Player button, no AIR.

Hello

I need to have a Facebook Like button in a SWF application. It needs all the standard as button features and behaviors, including the button share and the similar meter.

Like that.

Facebook Like button

Someone has solutions and or suggestions? Tutorials? Done solutions free or paid?

Thank you!

the first paragraph explains the easiest way to do it.

the last paragraph provides facebook change their api javascript and break the ActionScript api facebook.

JavaScript of Facebook API

In this section, I'll show how would you use the the Facebook JavaScript API you can so see how to use a JavaScript API with the next hot social networking site before an ActionScript API is available or with Facebook if they change their policy cross-domain (like Twitter) file.

Facebook has a REST API (http://en.wikipedia.org/wiki/Representational_state_transfer) they disapproved in favor of what they call their graphics API. Their graphic API looks more like a name change as a change in the peaceful principles that you can read, if you are interested in the aforementioned wikipedia page.

In any case, without divergent in theory, you can use Facebook with http (http://developers.facebook.com/docs/reference/api/) requests. I will address that in the Google section +.

If there is no ActionScript API for Facebook, you can use the Facebook JavaScript API to communicate between your game and Facebook.  Whether JavaScript in your SWF to html page integration. (There is a way to inject JavaScript into the html Embed page using ActionScript code, which I'll cover in the section Google +.)

And you use the ActionScript ExternalInterface class to communicate between JavaScript in your html Embed page and the ActionScript code in your swf file. (See Fig11-08).

Insert Fig11 - 08.tif *.

[Diagram showing how ActionScript can communicate with Facebook.  Everything on the left is in embed html page your SWFs.]

To simplify Facebook and ActionScript communication, I will start by explaining the ActionScript and JavaScript communication.  (See Fig11-09).

ActionScript and JavaScript Communication

Insert Fig11 - 09.tif *.

[Diagram showing how ActionScript can communicate with JavaScript.]

I need ActionScript code that sends data to JavaScript and ActionScript code that listens to the data that are sent from JavaScript to ActionScript.  Here is the ActionScript code used to send the value of the variable some_data from ActionScript to JavaScript:

  1. ExternalInterface.call("saveglobalscore",score) ("fromSWF", some_data);

Here is the ActionScript code used to listen to the data that are sent from JavaScript to ActionScript:

  1. ExternalInterface.addCallback("IsStatic",IsStatic) ("swfF", this.fromJS);

function fromJS(value:String):void {}

do something with the value

}

To use one of the people you must import the ExternalInterface class:

to import flash.external.ExternalInterface;

The call and addCallback methods are static methods of the class ExternalInterface and are therefore still applied exactly as shown.  The first parameter in the method call is the name of the JavaScript function (always in quotes) and the second parameter is the data (in option), that you want to send to the JavaScript function.   Under this chapter, this second parameter should be limited to a string, an array or associative array.

The first parameter of the method addCallback is the name of the JavaScript function (in quotes) and the second parameter is a function name in the scope (code addCallback) (no quotes).

I also need to swfF and fromSWF of JavaScript functions.  They can be something as simple as

          return "test return of js fromSWF()."

}

The function thisMovie should not be changed.  It is necessary for JavaScript ActionScript communications.

The toSWF function calls thisMovie and passes it the name of your SWF (without the quotes and swf dot suffix).  If you change thisMovie or fail to pass the correct name of swf to thisMovie and JavaScript-ActionScript communication fails.

Annexed to thisMovie (swf_name) is the name of the function (without the quotation marks) used in the method addCallback (with quotes) ActionScript.

In addition, for everything you need to use swf integrating code that is compatible with the ExternalInterface class.  This is the embed code sample that works with ExternalInterface and incorporates a game_01.swf.

width = "500" height = "375" name = "game_01" align = "middle".

play = "true" loop = "false" quality = "high" allowScriptAccess = "sameDomain".

Type = "application/x-shockwave-flash".

pluginspage ="http://www.macromedia.com/go/getflashplayer" > ".

This isn't the only code that allows you to embed a swf file and work with ExternalInterface. SWFObject (http://code.google.com/p/swfobject/) can also be used to embed a swf file and it works well with ExternalInterface.

With both methods of incorporation, you just change the swf name references, color size and back of the stage in the embed code. With the above integration code, there are four references to game_01 you should change to match the name of your swf file and your should change the width, height and the bgcolor in two places to match the background color, height and width of your swf.

With the embed code above for game_01, the toSWF function should be

function toSWF (value) {}

thisMovie("game_01").swfF (value);  change game_01 to match the name of your swf file

}

Bringing together all that gives the following embed html file and the following ActionScript document class code.  These files are located in the management of the files/Chapter 11/facebook/fb1.

Tags: Adobe Animate

Similar Questions

  • How can I save the iphoto for flash player library

    How can I save the iphoto for flash player library

    Where is the flash player? It is external, or what?

    Barry

  • code Ox643 error when you try to install the update of security for flash player (KB923789)

    I get the error code Ox643 when you try to install the update for flash player (KB923789) security - after Mr fixit running and the application of other measures recommended, I still have the error code and get the installation error code. What should I do now?

    Is Adobe Flash Player v11.3.300.257 (or higher) installed? Test here using Internet Explorer (only!)-online http://www.adobe.com/products/flash/about/

  • Have Windows XP - How to upload photos of my files for flash player?

    I have Windows XP - How can I upload photos from my files for flash player?

    Something to try...

    When it is inserted into a USB port... If the Flash drive
    be recognized at... Start / computer with a drive letter.

    If you right-click a file or a group of selected files and
    in the menu... Choose... Send to... and select the drive
    letter corresponding to the Flash Player... files
    must be copied into the Flash Player.

  • cannot copy pictures or my movie for flash player files more. Flash player is not filled to the top. Used last 3 weeks ago. You are using windows xp, media center edition 2005.

    Remember - this is a public forum so never post private information such as numbers of mail or telephone!

    Ideas:

    • You have problems with programs
    • Error messages
    • Recent changes to your computer
    • What you have already tried to solve the problem

    cannot copy pictures or my movie for flash player files more. Flash drive
    is not filled to the top. Used last 3 weeks ago. Using windows xp, Media Center
    Edition 2005.

    ===================================
    Maybe there is a small slider that changes the drive to
    read-only?

    And... There may be a limit to the number of files that can
    Add in the root directory of the drive. This can be
    fixed by adding a few folders to sort the files.

    John Inzer - MS - MVP - Digital Media Experience - Notice_This is not tech support_I'm volunteer - Solutions that work for me may not work for you - * proceed at your own risk *.

  • My utude works more asking for flash player that I already used let me down load new

    My utude works more asking for flash player that I already used let me down load new

    It works now

    Ms

  • How can I change a default install for Flash Player/ActiveX directory

    Hi all

    I try to change a default installation directory:

    -flashplayer18.0.0.209.msi

    -flashplayeractivex19.0.0.000.msi

    I run the following command:

    C:\Windows\System32 > msiexec /i C:\Users\User\flash\flashplayeractivex19.0.0.000.msi INSTALLDIR = "C:\Test" /qb

    The 'Test' folder is created, but completely empty.

    so, I can change a destination for Flash Player folder?

    Thank you

    Hello

    You cannot change the default location for installing Flash Player.  Flash Player installs in a specific directory and browsers know what directory to locate the Flash Player in.

    --

    Maria

  • How can I publish for Flash Player 20?

    inside Flash CC Pro I need to publish a SWF to FP v20.

    I have the playerglobal.swc V20.

    I put it in a folder called FP20 in common/Configuration/ActionScript 3.0 /.

    In my view, there is an XML (?) configuration that I need to change as well, before Flash picks it up. Help?

    Yes.

    your complete FlashPlayer20_0.xml should look like:

    Flash Player 20

    Device Central/adcdl.exe

    Device Central/adcdl

  • Select for Flash Player playback device

    I want to be able to select a devive reading for Flash Player under Win 10. I don't want to rely on the default device defined on OS to win 10

    I see that this has been raised before on this forum, but there seems to be no published offers from 2013

    Y at - it no progress here? Is this feature available now, or are there plans to incorporate it into a future rrelease?

    Michael

    There is no intention to change this behavior.

  • Question single skier on password for Flash Player

    I keep saying to update Flash Player, but my Adobe password is not accepted for Flash Player sign in.  How can I get a password for Flash Player?

    This password is presented by your operating system and is designed to prevent you from accidentally installing the software.

    If it comes to your personal computer and you don't need a password to connect to the computer when it first starts, you can probably leave the password blank and click OK to go to this prompt.  If it comes to your personal computer and your normal password does not work, make sure that CAPS LOCK SHIFT is off, and then type the password carefully.

    If this is your work machine and he asks an administrator password, well, you will need to have a conversation with your computer friendly.

    If you are still puzzled, you may need to reset the password on your Mac:

    http://support.Apple.com/kb/PH18653

    http://support.Apple.com/kb/PH14325

    http://support.Apple.com/en-us/HT201240

  • Save a swf file for flash player liked 10.3 in Flash CC

    Hello

    I work with Flash CC and need to backup my files swf for Flash Player more than 10.3.

    Is it possible to do?
    In addition to working with CS6 yet ;-)

    Thanks for all the help!

    In the meantime, I found a very good answer myself.
    For all those who might need, too:

    Re: Flash Pro CC can publish for flash player 9?

    :-)

  • Publish for Flash Player 10.1?

    Hello!

    I just installed Flash CC and realized that the version of Flash Player low, I can choose in the settings of publication is 10.3. I use CC Flash to create banner ads for Google Adwords, which only supports Flash Player 4 - 10.1

    Is there a way that I can publish for Flash Player 10.1? I really don't want to reinstall CS6!

    Best

    Yes.

    Here are some similar steps: s6 http://stackoverflow.com/questions/11320405/compile-for-flash-10-1-in-flash-professional-c

  • Flash Pro CC can publish for flash player 9?

    Hello

    It is possible to publish for flash player 9 Flash cc. Most of the flash advertisements still requires flash player 9 as the latest to publish to version.

    Thank you

    Andrew

    10.3 is as far as you can publish unless you add a SWC from older playerglobal for publication options.

  • How to compile for Flash Player 11.3 in Flash CS6

    Hello

    How I can compile for Flash Player 11.3 using Flash Professional CS6, the menu has only up to 11.2

    What of 11.3 and the forthcoming 11.4?

    I already downloaded and added AIR sdk 3.3 for the skds AIR paths

    Hello

    The provision of compiling FP11.3 and FP11.4 would be available in the next version of updater for CS6.

    Thank you and best regards,

    Meenakshi Tiwari

    Team Flashpromanager.new Engg.

  • Looking for Flash Player knowledge RESPONDENT to explain something DELICATE

    Hello:-). I tripped on a behavior of Flash Player which I have a few guesses and a few questions, but I would like to discuss with someone who has a VERY good knowledge of Flash Player. If you like a good puzzle and you want to see some proof on the operation of Flash Player, READ carefully. Inside of this post, I also present the SOLUTION that I could find after 10 hours of torment.

    Sorry for the use of caps in this post but I wanted to focus on some things. Imagine as I write this, I am outraged and desperate:-).

    OK, this is so the (very simple) location:

    1. I got an ENTER_FRAME hung on the stage, where sometimes, when the user moves the mouse, I move all the objects on the stage.

    2. inside of a timer, I had a function test tube in which I test against the EDGES of some objects.

    3. when the objects on the stage are MOVED (in increments of 8 pixels / frame), this is what happens:

    dispObject.visible = false;  Again, it's visible = false.
    dispObject.hitTestPoint (x, y, true); Returns the value TRUE. Yes, despite the object being hidden, the hit test SUCCEEDS.

    dispObject.visible = true;
    dispObject.hitTestPoint (x, y, true); Returns false when the object is VISIBLE.

    Where X and Y are coordinates on the INSIDE of the shape of the object, to the ends (left or right). I had solid evidence that they are inside the object, as I poured out it of the scene to a BitmapData content he studied. Without a doubt, the hit test occurs inside of the color of the object form, but the result is FALSE when the object is VISIBLE = TRUE and TRUE when the object is hidden.

    In addition, hit testing that I do 2 moving objects-based: I'm test of positioning an object in motion (dispObject) and the X / Y location where I do the hit test are dictated by the position of ANOTHER object in motion.

    Now... I know very well how hitTestPoint works. The object, I'm a hit test is on the display list (I only played with the Visible property).


    MY SOLUTION:

    Instead of making the Test of positioning of the programmer, I just put on hold it in a table and I moved it inside the event ENTER_FRAME, PRIOR TO MOVING THE SCENE OBJECTS. This makes work that the tested either hit object Visible or not.

    QUESTIONS RELATING TO THE:

    1 flash Player has an internal priority for event types? I don't speak Event Listener priority but on the priority in the execution of all TYPES of events.

    2. the present cases: fact ENTER_FRAME * ALWAYS * run before the TIMER?

    3. why hitTestPoint work differently with the INVISIBLE objects? Let me rephrase: why the INVISIBLE objects move AFTER the TIMER event? Body obviously, this is what is happening. When the object is invisible, Flash Player moves differently, that's why the hit Test succeeds. If the object is Visible, it is moved to ENTER_FRAME and the hit Test fails, EVEN if ON the SCREEN, I actually SEE IT HIT the ACTUAL shape of the object.

    Once again:

    So yes, what I'm saying is that clearly, on the screen, it should NOT fail because I drew a few pixels at each location I form - of the hit test and the pixels actually INTERSECT the shape, but despite everything, the function returns FALSE. But when the object is HIDDEN, the hit test RETURNS TRUE.  Well, that's about all the ways I can explain it haha.

    Sorry to repeat myself a little, but I really want to get the point home. To conclude: I managed to solve the problem, but I wonder why, God, why did I have to lose a lot of time with this? So here's to hoping a guru sees this thread and guide me through the mysteries of Flash Player internals, because it isn't sure that I documented (I've looked everywhere on the priorities of the event and WORKFLOW STEP, but could not find anything!)

    "If ENTER_FRAME has supreme priority over all the other events, then it is clear as day why I had this behavior."

    No, ENTER_FRAME has priority as an event. Entering the frame which doesn't equate with the event as event distributing is an afterthought. This means that no matter what happens BEFORE treatment following image executes first and only after that Flash is going to the next section. Of course, this means that one of the first things that happens when the new framework came - event is dispatched (if the listener is added), but is not necessarily means that it is THE first thing.

    "In regards to multithreading, of course, I am aware of that. But I'd like to Flex Builder would be. »

    Flex Builder is a fair development environment and it has nothing to do with the runtime. I was talking about runtime multithreading.

    "It's horrible when I'm trying to debug something, and while I'm in the middle of a function, it jumps at the beginning of a timer that happens to run at the same time".

    I'm not sure debug (break points which are artificial in terms of actual performance) but the functions run in Flash WITHOUT INTERRUPTION. In other words, it is impossible to stop the service in the middle of his body, including all other code execution function current function calls unrelated. Everything is waiting for any function in the end events cannot interrupt the function as well. Once again, the execution of code in Flash is procedural as one of the results of lack of multithreading.

    On the question of visibility, if you turn it on and off unique setting - should not have any effect for drawing to the screen occurs at the end of the frame as the last action of Flash before entering another frame. As I said, I never need to explore how visibility affects other aspects, but it could be that Flash puts invisible objects at the end of the stack, but this is a wild guess. Frankly, I'm not sure I quite understood your use of hit test case. In particular, before and after the game. I guess that it is important how before and after the line up against execution of frames.

    In any case, can you explain why it is important for you to make objects invisible and how it would change your application if, say, you delete all invisible objects in the display list? Invisible items should be tested for visits and what are the consequences?

Maybe you are looking for