Eh mi ci sto impazzendo, devo capire che cosa fa questa porzione di codice che è in un file AmazonItem.as
Praticamente sto usando un esempio di Mark Sheperd per l'utilizzo di una libreria che si chiama SpringGraph (per flex).
Ho provato con i commenti a cercare di interpretare cosa faccia questo code
codice:
//Classe AmazonItem che estende la classe Item
public class AmazonItem extends Item
{
//dichiarazione delle variabili Bindable
[Bindable]
public var name: String;
[Bindable]
public var imageUrl: String;
//variabile di tipo XMLList
private var similarProducts: XMLList;
//variabile di tipo Boolean
private var createSimilarsASAP: Boolean = false;
//funzione pubblica AmazonItem che accetta due argomenti di tipo stringa: "itemId" e "name
public function AmazonItem(itemId: String, name: String) {
//super() is used to execute the parent class contructor
super(itemId);
//bohhh???
this.name = name;
//Passa alla classe AmazonService i dati da mettere nella funzione getItemInfo
AmazonService.getItemInfo(itemId, this);
}
public function getItemInfoResult(event:ResultEvent):void {
var info: XML = XML(event.result);
var ns:Namespace = info.namespace("");
this.name = info.ns::Items.ns::Item.ns::ItemAttributes.ns::Title;
this.imageUrl = info.ns::Items.ns::Item.ns::SmallImage.ns::URL;
similarProducts = info.ns::Items.ns::Item.ns::SimilarProducts.ns::SimilarProduct;
if(createSimilarsASAP)
createSimilars();
}
// funzione pubblica getItemInfoFault ...
public function getItemInfoFault(event:FaultEvent):void {
Alert.show("getItemInfoFault " + event.toString());
}
// funzione createSimilars...
public function createSimilars(): void {
if(similarProducts == null) {
createSimilarsASAP = true;
return;
}
var app: AmazonDemo = AmazonDemo(Application.application);
app.createItems(similarProducts, this);
similarProducts = null;
}
}
}
MMMmmm non ci riesco proprio a capire super(itemId);