Deprecated: Function ereg() is deprecated in /home/rbezemer/softwarebyrichard.com/sites/all/modules/badbehavior/bad-behavior/functions.inc.php on line 62

Deprecated: Function ereg() is deprecated in /home/rbezemer/softwarebyrichard.com/sites/all/modules/badbehavior/bad-behavior/functions.inc.php on line 62

Deprecated: Function ereg() is deprecated in /home/rbezemer/softwarebyrichard.com/sites/all/modules/badbehavior/bad-behavior/functions.inc.php on line 62

Deprecated: Function ereg() is deprecated in /home/rbezemer/softwarebyrichard.com/sites/all/modules/badbehavior/bad-behavior/functions.inc.php on line 62

Deprecated: Function ereg() is deprecated in /home/rbezemer/softwarebyrichard.com/sites/all/modules/badbehavior/bad-behavior/functions.inc.php on line 62

Deprecated: Function ereg() is deprecated in /home/rbezemer/softwarebyrichard.com/sites/all/modules/badbehavior/bad-behavior/functions.inc.php on line 62

Deprecated: Function ereg() is deprecated in /home/rbezemer/softwarebyrichard.com/sites/all/modules/badbehavior/bad-behavior/functions.inc.php on line 62

Deprecated: Function ereg() is deprecated in /home/rbezemer/softwarebyrichard.com/sites/all/modules/badbehavior/bad-behavior/functions.inc.php on line 62

Deprecated: Function ereg() is deprecated in /home/rbezemer/softwarebyrichard.com/sites/all/modules/badbehavior/bad-behavior/functions.inc.php on line 62

Deprecated: Function ereg() is deprecated in /home/rbezemer/softwarebyrichard.com/sites/all/modules/badbehavior/bad-behavior/functions.inc.php on line 62

Deprecated: Function ereg() is deprecated in /home/rbezemer/softwarebyrichard.com/sites/all/modules/badbehavior/bad-behavior/functions.inc.php on line 62

Deprecated: Function ereg() is deprecated in /home/rbezemer/softwarebyrichard.com/sites/all/modules/badbehavior/bad-behavior/functions.inc.php on line 62

Deprecated: Function ereg() is deprecated in /home/rbezemer/softwarebyrichard.com/sites/all/modules/badbehavior/bad-behavior/functions.inc.php on line 62

Deprecated: Function ereg() is deprecated in /home/rbezemer/softwarebyrichard.com/sites/all/modules/badbehavior/bad-behavior/functions.inc.php on line 62

Deprecated: Function ereg() is deprecated in /home/rbezemer/softwarebyrichard.com/sites/all/modules/badbehavior/bad-behavior/functions.inc.php on line 62

Deprecated: Function ereg() is deprecated in /home/rbezemer/softwarebyrichard.com/sites/all/modules/badbehavior/bad-behavior/functions.inc.php on line 62

Deprecated: Function ereg() is deprecated in /home/rbezemer/softwarebyrichard.com/sites/all/modules/badbehavior/bad-behavior/functions.inc.php on line 62

Deprecated: Function ereg() is deprecated in /home/rbezemer/softwarebyrichard.com/sites/all/modules/badbehavior/bad-behavior/functions.inc.php on line 62

Deprecated: Function ereg() is deprecated in /home/rbezemer/softwarebyrichard.com/sites/all/modules/badbehavior/bad-behavior/functions.inc.php on line 62

Deprecated: Function ereg() is deprecated in /home/rbezemer/softwarebyrichard.com/sites/all/modules/badbehavior/bad-behavior/functions.inc.php on line 62

Deprecated: Function ereg() is deprecated in /home/rbezemer/softwarebyrichard.com/sites/all/modules/badbehavior/bad-behavior/functions.inc.php on line 62

Deprecated: Function ereg() is deprecated in /home/rbezemer/softwarebyrichard.com/sites/all/modules/badbehavior/bad-behavior/functions.inc.php on line 62

Deprecated: Function ereg() is deprecated in /home/rbezemer/softwarebyrichard.com/sites/all/modules/badbehavior/bad-behavior/functions.inc.php on line 62

Deprecated: Function ereg() is deprecated in /home/rbezemer/softwarebyrichard.com/sites/all/modules/badbehavior/bad-behavior/functions.inc.php on line 62

Deprecated: Function ereg() is deprecated in /home/rbezemer/softwarebyrichard.com/sites/all/modules/badbehavior/bad-behavior/functions.inc.php on line 62

Deprecated: Function ereg() is deprecated in /home/rbezemer/softwarebyrichard.com/sites/all/modules/badbehavior/bad-behavior/functions.inc.php on line 62

Deprecated: Function ereg() is deprecated in /home/rbezemer/softwarebyrichard.com/sites/all/modules/badbehavior/bad-behavior/functions.inc.php on line 62

Deprecated: Function ereg() is deprecated in /home/rbezemer/softwarebyrichard.com/sites/all/modules/badbehavior/bad-behavior/functions.inc.php on line 62

Deprecated: Function ereg() is deprecated in /home/rbezemer/softwarebyrichard.com/sites/all/modules/badbehavior/bad-behavior/functions.inc.php on line 62

Deprecated: Function ereg() is deprecated in /home/rbezemer/softwarebyrichard.com/sites/all/modules/badbehavior/bad-behavior/functions.inc.php on line 62

Deprecated: Function ereg() is deprecated in /home/rbezemer/softwarebyrichard.com/sites/all/modules/badbehavior/bad-behavior/functions.inc.php on line 62

Deprecated: Function ereg() is deprecated in /home/rbezemer/softwarebyrichard.com/sites/all/modules/badbehavior/bad-behavior/functions.inc.php on line 62

Deprecated: Function ereg() is deprecated in /home/rbezemer/softwarebyrichard.com/sites/all/modules/badbehavior/bad-behavior/functions.inc.php on line 62

Deprecated: Function ereg() is deprecated in /home/rbezemer/softwarebyrichard.com/sites/all/modules/badbehavior/bad-behavior/functions.inc.php on line 62

Deprecated: Function ereg() is deprecated in /home/rbezemer/softwarebyrichard.com/sites/all/modules/badbehavior/bad-behavior/functions.inc.php on line 62

Deprecated: Function ereg() is deprecated in /home/rbezemer/softwarebyrichard.com/sites/all/modules/badbehavior/bad-behavior/functions.inc.php on line 62

Deprecated: Function ereg() is deprecated in /home/rbezemer/softwarebyrichard.com/sites/all/modules/badbehavior/bad-behavior/functions.inc.php on line 62

Deprecated: Function ereg() is deprecated in /home/rbezemer/softwarebyrichard.com/sites/all/modules/badbehavior/bad-behavior/functions.inc.php on line 62

Deprecated: Function ereg() is deprecated in /home/rbezemer/softwarebyrichard.com/sites/all/modules/badbehavior/bad-behavior/functions.inc.php on line 62

Deprecated: Function ereg() is deprecated in /home/rbezemer/softwarebyrichard.com/sites/all/modules/badbehavior/bad-behavior/functions.inc.php on line 62

Deprecated: Function ereg() is deprecated in /home/rbezemer/softwarebyrichard.com/sites/all/modules/badbehavior/bad-behavior/functions.inc.php on line 62

Deprecated: Function ereg() is deprecated in /home/rbezemer/softwarebyrichard.com/sites/all/modules/badbehavior/bad-behavior/functions.inc.php on line 62
ActionScript 3 Photobucket API Basics | Software by Richard
  • warning: Parameter 1 to tac_lite_node_grants() expected to be a reference, value given in /home/rbezemer/softwarebyrichard.com/includes/module.inc on line 483.
  • warning: Parameter 2 to gmap_gmap() expected to be a reference, value given in /home/rbezemer/softwarebyrichard.com/includes/module.inc on line 483.
  • warning: Parameter 1 to tac_lite_node_grants() expected to be a reference, value given in /home/rbezemer/softwarebyrichard.com/includes/module.inc on line 483.
  • warning: Parameter 1 to tac_lite_node_grants() expected to be a reference, value given in /home/rbezemer/softwarebyrichard.com/includes/module.inc on line 483.
  • warning: Parameter 1 to tac_lite_node_grants() expected to be a reference, value given in /home/rbezemer/softwarebyrichard.com/includes/module.inc on line 483.
  • warning: Parameter 1 to tac_lite_node_grants() expected to be a reference, value given in /home/rbezemer/softwarebyrichard.com/includes/module.inc on line 483.
  • warning: Parameter 1 to tac_lite_node_grants() expected to be a reference, value given in /home/rbezemer/softwarebyrichard.com/includes/module.inc on line 483.
  • warning: Parameter 1 to tac_lite_node_grants() expected to be a reference, value given in /home/rbezemer/softwarebyrichard.com/includes/module.inc on line 483.

ActionScript 3 Photobucket API Basics

