check user favorite as3 api call not working

14 views
Skip to first unread message

candytunes.com

unread,
Feb 10, 2011, 10:37:07 AM2/10/11
to SoundCloudAPI
I am trying this with no response:

private function _checkUserFavorite():void
{
//trace("tracks/"+this.model.activeSong.songID+"/
favoriters/"+this.model.userID)
var delegate2:SoundcloudDelegate =
SoundCloudConnect.scClient.sendRequest("tracks/"+this.model.activeSong.songID
+"/favoriters/"+this.model.userID, URLRequestMethod.GET);
delegate2.addEventListener(SoundcloudEvent.REQUEST_COMPLETE,
_setFavoriteFlag);
}

private function _setFavoriteFlag(e:SoundcloudEvent):void
{
trace("e.data: "+ e.data);
}

can you please tell me what I am doing wrong?

I am connected and am able to make other successful
scClient.sendRequest calls, but this one never gets a response...

candytunes.com

unread,
Feb 10, 2011, 10:53:17 AM2/10/11
to SoundCloudAPI
if i drop the user id it works:


SoundCloudConnect.scClient.sendRequest("tracks/"+this.model.activeSong.song
ID
> +"/favoriters", URLRequestMethod.GET);

I may just do this and test for my user id in the results.

candytunes.com

unread,
Feb 10, 2011, 11:24:37 AM2/10/11
to SoundCloudAPI
FYI:
this as3 api call does not work:
tracks/{track_id}/favoriters/{user_id}

but this does:
tracks/{track_id}/favoriters

heres my solution to test for a track being favored by the logged in
user:


private function _checkUserFavorite():void
{
var delegate2:SoundcloudDelegate =
SoundCloudConnect.scClient.sendRequest("tracks/"+this.model.activeSong.songID
+"/favoriters", URLRequestMethod.GET);
delegate2.addEventListener(SoundcloudEvent.REQUEST_COMPLETE,
_setFavoriteFlag);
}

private function _setFavoriteFlag(e:SoundcloudEvent):void
{
var data:Object = e.data;
for (var i:* in data) {

if(data[i].id==this.model.userID)
{
trace(i + ": "+data[i].id + "::" + this.model.userID);
this._favorite = "true";
}
}

this._picHolder.removeEventListener(MouseEvent.CLICK,
this._infoURL);
if(this._favorite == "true")this.showFav();
else this.hideFav();
}

candytunes.com

unread,
Feb 10, 2011, 11:28:12 AM2/10/11
to SoundCloudAPI
FYI:
this as3 call does not work:
tracks/{track_id}/favoriters/{user_id}

but this one does:
tracks/{track_id}/favoriters


here is how i test to see if a track is favored by the logged in user:

private function _checkUserFavorite():void
{
var delegate2:SoundcloudDelegate =
SoundCloudConnect.scClient.sendRequest("tracks/"+this.model.activeSong.songID
+"/favoriters", URLRequestMethod.GET);
delegate2.addEventListener(SoundcloudEvent.REQUEST_COMPLETE,
_setFavoriteFlag);
}

private function _setFavoriteFlag(e:SoundcloudEvent):void
{

SoundCloud API Support

unread,
Feb 14, 2011, 5:10:46 AM2/14/11
to soundc...@googlegroups.com
candytunes,

what error are you getting on the
'tracks/{track_id}/favoriters/{user_id}' call ?

> --
> You received this message because you are subscribed to the Google Groups "SoundCloudAPI" group.
> To post to this group, send email to soundc...@googlegroups.com.
> To unsubscribe from this group, send email to soundcloudap...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/soundcloudapi?hl=en.
>
>

candytunes.com

unread,
Feb 14, 2011, 8:45:51 AM2/14/11
to SoundCloudAPI
no error, just no response.

when I run this function:

private function _checkUserFavorite():void
{
var delegate2:SoundcloudDelegate =
SoundCloudConnect.scClient.sendRequest("tracks/"+this.model.activeSong.songID
+"/favoriters/"+this.model.mySoundcloudID", URLRequestMethod.GET);
delegate2.addEventListener(SoundcloudEvent.REQUEST_COMPLETE,
_setFavoriteFlag);

}

the _setFavoritesFlag function never fires

On Feb 14, 5:10 am, SoundCloud API Support <api-
supp...@soundcloud.com> wrote:
> candytunes,
>
> what error are you getting on the
> 'tracks/{track_id}/favoriters/{user_id}' call ?
>

candytunes.com

unread,
Feb 14, 2011, 11:08:55 AM2/14/11
to SoundCloudAPI
I'm just guessing here, but I think the problem might be that the 404
and 303 do not return a response that fires the
SoundcloudEvent.REQUEST_COMPLETE event.

is there any way you can return a data result (true/false or 0/1)
instead of the redirect headers?

candytunes.com

unread,
Feb 15, 2011, 8:19:07 AM2/15/11
to SoundCloudAPI
is there another way to get a result besides the following?:

private function _checkUserFollower():void
{
var delegate2:SoundcloudDelegate =
SoundCloudConnect.scClient.sendRequest("users/"+this.model.activeSong.artistID
+"/followers/"+this.model.userID, URLRequestMethod.GET);
delegate2.addEventListener(SoundcloudEvent.REQUEST_COMPLETE,
_setFollowerFlag);
}

there is no way that this will work in as3 unless a
SoundcloudEvent.REQUEST_COMPLETE event is fired. (the response page
needs more than a header, otherwise flash cannot see a complete event)

Does anyone know a different way to do this?

candytunes.com

unread,
Feb 15, 2011, 8:19:54 AM2/15/11
to SoundCloudAPI
this is a problem for favorites and followers.
Reply all
Reply to author
Forward
0 new messages