figuring out file extensions in AS3

I’m currently in the middle of building quite a large content management system in AS3, and I’ve come to the part of working in a decent file manager – so far it can upload, rename, delete and preview (only images) at this moment, but I need to add other things – a downloader, and a thumbnailer, which I’ve spent the last two days doing, anyway – I was looking into how to improve the preview system I have in place… it would be nice for the system to automatically detect what kind of file I’m looking at and decide what the correct way to preview it would be. To do this I need to have flash look at the extension each file has and take it from there – anyway here a little bit of code that’ll remove the extension…

1
2
3
4
5
6
7
8
9
10
11
function extractFileType(file:String):String {
    var extensionIndex:Number = file.lastIndexOf(".");
    if (extensionIndex == -1) {
        //No extension
        return "";
    } else {
        return file.substr(extensionIndex + 1,file.length);
    }
}

trace(extractFileType("file.jpeg");

And here’s a sneak peek of the thumbnailer – apologies about the photograph ;) – I’ve there’s enough demand I might clean the code up a bit and release it on here…

And here is a glimpse of the editor and file manager – It’s so beta I haven’t even got round to labeling the buttons!

More on this soon !

Read more

CMS Design Flash snippets

No Comments


Flash Header for wordpress P2 – Flash

Right, knocked up something that would use the php script I uploaded the other day, It brings in the data and builds a menu either for pages (with home page) or posts. I’ve also knocked up something that takes the post / page data and puts it in a text field incase anyone decides to build on it and turn it into something awesome (I might later if I have time – use swfaddress and all that).

Oh, and Load Learn it’s in as2.. :)

SOURCE

Get more info on the php side of things at the previous post.

Read more

Flash source wordpress

5 Comments


Flash Header for wordpress P1 – PHP

Update: Just noticed that if there were any posts not meant in the main menu but as subpages they would still show up – I’ve amended this now, so all should be good.

I just knocked this up yesterday (or the day before, depending on when you define a day change; midnight, or when you roll out of your pit), it’s basically a php script that can read the contents of your wordpress install (v 2.5 +) and output an xml file easily read by flash…

SOURCE (php / zip)

If you install this is the root of your theme folder (ie /wp-contents/themes/*nameoftheme*/) and goto
wp-contents/themes/*nameoftheme*/flash_header.php?postType=post


to read the posts in your wp or
wp-contents/themes/*nameoftheme*/flash_header.php?postType=page

to read the pages.
It also outputs the content of each post/page so effectively you could use it as a basis to start your own wordpress powered flash site.

Example Output

<?xml version=’1.0′?>
<wp_posts>
<post ID=’2′ postDate=’2008-04-30 08:32:54′ postName=’about’ postGUID=’http://www.dev.papertank.net/wordpress/?page_id=2′>
<postTitle><![CDATA[About]]></postTitle>
<content><![CDATA[Hi and welcome to Papertank.

We are a graphic design company that specialises in web development. But we also have a broad portfolio that incorporates album artwork, logo design and photography.

To view our most recent work, please visit the Portfolio Section or read the company Blog]]></content>
</post>

<wp_posts>

I’ll hopefully post up some example flash code to help you create your own flash header soon.

Read more

CMS wordpress

5 Comments


XML based Admin

Just spent the last few days working on a XML backend for the band Matt Pond PA – it’s not something new to me as I’ve worked on a few backends over the last 2 years or so, but whereas normally all the data is sent to and fro a MySQL database, this had to be xml base, which made everything a bit different for me… Anyway you can see the screenshot below…
Admin

After I get some jobs I’ve got on the go out the way, I’m going to try and work on something like this to release open source as I’ve had a few folk mention the need for a admin system to build in to their projects. Keep a look out!

:P

Read more

CMS Design

4 Comments


Look what I’ve been working on…

More on this soon!
Origami CMS - Page Options
Origami CMS - Page Options
Origami CMS - file manager

:)

Read more

CMS Design

2 Comments