So by popular demand, and just because it's fresh on my mind, I've revisited the Photobucket photoflow example. This version of the app goes a step further and uses the full blown ActionScript 3 Photobucket API. This API is actually relatively new and I was actually working on a similar interface to their API when they released theirs. Anyway the API details can be found here: http://code.google.com/p/photobucketas3lib/ and of course you will need developer keys from Photobucket in order for this to work. Also since Photobucket does not have a crossdomain.xml yet, so you'll need a local proxy if you want to use the coverflow container. I detailed a very basic one in an earlier post. What I will do for this example is load a user's album in Doug McCune's photoflow container. The Photobucket API is pretty straightforward to use. The work flow is basically the following: 1) log in to Photobucket with your developer keys

  1. private var login:Login = new Login();
  2. login.setConsumer(PhotobucketKeys.CONSUMER, PhotobucketKeys.PRIVATE);

2) Query for a user's album information

  1. var _pbAlbum:Album = PhotobucketService.getInstance().albumFactory(user) as Album;

3) Request all the images from the album

  1. list.dataprovider = _pbAlbum.images;

4) List any sub-albums

  1. subAlbums.dataProvider = _pbAlbum.sub_albums;

And that is basically it. There is some weirdness in their API in regards to the way they treat data providers. If you pass their return objects in as the dataprovider attribute to a display object you are fine, but it you want to do any advanced processing of the return values you have to do some work arounds to the way the return data to you. you can see the details in the source code below, but to put it simply they destroy the original dataprovider before they fill it with data so attaching listeners to the data provider does not work the way you expect. Here's the finished project. You can view the source here. To use it, enter a Photobucket user name that has public images available (private images will not be displayed) and press enter or click load. The user's main album will show in the photoflow and all their sub-albums will show in the combobox. Select a sub-album to show it in the photoflow. It's pretty basic, but should give you a good starting point to jump into the Photobucket ActionScript API. My code is released under the Creative Commons Attribution license so anyone (personal or corporate) can use or modify it, just give a shout out to me if you do. Have Fun.

You are missing some Flash content that should appear here! Perhaps your browser cannot display it, or maybe it did not initialize correctly.

Your rating: None Average: 3.6 (14 votes)

Comments

Hi, It's been a while since

Hi,

It's been a while since I worked with that code, but the key problem I encountered was that even if you add event listeners, when photobucket regenerates the list it creates a new dataprovider so all your listeners are destroyed or at least sent off into limbo.

As well, this search is kind of limited as you can only view a users public folders, if a user has private folders you want to view you'll have to log in as that user in order to access them, this could also be why you are getting the 401 error. try a user you know has a public folder and see if that shows anything.

thanks,
--Richard

Hi Richard, Thanks for

Hi Richard, Thanks for clarifying on the PhotobucketKeys- I didn't realize that the "secret" was just given to you by photobucket to hard code, same as the registered api key...

Image search works great for me, but getting albums for a username - PhotobucketRemoteObject.user() - returns an error:

401: Error #2032: Stream Error. URL: http://api.photobucket.com/user/onegiantmedia/search

But if you follow that URL, you can see the API is responding... I see it's a HTTPStatus 401 - as in not authenticated? My search requests go through fine with the same key/secret...

Could this be because of the dataProvider swap that you noted in the source?

"This part of the API is kind of awkward...a better solution would be to modify the photobucket api..." lol

I am not using Flex or any components to bind with / assign dataProvider (building a different experience)... how can I just trace the response XML to get the API portion working standalone? Do I need some addEventListener equivalent to your ChangeWatcher line?

Thanks for any input you might have,

-sean

There have been a few

There have been a few questions about the PhotobucketKeys class, This seems way more complicated than it actually is. It is just a class full of static variables that I entered in my developer keys from http://photobucket.com/developer/. I did it this way so I could hide what the actual keys are in my blog post, and not have a bunch of people copy and pasting the code using my own developer keys. Once you have registered your own at the above link you can just enter them straight into the setConsumer() function.

Hi, PhotobucketKeys was a

Hi,
PhotobucketKeys was a class I put together to hid all my proxy and api key details from anyone reading the blog. You can probably for the most part remove any proxy references and it should work for debugging, but to load it on a server you will have to have your own proxy for the Photobucket data (detailed here: http://www.softwarebyrichard.com/blog/2008/10/creating-a-php-proxy-for-f... ), unless photobucket has got around to updating their cross domain xml file yet.

Hi

Hi ,

PhotobucketService.getInstance().albumFactory(user) as Album;

I am getting error on this albumFactory and

img.load(PhotobucketKeys.MY_PROXY+escape(url));

can any one please let me know what is is the issues.

Regards,
Murugesan.