My question is concerning Super.
If someone is farmiliar with Super . Is it possible to get someone to look at the first and of code only and get me started on how I would approach the concept of using Super. Because the second two blocks of code are almost identical. and I plan on creating two more blocks of code to create almost the same senerio.
(a combobox calling a child.)
Thanks

package chromatic.load_files{
	import fl.controls.ComboBox;
	import flash.display.MovieClip;
	import flash.events.Event;
	import fl.data.DataProvider;
	import flash.net.URLLoader;
	import flash.net.URLRequest;
	import flash.net.URLRequest;
	import fl.containers.UILoader;
	public class CBMajorComponent extends MovieClip {

		public var cbMajor:ComboBox=new ComboBox();
		private var uiImageComponent:UIImageComponent;

		private var listURL:URLRequest=new URLRequest();
		private var dataLoader:URLLoader=new URLLoader();
		private var theXML:XML=new XML();

		private var arrayFile:Array=new Array("load_assets/keylist.xml");
		private var majorArray:Array=new Array

("CMajor","GMajor","DMajor","AMajor","EMajor",
		"BMajor","FSharpMajor","CSharpMajor","FMajor",
		"BFlatMajor","EFlatMajor","AFlatMajor",
		"DFlatMajor","GFlatMajor","CFlatMajor");

		public var key:String;
		public var fileName:String;
		private var evtIndex:Number;
		private var evtItem:String;
		private var sel:Number=-1;
		
		public function CBMajorComponent():void {			
			init();
		}
		private function init():void {
			fileName=arrayFile[0];
			setFileName(fileName);
			setupComponent(fileName);
		}
		private function setupComponent(fileName):void {
			this.fileName=fileName;			
			cbMajor=new ComboBox();
			cbMajor.setSize(200, 22);
			cbMajor.prompt = "Select a Major Key";
			cbMajor.editable=false;
			cbMajor.rowCount=15;
			cbMajor.width=110;
			cbMajor.move(0,0);
			cbMajor.x=-235;
			cbMajor.y=-150;			
			listURL=new URLRequest(fileName);			
			dataLoader.addEventListener(Event.COMPLETE,dataLoaded);
			dataLoader.load(listURL);			
			theXML=new XML(listURL);
			theXML.ignoreWhitespace=true;			
			cbMajor.addEventListener(Event.CHANGE, selectedName);
			cbMajor.addEventListener(Event.CHANGE,changeEvent);
		}
		private function dataLoaded(evt:Event):void {		
			theXML=XML(dataLoader.data);			
			for (var i:int=0; i<majorArray.length; i++) {
				key=majorArray[i];						

		
				cbMajor.addItem({label:(theXML.key[key].keyName)});
			}
		}
		private function selectedName(evt:Event):void {
			evtIndex=evt.target.selectedIndex;
			key=majorArray[evtIndex];
			setKey(key);
			uiImageComponent=new UIImageComponent(fileName,key);
			addChild(uiImageComponent.uiImage);			
		}
		public function changeEvent(evt:Event):void {
			trace(" You selected a key");
		}
		public function setFileName(fileName):void {
			this.fileName=fileName;
		}
		public function getFileName():String {
			return fileName;
		}
		public function setKey(key):void {
			this.key=key;
		}
		public function getKey():String {
			return key;
		}
	}
}

I have a long way to go to understand how I could use techniques to use super(); I just know that I have 2 comboboxs now and I plan on haveing several more and I don't want keep writing new classes. I want to re-write it and make this class a base class and then write a class that will be able to use it (super()). I haven't had enough time to work with the code yet. first I have to formulate what I have to do to make a unique combobox,like
it woud have to.

1.load itself with a list from XML
2.add it to the displaylist
3.sizing and position
4.add listeners that call routines from super and the child that allow it to
use standard data to load itself or use unique data at times
5.addlisteners to call different classes that have different functions(and these classes may have a base class of there own)because I wrote two other classes that are almost identical other than one loads th UIloader and the other loads a TileList.

any other suggestions of elements and insight that you could add to help the psuedo code to transform my 4 classes using Inheratence and Polymorphism would be greatly apreciated.
Thanks for your time.
ceyesuma

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.