Welcome Developers!

in

Welcome!

in

The Different Ways of Making a Flash MySpace App

Last post 08-20-2009 7:08 AM by Митрофанова. 10 replies.
Page 1 of 1 (11 items)
Sort Posts: Previous Next
  • 07-17-2008 10:29 AM

    • Gordon
    • Not Ranked
    • Joined on 07-13-2008
    • Posts 2

    The Different Ways of Making a Flash MySpace App

    There seems to be a lot of confusion on how to make a flash app. I am going to put fourth my understanding and can somone please correct me if I am wrong ? So as I understand it, there are 3 different ways of making a flash myspace app: 1) Use inline flash. In this case MySpace adds the open social parameters as flash vars to the flash app. In this case, you can use the as3 library to interface with the mypace api. 2) Use an IFrame. In this case you can make calls to your own server which can interact with the myspace servers via the REST or open social interface. 3) Use the HTML/Javascript source option and add the markup for the object and embed tags. In this case you can use the ExternalInterface to access the open social javascript APIs. This case allows for the most features since you can use javascript-only functionality such as postTo. Can someone elaborate on the advantages between methods 1, 2, and 3? Also, in case 3, can you use the official as3 library as an alternative to using ExternalInterface or is that the only route? Any help would be greatly appreciated. Thanks, Gordon
  • 07-28-2008 6:12 PM In reply to

    Re: The Different Ways of Making a Flash MySpace App

    On case #2, you can do that but you have to route all of your REST calls through the server--your remote SWF can't communicate directly with MySpace due to crossdomain issues.

    On case #3, yes, you can still use Actionscript APIs which plug into the REST API. One thing I haven't seen is a good guide to connecting directly to OpenSocial through ExternalInterface. I've done some playing around and had some successes, but have yet to get an asynchronous OpenSocial method to work.

    ~Brock

  • 07-30-2008 1:16 PM In reply to

    Re: The Different Ways of Making a Flash MySpace App

    Case #3 is the most flexible and therefore the most desirable IMHO.  

    However, so far I've been unable to take advantage of this option, as I have not been able to determine how to get the opensocial_token, etc. from Javascript to pass in via FlashVars.  I don't want to have to make all my calls, via ExternalInterface... only the stuff that isn't available in the AS3 library, ie. the ACC functionality

    Does anyone know how to do this?  I'm assuming it would be similar to how you do this in Facebook via the FBJS bridge...

    flashVars = {
        user_id: fb_js_api.get_session().uid,
                api_key: fb_js_api.apiKey,
                secret: fb_js_api.get_session().secret,
                session_key: fb_js_api.get_session().session_key, etc...  

    Any thoughts or ideas on how to get the required params that are needed to use the AS3 library would be greatly appreciated.

    Thanks!

    William.

  • 07-31-2008 1:47 PM In reply to

    Re: The Different Ways of Making a Flash MySpace App

    OK... Brock helped clear up my issue about using the AS3 library with the HTML/Javascript source type.  Thanks man.  Instead of grabbing the params out of the flashvars, you just call out to the container to get the token:

    var os:Object = ExternalInterface.call("opensocial.Container.get");
    openSocialToken = os.osToken_;
    openSocialSurface = os.osMode_.name_;
    var owner_id:String = os.params_.ownerid;                  
     
    // initialize myspace container
    MySpaceContainer.instance.init(openSocialToken, openSocialSurface); 

    etc...

    I've been able to integrate some ACC functionality into my AS3 code by calling these JS wrappers from Flash using External Interface: 

    // call this method via external interface from flash
    function sendInvite(recipient_id,msg) {
        message = opensocial.newMessage(msg);
        opensocial.requestShareApp(recipient_id, message);
    }
        
    // call this method via external interface from flash
    function sendMessage(recipient_id,subject,content,messageType){
        try {
           dataReqObj = osContainer.newDataRequest();        dataReqObj.add(osContainer.newFetchPeopleRequest(recipient_id),"OWNER_FRIENDS");
            dataReqObj.send(       
                function (data)
                {
                    recipientPerson = data.get("OWNER_FRIENDS").getData().asArray();
                    var message = opensocial.newMessage(content);   
                    message.setField(opensocial.Message.Field.TITLE, subject);   
                    message.setField(opensocial.Message.Field.TYPE, messageType);
                    osContainer.postTo(os_token, message, recipientPerson[0]);                   
                }
            );
        } catch (e) {
            alert("error: "+e.message);
        }
    }
     

    which you call from AS3 like:

    ExternalInterface.call("sendMessage",recipientId,subject,content,"SEND_MESSAGE");

    ExternalInterface.call("sendInvite",recipientId,message); 

    etc... 

  • 07-31-2008 2:58 PM In reply to

    Re: The Different Ways of Making a Flash MySpace App

     Hi MIG,

    I was playing earlier (see thread close by) and got something basic to work but only in Firefox.

    In IE it threw a security error. I know of another who also got the error in IE

    Does yours work OK in IE?

    Thanks

    Eddie

  • 07-31-2008 4:48 PM In reply to

    Re: The Different Ways of Making a Flash MySpace App

    I was getting the same problem with IE.  After some fandangling though, I now have things working equally well in Firefox and IE.

    This is what I did to get it working in IE:

    1)             // open up the security
                Security.allowDomain("api.msappspace.com"); 

    2) Change the embed codes to be:

         <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
                  width="800" height="600" id="mySocialApp"            codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">
              <param name="movie" value="http://cache01-widget01.myspacecdn.com/1/myflash.swf" />
              <param name="quality" value="high" />
              <param name="bgcolor" value="#ffffff" />
              <param name="allowScriptAccess" value="always" />
              <param name="allowNetworking" value="all" />
              <embed src="http://cache01-widget01.myspacecdn.com/1/myflash.swf" quality="high" bgcolor="#ffffff" width="800" height="600" align="middle" play="true" loop="false" quality="high" allowScriptAccess="always" allowNetworking="all" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">
              </embed>
          </object>

    The embed tag is probably not necessary.  One thing which was crucial to get this to work was adding an id attribute to the object tag.  It appears that the ExternalInterface call in IE doesn't work if the object tag does not have an "id" attribute.

    3) I'm also waiting 500 ms for things to load before making any ExternalInterface calls...


  • 08-01-2008 1:25 AM In reply to

    Re: The Different Ways of Making a Flash MySpace App

    Thanks MIG

    Great fandangling.

    I've not done scripting before through Flash so if you should get round to trying to use

    opensocial.requestPermission

     

    an example would be appreciated

    Eddie

    Filed under: ,
  • 05-20-2009 5:44 AM In reply to

    • dan
    • Not Ranked
    • Joined on 02-24-2009
    • Posts 5

    Re: The Different Ways of Making a Flash MySpace App

    #3 - Are you able to make a callback into Flash?

    I've got the,    

    ExternalInterface.call("myJSFunc", "foo"); working fine.

    But the callback,    

    var ref = this;

    function iAmInFlash(arg1:String) {
       
        var txtField:TextField = ref.createTextField("txtField", ref.getNextHighestDepth(), 0, 0, 200, 50);
        txtField.border = true;
        txtField.text = arg1;
    }

    var connection = ExternalInterface.addCallback("callToFlash", null, iAmInFlash);

    <script>

    core_holder.callToFlash(data + 'bar');

    </script>

    Just fails constantly! Has anyone got a few files they could Zip up and share? This is driving me nuts after solving stuff onFriday, http://www.thoughtden.co.uk/blog/2009/05/19/myspace-application-externalinterface-calls-swfobject/

    Thanks! 

    Thought Dan

     

  • 06-07-2009 6:57 AM In reply to

    Re: The Different Ways of Making a Flash MySpace App

     Hey have you seen this page?

    http://wiki.developer.myspace.com/index.php?title=Create_a_MySpace_Application_Using_Flash_and_ActionScript_3

    I do believe we're in the process building an sdk around this, but I need to check on the availability. 

    Rhonda

     

     

  • 07-17-2009 4:07 AM In reply to

    Re: The Different Ways of Making a Flash MySpace App

    ie can you help me i want to do a survey on myspace and i dont understand any of this computer gibberish show me an easy way pleaseHmm

  • 08-20-2009 7:08 AM In reply to

    Re: The Different Ways of Making a Flash MySpace App

    I would like to create my own application (not for MySpace) where user can login as MySpace user and post notification to his wall. Is it possible with MySpace API?
Page 1 of 1 (11 items)