ohze / facebook-actionscript-api

Automatically exported from code.google.com/p/facebook-actionscript-api
0 stars 1 forks source link

Publish Photos with different Album Position #328

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.I created an app that publish 5 images at the same time.
2.I use this code:
[...omitted]
for(var i:int=0;i<5;i++)
{
    publishBanner(i);
}
private function publishBanner(n:int):void
{               
    var bitmapData:BitmapData = new BitmapData(mc.width, mc.height);
    bitmapData.draw(mc);
    var bitmap:Bitmap = new Bitmap(bitmapData);

    var params:Object = {image:bitmap, message:'msg', fileName:'testFotoAlbum'+n.toString()};

    Facebook.api(IDalbum+'/photos', cbBanner, params);
}
[...omitted]
3.All work properly.

What is the expected output? What do you see instead?
I think that if the first image is testFotoAlbum0 then the first image in the 
album must have position:1 .And then:
testFotoAlbum0 --> position:1
testFotoAlbum1 --> position:2
testFotoAlbum2 --> position:3
testFotoAlbum3 --> position:4
testFotoAlbum4 --> position:5

Instead the position are always the same (position:1) for all the images of the 
album. This is a problem because the order of the images isn't the same of the 
call. The result could be:
testFotoAlbum1 --> position:1
testFotoAlbum3 --> position:1
testFotoAlbum0 --> position:1
testFotoAlbum4 --> position:1
testFotoAlbum2 --> position:1

What version of the product are you using? On what operating system?
I'm using:
GraphAPI_1_6_1
Flash CS5
Actionscript 3
Windows Vista

You can test it here http://apps.facebook.com/testfotoalbum/ if you want.

Thank you very much for any help!

Original issue reported on code.google.com by francesc...@gmail.com on 15 Jul 2011 at 12:35

GoogleCodeExporter commented 9 years ago
I think if you want to have a specific order in an album, you'll have to try 
uploading them one at a time - waiting for the callback to be called and then 
uploading the next.

Original comment by rovertn...@gmail.com on 22 Jul 2011 at 8:16

GoogleCodeExporter commented 9 years ago
I cannot do that because the second Api call will be ignored.
I don't know why.
I try to do that without the for. I try calling a function that call 
Facebook.api(IDalbum+'/photos', cbBanner, params);
for 5 times.
The first call it's ok. The second one will be ignored. I think that the 
problem is the user interaction, but I haven't the certainty.
Any hint?

Original comment by francesc...@gmail.com on 24 Jul 2011 at 8:59

GoogleCodeExporter commented 9 years ago
Ya it could be a user interaction thing. Sometimes browsers/popupblockers will 
block certain calls if they aren't made by a keyboard press or mouse click.

Also, just removing the for loop wouldn't be best either. Are you waiting for 
the cbBanner method to be called before uploading the next photo?

Original comment by rovertn...@gmail.com on 29 Jul 2011 at 9:51

GoogleCodeExporter commented 9 years ago
Yes, I'm waiting the callback. The problem is that I need to do that in Flash.
If I use only PHP the method works.

I think that is a bug because in Flash the only problem is the wrong position's 
parameter.

Original comment by francesc...@gmail.com on 31 Jul 2011 at 8:23

GoogleCodeExporter commented 9 years ago
You're likely dealing with a race-condition then, whereby some photos are being 
uploaded faster than others (ex. photo3 is finished uploading before photo1, 
even though photo3 started uploading after photo1). The only way to guarantee a 
specific photo order, is to upload them one at a time (and on a mouse click 
each time so you don't run into security issues).

Original comment by rovertn...@gmail.com on 17 Aug 2011 at 7:31

GoogleCodeExporter commented 9 years ago
Yes, I know. But I also want to know why I cannot do that with AS3 and I can do 
that with PHP. 
Facebook is always the same, so... If it works using PHP, it must be the same 
with AS3!

Please! This is a BUG!

Original comment by francesc...@gmail.com on 17 Aug 2011 at 8:49

GoogleCodeExporter commented 9 years ago
Unfortunately, multiple uploads (without user interaction for each upload) are 
not possible because of security changes to the Flash Player itself. 
http://www.adobe.com/devnet/flashplayer/articles/fplayer10_uia_requirements.html
This is not something we can fix on the api end, so you would need to change 
the flow of the app or rely on other workarounds. 

Original comment by edwar...@gmail.com on 26 Oct 2011 at 10:11