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;
}
}
}