amfphp - using the api key in Flash 8

Events happening in the community are now at Drupal community events on www.drupal.org.
timosea's picture

ello, i'm new to this group and to the service / amfphp modules. after following the flash 8 section in the services hand handbook [http://drupal.org/node/140893 ] i've got my flash site to connected to drupal, so a well happy. but i'm struggling to find out how to implement the api and session keys in as2; the as3 stuff seem really cool, but my site need run in as2. Could anyone point me in the right direction of any as2 classes or help with some basic syntax, where do i add the api and session keys?
var node:Service = new Service("http://sitedomain/services/amfphp", new Log(), "node", null, null);
cheers, Tim.

Comments

Using the code from the Flash 8 example...

bmcmurray's picture

When you set up the service method call, you need to pass it all required parameters. If you add in an apiKey then that becomes a required parameter for every method call and should be passed as the first parameter to any call like this:

var apiKey:String = "<<my apikey from drupal>>";
var pc:PendingCall = node.load(apiKey, 1);

B.McMurray

B.McMurray

thanks for the info

timosea's picture

it all make sense now, the example in the handbook, skips this step; i guess it obvious to most people.

Thanks again for the pointer, Cheers, Tim

ecksley's picture

I presume like most folks I develop locally and deploy on a www server. That being said, I would need two keys. And who wants to change all their Flash pieces every time they jump between local and www.

So, I'd like o pass this info into my Flash piece. Flash Vars would kind of defeat the purpose. Is their an alternative technique similar to the way a sessID is passed that can be accessed securely? Or do I just have to use Flash Vars and obfuscate in some way. How do you do it?

I suppose I could just pass the domain as a Flash var and have some conditional code in my .as to select the correct key. But ya know, it's limiting if I ever use a different domain, etc.

Thanks for your insights!

Services

Group organizers

Group categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: