Flash CMS v0.0.1
March 19, 2009
This was a proof of concept we sent to our client requesting dynamic content for Flash media plus a web based editor for the content.
At first glance it seems as if they are asking for something that could take months to develop. However, it’s actually simple enough that could be done by patching one component from another. Done with one cup of coffee.
Flash supports HTML. But don’t get too excited. Flash only supports some basic tags. All you need then is to be able to push data to it. You could do this with several methods. One would be using LoadVars. Another one is the good old FlashVars and lastly through XML.
With this example we’re using LoadVars. Below are the only lines of codes you need to do a simple CMS.
// Simple just declare a text area contains an HTML markup _root.content.html = true; // Load the content var contentVars = new LoadVars(); contentVars.onLoad = function(ok) { if (ok) { _root.content.htmlText = contentVars.flash_content; } }; // load the file (use .php extension to avoid browsers from caching the content) // no worries cause the content is encoded and no php script // could be executed with this process contentVars.load("flash_content.php"); // this is just to keep flash from running away stop();
You might wonder why not just use Flash XML feature instead of LoadVars. Well that could be done also. It’s just what I felt doing at the time. Also since I was using php as my file extension XML might not be the right choice as it exposes some security holes.
Next step is the What-You-See-Is-What-You-Get editor (WYSIWYG). There are lots available in the net. For this example I used TinyMCE. You would need to configure or do some hack to make the editor only use the tags supported by Flash. List of supported tags could be found inĀ http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_14808.
Once you get that done next step is to push the content of the editor to Flash. This is where PHP plays its role. Of course you could use other server side scripting in place of it.
The result would be something like this (Flash CMS sample). Go ahead and try it. You may also download the source files to modify and maybe improve it.
Filed under: ActionScript, Flash, General, PHP |
Comments (0)
Related Links:
