Archive for category Technology Articles

Dynamic AS3 Slideshow (Counts Files in Directory)

I was presented with a challenge by a client to produce a Flash based, lightweight slideshow for use on a website. This slideshow would be able to read the number of images in a directory on a webserver and cycle through the images based on the number of images present. Futhermore, it would be able to detect and adapt itself when there was a new image or image removed WITHOUT the need to adjust and re-compile Flash code.

During my initial searches on the internet, it seemed that the only way to do this would be to use a PHP script to regulate the information sent to AS3. The consensus on the internet was that it was not possible to detect the number of files present in a web directory. I did figure out a way to do this.

Here is the basic approach I took to solving this problem. Flash can not read what files are in a directory, but it can pull a file with a specific name. If the file doesn’t exist then it will throw an exception. So what I ended up doing was create a naming convention (eg: photo01.jpg, photo02.jpg, etc.) for the pictures that would be loaded in. Flash then goes through a loop archiving the valid file names and stops on the first null. I then make a pass starting backwards and eliminate any null entries in my array and preload the photo’s that are valid. To hide the time it takes to do this, I show the first valid file in the slideshow when it does the first scan. Then we start our slideshow loop in reverse, it takes about the same amount of time to load the photos as it did to swap photos, so this masks the loading well.

This approach was certainly not the fastest or most efficient, but on a time crunch it worked well. If I ever need to do it again for a client, I have a strong starting point and can optimize the code.

Version Control

I am currently not using any form of version control, although I would really like to get in the habit of using one. From what I have read there are really 2 good options, SVN (http://subversion.tigris.org/) and CVS (http://www.nongnu.org/cvs/).

You can also subscribe or get spaces on the internet that supply loads of tools in addition to version control. These places are ideal multiple people to collaborate over the internet and still have access to the same files and communicate efficiently. Assembla (http://www.assembla.com/) is one I have used in the past and it works pretty well. The one drawback is it used to be free, not sure it still is for private spaces.

SEO Links

So a couple weeks ago, I got hit up to take a free introduction Webinar that this dude was doing. It gave an overview of a course he is doing and he gave out 10 tools and did a quick overview on how to use them.

So I figured I would share these tools with you guys. A few of them you probably have used in the past:

1. Google Keyword Tool (https://adwords.google.com/select/KeywordToolExternal)
2. Google Website Content Tool (https://adwords.google.com/select/KeywordToolExternal)
3. Google Wonder Wheel (http://www.google.com/)
1. To get to this one, do a search and then hit “show options” on the toolbar.
2. Third Group, Second Option
4. KeywordSpy (http://www.keywordspy.com/)
5. SEOBook’s FireFox Rank Checker (http://tools.seobook.com/)
6. XML Sitemap Generator (http://www.xml-sitemaps.com/)
7. Google Web Master Tools (http://www.google.com/webmasters/tools)
8. Keyword Density (http://www.keyworddensity.com/)
9. Yahoo Site Explorer (http://siteexplorer.search.yahoo.com/)
10. Google Analytics (http://www.google.com/analytics/)

Also just a heads-up. I was doing some SEO stuff for the company I work for and noticed Bing has released the first of their webmaster tools. Worth checking out, nothing to fancy but they have the basics for the Bing search engine.

4 (when it works for your site), 1, 2, 7, 10 and 6 I use often.

ActionScript 3 and the new AS3 Chromeless YouTube Player

So first off, I am working with this brand new technology (10/14/09) and it “works” quite well. A few issues I have run into so far is my calls to pull a video by id were getting a security sandbox error. I did some more research and found information regarding external sites that you use in flash and approving them for loading external content.

http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/system/Security.html#allowDomain%28%29

This answers a LOT of questions about why some of my content was not loading properly from external sources.

Once I figure out more about how the player is stored in my swf file and what I can control about it I will post again. At that point my Flash class’s Mid Term project will be looking pretty snazzy.

Information regarding the new AS3 Chromeless YouTube Player:

http://apiblog.youtube.com/2009/10/actionscript-3-youtube-chromeless.html
http://code.google.com/apis/youtube/flash_api_reference.html#setPlaybackQuality

Tags:

HT Access Information

I recently stumbled upon a very good article on .ht Access files that is helping to clear up this unknown section of web design for me.

http://www.askapache.com/htaccess/htaccess.html

Hope you enjoy

Tags: