Check for file recursively

Not so long ago in the near past of this year 2004, there was a need for a solution to an issue with one of our Application at Oinam Software. The Application is now successfully deployed but as usual, it …

Not so long ago in the near past of this year 2004, there was a need for a solution to an issue with one of our Application at Oinam Software. The Application is now successfully deployed but as usual, it is still under clearance-wrapped if we can even say anything about it on the site or public. Ok, currently the issue is resolved by using remoting (ColdFusion) and the application is even entering its version 2.

Now, let us forget that application and see the issue. The issue was to allow the client or any person inheriting the project or someone doing changes should be able to drop in any non-progressive jpeg or a swf in a folder and accordingly display if some specific file(s) with matching filename are there in the specific directory. Our developer team came up with a working prototype which never got used, neither in this project nor anywhere else, so, here it is for anybody interested in the same. Use it either modified, mutilated or in whichever way you wish. BTW, in the actual prototype, the array was parsed from an xml where the client can just put in the name accordingly.

//create the environment
var mc:MovieClip;
var mcLoader:MovieClipLoader;
var rgFiles:Array = new Array ("file1.jpg", "file2.jpg", "file3.jpg");
var iCount:Number = 0;
// the main function
function main () {
	mc = createEmptyMovieClip ("mc", 1);
	mcLoader = new MovieClipLoader ();
	mcLoader.addListener (this);
	loadNext ();
};
// trap the onload error
function onLoadError () {
	loadNext ();
};
// recurse
function loadNext () {
	if (iCount < rgFiles.length) {
		mcLoader.loadClip (rgFiles [iCount], mc);
		iCount++;		
	} else {
		trace ("Where is the file! No File Found.");
	};
};
// fire
main ();

[Update: Sorry, about the lack of "How to use?", thanks to coupla people who have mailed and asked me about the Usage.]

Steps:
1. Put three JPEGs, file1.jpg, file2.jpg and file3.jpg
2. In the same folder, put the above script on the first frame or put is outside and do an #include
3. Publish

Then you try deleting the files file1.jpg, file2.jpg and file3.jpg, one by one and re-publish in between. You won’t need to update the script.


Don't like it? There are lots of published articles, pick a random one.

oCricket

Brajeshwar posted this article on Sat, Oct 2nd, 2004 at 11:05 pm
Categorized under Technology

Prev Article: Software Architect Bootcamp

Next Article: Object-Oriented Software Construction


Possibly Related Articles

Archives: Visit the Archives for more articles.

Comments Post Yours

There are no response so far. You can follow any responses to this entry through the RSS feed. You can skip to the end and leave a response. Pinging is currently not allowed.

Post yours

Sidenotes

Quick notes, scribbles, somehow related to this website and to what I do. Or perhaps I'm just plain lazy to make them into a full article.

Cooliris for the iPhone

Cooliris is the browser extension that revolutionizes the way you view media on your computer. It is now available as an application for your iPhone! Cooliris for the iPhone allows you to search the web ...22nd Oct, 2008

Adobe releases Flash Player 10 (Mac, Win & Linux)

Adobe have released the shipping version of Flash Player 10 for Mac, Windows and Linux. More about Flash Player 10 * About Flash Player 10 * Get Flash Player 10 (Official Release version 10.0.12.36) * Download Debug and Standalone ...15th Oct, 2008

What a bad team can do to a Startup?

Flash/Flex developer, Orian Marx, started his Startup with much zeal and enthusiasm but had to give-in to failures because of none other but the team - the founders involved. His article outlined the story so ...13th Oct, 2008

Introduction to Adobe AIR (NetTuts)

Nettuts have a nice Introduction to Adobe AIR which focus on using HTML/JS to build an AIR Application. It covers -- Adobe AIR Architecture, How to install AIR, Get the development SDK, Configurations, gets on to ...2nd Oct, 2008

Decide Team Type from Books

What do you think of the "Team-Type" if they got these books recently? What "Team-Type" do these books suggest? ( surveys) 29th Sep, 2008

View the Sidenotes Archive

Play the Penguin Game

Recommended

  • Downloads All downloads, Free and Open Source.
  • Ode to Apple Dedicated to Apple - Mac, iPhone, iPod, iTunes, Quicktime, Apple TV and all the awesome softwares for the Apple Mac.
  • AS 2.0 Reference Reference for ActionScript 2.0 Programming Language used in Flash. Primarily stashed here for my own personal reference.
  • Forum Oinam’s technical discussion forum where developers and designers can discuss all technical topics.
  • Not Safe for Work Ever clicked a link and felt embarrassed with the content in front of your co-workers? Ever caught unaware because the funny link your friend sent was a little beyond funny? Let’s minimize that with NSWF.
  • o! Just Me Of colorful cultures, entertainment, media, life hacks, music, books and movies from hollywood & bollywood.
  • ActionScript 3.0 Reference Flash/Flex ActionScript 3.0 Reference.

Download free Brajeshwar Wordpress Theme

Brajeshwar

Brajeshwar I firmly believe in keeping things simple, easy for users and I envison pushing the technical envelop time and again for the betterment of viable commercial and practical applications. More about me.

Brajeshwar's affinity with Adobe

My Photos

More photos on Flickr

Member of 9rules Network

Since its inception on 11th June, 2001, "Brajeshwar" has 890 Articles and 6,069 comments, contained within 21 categories and 1,327 tags.