TWiki
> Main
> Releases? > WhatsNewInMscape25 > CommunicateWithTheOutsideWorld >
HttpContent
How to get images, audio and flash from a server
Introduction
In the previous two articles we talked about sending and receiving information, but not content. We sent and received numbers, words and TrueFalse's now we talk about downloading content, images, audio and flash files. We can only download and play files of a compatible type, we can not download and play something that mscape does not already support.
Getting the Content
The process of requesting content is exactly the same as the process of requesting anything else. You can retrieve content by using a Get, Post, Put or Delete. Once the OnResponse event has triggered you can use the
InComingData? parameter to save the downloaded file to an existing object of the same type. So for example if you download an image file then you can save it to an existing image object and then use it just like any other image object. If you get the type wrong or you try to save the downloaded file to a file currently playing (audio or flash) then the HTTP operation will succeed but you will not be able to save the file. To force a download to a file already playing then simply stop (the audio) or unload (the flash movie) the relevant script object before saving the file. If you try to save the file to an image object that is currently showing then you will need to hide and then show it again to reflect the change.
The new file will remain for the length of the mediascape session or until it's saved over by a new download. However if the user loads a different mediascape or quits the player then the new file will be lost and the origonal file will always be returned.
To save a downloaded file call the IncomingData.SaveDataTo method and pass in the media object that you want to replace. Once this is done then you can use the media object normally.