|
Henrik Rydberg Dec 22, 2011 16:02 |
Powering campaigns and RIAs with BildyDespite the fact that the first commercial uses of Bildy have been for campaigns, it's not the first thing that comes in mind when you watch our earlier demos and screen casts. To fix this, we created Holla cloud, a demo to shows how Bildy can power up Flash campaigns or RIA applications. Holla cloud is basically a spiced up message board where people can drop a message and attach web cam pictures. Bildy gives messages in XML format to Flash and saves new posts to the database. If you haven't done so yet, try it out and go drop us a line! The thing that gets me excited, is how independently and fast Flash developers (like me) can bring dynamic data to Flash. I know how to make MySQL queries. But setting up databases, connections and cleaning up incoming data isn't really my cup of coffee. This thing takes literally two minutes to set up, so you can imagine how much of my time it saves. See it for your self. Here's a video how Holla is made: Instructions and downloadsAfter installing Bildy, create these three data models for
Once you have the data models, create a folder-like page called "Messages". You can use what ever name you wish, but please make sure you edit your templates then accordingly. Under here you can manually insert few messages for testing purposes. Second, create a "custom code" page and call it "Get messages". For this page, create a template that creates XML for the Flash. Here's a the template we've used in Holla cloud:
<?xml version="1.0" encoding="UTF-8"?>
<b:if condition="'<b:env.get.created_after/>' notempty">
<b:value.created_after set="<b:format.sqlsafe><b:env.get.created_after/></b:format.sqlsafe>"/>
</b:if>
<b:else>
<b:value.created_after set="0"/>
</b:else>
<messages>
<b:get name="message" from="message" orderby="metadata.created" where="metadata.created > '<b:value.created_after/>'" nocache="true" >
<message id="<b:message.metadata.id/>" picture="<b:message.picture/>" created="<b:message.metadata.created/>" >
<b:message.message/>
</message>
</b:get>
</messages>
Make sure that "Get messages" page is using the newly created template. Last step is to create a page for saving messages. Call it "Post message" and create a template with the following code: <b:form name="message" datamodel="message" parent="/messages"> <b:message.message/> <b:message.picture/> </b:form> Everything is ready under the hood now. You have messages in one place, a page to export the XML data for flash and a page that saves new messages coming from flash. Now download the Flash sources (as3) and unzip it. campaign/dataAccess.as contains all the code used to communicate with the server. If you've used other page names than in this example, of you're demo doesn't run in domain root, you can modify URLs from here. There you have it. Everything is in place for retrieving data from the server, displaying it, sending new data back to the server and saving it to database. Want to have more examples? Tell us what you would want to see. And remember to drop us a line at Holla cloud. |