how to load resources dynamically?

Hi, i’m the newbies of cocos-x and curioused that is there the way to load the resources such as image, sound, data files from server via http protocol using cocos-x or not. for example if I would like to…

  • load the avatar of user in facebook to create the CCSprite.
  • load the sound file from the internet and play in game.
  • load the data file from server.
  • call the http request via url and get the http response back.
    thanks in advance
  1. load the avatar of user in facebook to create the CCSprite
    avatar > CCImage> CCTexture -> CCSprite

  2. load the sound file from the internet and play in game
    Don’t have this feature now.

  3. load the data file from server
    You can use socket to get the file

  4. call the http request via url and get the http response back
    You can use libcurl

>> 1. load the avatar of user in facebook to create the CCSprite
>> avatar > CCImage> CCTexture -> CCSprite

Why do we need to follow this sequence? Can we directly use:
CCSprite sprite1 = CCSprite::spriteWithFile(absolute_filename);

Can you explain a little bit more about this flow. Thanks

For the avatar, sometime it return jpg and sometime png (no avatar defined). How can we determine the file format after reading from curl?

Because you can not use opengl es context in two threads.