Type mismatch error when calling a class

I have written two classes for capturing XML data passed to my Flash movie.  The first class, "Clip", encapsulates data pertaining to a movie clip (path to a swf file, a url to use with the move, etc.).  The second class, "Clips", is intended to be a collection of Clip instances.  "Clips" uses an array to store individual instances of "Clip".

The class, "Clip", has been tested and works fine.
The class, "Clips", throws a Type Mismatch Error when it attempts to create a new instance of "Clip" and push it into the array.  "Clips" is acting like it doesn't understand "Clip", although I have made sure to import it.

Why is it throwing the Type Mismatch Error?  
//-------------------------------------------------------------------
// class "Clip"
// file "Clip.as"
//-------------------------------------------------------------------
 
class Clip {
	
	// Instance variables
	private var path:String;
	private var link:String;
	public var first:String;
	private var pf:String = "clp";
	
	// Constructor
	function Clip(node:XMLNode) {
		// Get the path to the swf file
		path = node.childNodes[0].firstChild;
		
		// Get the click-link from the file to the target destination
		link = node.childNodes[1].firstChild;
	}
	
	// Getters
	function getPath():String {return path;}
	function getLink():String {return link;}
	
	// Setters
	function setFirst(index:Number):String {
		first = pf + index;
		return (first);
	}
 
}
 
 
 
//-------------------------------------------------------------------
// class "Clips"
// file "Clips.as"
//-------------------------------------------------------------------
import Clip;
 
class Clips {
	// Instance variables
	private var ary_clips:Array = new Array();
	
	// Constructor
	function Clips(node:XMLNode) {
		// Loop through the clip objects
		var i:Number;
		for(i=0; i<node.childNodes.length; i++) {
			// Add a new clip instance to the array
			var n:XMLNode = node.childNodes[i];
			trace(n);
			var c:Clip = new Clip(n);
			c.setFirst(i); 
			ary_clips.push(c);
		}
	}
	
	// Getters
	function Count():Number {
		return ary_clips.length;
	}
	
	function HasClips():Boolean {
		if(Count > 0) {
			return true;
		} else {
			return false;
		}
	}
	
	function Clip(index:Number):Clip {
		if(index >=0 and index < Count) {
			return ary_clips[index];
		} else {
			return null;
		}
	}
}

Open in new window

ewolsingAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ewolsingAuthor Commented:
I solved my own problem.

The class, "Clips", contained a method called "Clip".  When I changed the name of the "Clip" method to "Item", everything worked as expected.

The moral of the story -- don't give a method the same name as a class you're also trying to use...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.