Section 1
//Main (com.resellerratings.storewidget.Main)
package com.resellerratings.storewidget {
import flash.display.*;
import flash.text.*;
import flash.net.*;
import flash.events.*;
public class Main extends MovieClip {
private var seoLink;// = ""
public var hitAreaMC:MovieClip;
public var companyLabel:TextField;
public var reviewLabel:TextField;
public var scoreLabel:TextField;
public var companyHit:MovieClip;
public var logoHit:MovieClip;
public function Main(){
var _local1:URLLoader;
seoLink = "";
super();
if (!checkURL(xmlUrl)){
return;
};
_local1 = new URLLoader();
_local1.addEventListener(Event.COMPLETE, urlLoader_complete);
_local1.addEventListener(IOErrorEvent.IO_ERROR, urlLoader_ioError);
_local1.addEventListener(SecurityErrorEvent.SECURITY_ERROR, urlLoader_securityError);
_local1.load(new URLRequest(xmlUrl));
logoHit.addEventListener("click", logoHit_click);
logoHit.mouseEnabled = true;
logoHit.buttonMode = true;
hitAreaMC.mouseEnabled = true;
hitAreaMC.buttonMode = true;
hitAreaMC.addEventListener("click", hitAreaMC_click);
}
public function get xmlUrl():String{
var _local1:*;
_local1 = this.root.loaderInfo.parameters;
return (_local1["feed"]);
}
private function hitAreaMC_click(_arg1){
navigateToURL(new URLRequest(seoLink));
}
public function checkURL(_arg1:String){
var url = _arg1;
try {
if (url.charAt(0) != "h"){
return (false);
};
if (url.charAt(1) != "t"){
return (false);
};
if (url.charAt(2) != "t"){
return (false);
};
if (url.charAt(3) != "p"){
return (false);
};
if (url.charAt(4) != ":"){
return (false);
};
if (url.charAt(5) != "/"){
return (false);
};
if (url.charAt(6) != "/"){
return (false);
};
if (url.charAt(7) != "w"){
return (false);
};
if (url.charAt(8) != "w"){
return (false);
};
if (url.charAt(9) != "w"){
return (false);
};
if (url.charAt(10) != "."){
return (false);
};
if (url.charAt(11) != "r"){
return (false);
};
if (url.charAt(12) != "e"){
return (false);
};
if (url.charAt(13) != "s"){
return (false);
};
if (url.charAt(14) != "e"){
return (false);
};
if (url.charAt(15) != "l"){
return (false);
};
if (url.charAt(16) != "l"){
return (false);
};
if (url.charAt(17) != "e"){
return (false);
};
if (url.charAt(18) != "r"){
return (false);
};
if (url.charAt(19) != "r"){
return (false);
};
if (url.charAt(20) != "a"){
return (false);
};
if (url.charAt(21) != "t"){
return (false);
};
if (url.charAt(22) != "i"){
return (false);
};
if (url.charAt(23) != "n"){
return (false);
};
if (url.charAt(24) != "g"){
return (false);
};
if (url.charAt(25) != "s"){
return (false);
};
if (url.charAt(26) != "."){
return (false);
};
if (url.charAt(27) != "c"){
return (false);
};
if (url.charAt(28) != "o"){
return (false);
};
if (url.charAt(29) != "m"){
return (false);
};
return (true);
} catch(e) {
return (false);
};
}
private function logoHit_click(_arg1){
navigateToURL(new URLRequest("http://www.resellerratings.com"));
}
private function urlLoader_complete(_arg1){
var xml:*;
var event = _arg1;
try {
xml = new XML(event.currentTarget.data);
} catch(e) {
trace(("ERROR PARSING XML: " + e));
};
if (xml){
loadXml(xml);
};
}
private function loadXml(_arg1:XML){
var _local2:*;
var _local3:*;
var _local4:*;
_local2 = _arg1.@name.toString();
_local3 = _arg1.maindata.overall_rating.text();
_local4 = _arg1.maindata.overall_reviews.text();
seoLink = _arg1.maindata.seolink.text();
companyLabel.text = _local2;
scoreLabel.text = _local3;
reviewLabel.text = (_local4 + " customer reviews");
companyHit.addEventListener("click", companyHit_click);
companyHit.mouseEnabled = true;
companyHit.buttonMode = true;
}
private function urlLoader_securityError(_arg1){
trace(("ERROR: " + _arg1));
}
private function urlLoader_ioError(_arg1){
trace(("ERROR: " + _arg1));
}
private function companyHit_click(_arg1){
navigateToURL(new URLRequest(seoLink));
}
}
}//package com.resellerratings.storewidget