ivanpro Beograd
Član broj: 186028 Poruke: 104 *.adsl-a-7.sezampro.rs.
|
Uspeo sam da dekompajliram i dobio contact.as
Sada mi nije jasno gde da dodam onaj code koji si mi napisao malopre?
Da li je ceo code nov ili samo treba da dodam neku liniju, jer ja ne vidim takav code samo imam ovo :
package
{
import caurina.transitions.*;
import caurina.transitions.properties.*;
import flash.display.*;
import flash.events.*;
import flash.filters.*;
import flash.geom.*;
import flash.net.*;
import flash.text.*;
public class Contact extends Sprite
{
private var _xml:XML;
private var _settings:XMLList;
private var _css:StyleSheet;
private var _background:Sprite;
private var _nameArea:TextInputArea;
private var _emailArea:TextInputArea;
private var _subjectArea:TextInputArea;
private var _messageArea:TextInputArea;
private var _pageTitle:pageTitle;
private var _sendBtn:SendButton;
private var _bgColor:ColorTransform;
private var _lineColor:ColorTransform;
private var _sendBgColor:ColorTransform;
private var _sendLineColor:ColorTransform;
private var _origTextColor:int;
private var _name:String = "Type your name";
private var _email:String = "Type your email";
private var _subject:String = "Type your subject";
private var _message:String = "Type your message";
private var _otherInfo:TextField;
public function Contact()
{
if (stage)
{
this.init();
}
else
{
addEventListener(Event.ADDED_TO_STAGE, this.init);
}// end else if
addEventListener(Event.REMOVED_FROM_STAGE, this.removedFromStage);
return;
}
public override function get height() : Number
{
return this._background.height;
}
public override function get width() : Number
{
return this._background.width;
}
private function init(param1:Event = null) : void
{
ColorShortcuts.init();
var _loc_2:* = new URLLoader();
_loc_2.load(new URLRequest(GlobalVar.xmlAddress));
_loc_2.addEventListener(Event.COMPLETE, this.xmlLoaded);
return;
}
private function xmlLoaded(param1:Event) : void
{
this._xml = XML(param1.target.data);
this._settings = this._xml.child("settings");
var _loc_2:* = new URLLoader();
_loc_2.load(new URLRequest("style.css"));
_loc_2.addEventListener(Event.COMPLETE, this.cssLoaded);
return;
}
private function cssLoaded(param1:Event) : void
{
this._css = new StyleSheet();
this._css.parseCSS(param1.target.data);
this.addElements();
return;
}
private function addElements() : void
{
this._background = new Sprite();
this._background.graphics.lineStyle(0, this._settings.@backgroundColor, 1, true, "none");
this._background.graphics.beginFill(this._settings.@backgroundColor, this._settings.@backgroundOpacity / 100);
this._background.graphics.drawRect(0, 0, this._settings.@backgroundWidth, this._settings.@backgroundHeight);
this._background.graphics.endFill();
this.addChild(this._background);
this._background.filters = [new DropShadowFilter(1, 90, 0, 1, 5, 5, 0.7, 3)];
this._bgColor = new ColorTransform();
this._bgColor.color = this._settings.@textInputBgColor;
this._lineColor = new ColorTransform();
this._lineColor.color = this._settings.@textInputLineColor;
this._sendBgColor = new ColorTransform();
this._sendBgColor.color = this._settings.@sendButtonBgColor;
this._sendLineColor = new ColorTransform();
this._sendLineColor.color = this._settings.@sendButtonLineColor;
this._pageTitle = new pageTitle();
this._pageTitle.titleText.autoSize = TextFieldAutoSize.LEFT;
this._pageTitle.titleText.styleSheet = this._css;
this._pageTitle.x = this._settings.@textInputPaddingX;
this._pageTitle.y = this._settings.@textInputPaddingX;
this._pageTitle.titleText.htmlText = this._xml.child("title");
this.addChild(this._pageTitle);
this._nameArea = new TextInputArea();
this._nameArea.x = this._settings.@textInputPaddingX;
this._nameArea.y = this._settings.@textInputPaddindY;
this._nameArea.bgFill.transform.colorTransform = this._bgColor;
this._nameArea.bgLine.transform.colorTransform = this._lineColor;
this._nameArea.bgFill.width = this._settings.@textInputWidth;
this._nameArea.bgFill.height = this._nameArea.textArea.height + 4;
this._nameArea.bgFill.alpha = this._settings.@textInputBgOpacity / 100;
this._nameArea.bgLine.width = this._nameArea.bgFill.width;
this._nameArea.bgLine.height = this._nameArea.bgFill.height;
this._nameArea.textArea.width = this._nameArea.bgFill.width--;
this._nameArea.textArea.textColor = this._settings.@textInputTextColor;
this._nameArea.textArea.maxChars = this._settings.@nameAreaMaxChars;
this._nameArea.textArea.text = this._name;
this._nameArea.textArea.addEventListener(FocusEvent.FOCUS_IN, this.onFocus);
this.addChild(this._nameArea);
this._emailArea = new TextInputArea();
this._emailArea.x = this._settings.@textInputPaddingX;
this._emailArea.y = this._nameArea.y + this._nameArea.height + Number(this._settings.@textInputVerticalSpace);
this._emailArea.bgFill.transform.colorTransform = this._bgColor;
this._emailArea.bgLine.transform.colorTransform = this._lineColor;
this._emailArea.bgFill.width = this._settings.@textInputWidth;
this._emailArea.bgFill.height = this._emailArea.textArea.height + 4;
this._emailArea.bgFill.alpha = this._settings.@textInputBgOpacity / 100;
this._emailArea.bgLine.width = this._emailArea.bgFill.width;
this._emailArea.bgLine.height = this._emailArea.bgFill.height;
this._emailArea.textArea.width = this._emailArea.bgFill.width--;
this._emailArea.textArea.textColor = this._settings.@textInputTextColor;
this._emailArea.textArea.maxChars = this._settings.@emailAreaMaxChars;
this._emailArea.textArea.text = this._email;
this._emailArea.textArea.addEventListener(FocusEvent.FOCUS_IN, this.onFocus);
this.addChild(this._emailArea);
this._subjectArea = new TextInputArea();
this._subjectArea.x = this._settings.@textInputPaddingX;
this._subjectArea.y = this._emailArea.y + this._emailArea.height + Number(this._settings.@textInputVerticalSpace);
this._subjectArea.bgFill.transform.colorTransform = this._bgColor;
this._subjectArea.bgLine.transform.colorTransform = this._lineColor;
this._subjectArea.bgFill.width = this._settings.@textInputWidth;
this._subjectArea.bgFill.height = this._emailArea.textArea.height + 4;
this._subjectArea.bgFill.alpha = this._settings.@textInputBgOpacity / 100;
this._subjectArea.bgLine.width = this._emailArea.bgFill.width;
this._subjectArea.bgLine.height = this._emailArea.bgFill.height;
this._subjectArea.textArea.width = this._emailArea.bgFill.width--;
this._subjectArea.textArea.textColor = this._settings.@textInputTextColor;
this._subjectArea.textArea.maxChars = this._settings.@subjectAreaMaxChars;
this._subjectArea.textArea.text = this._subject;
this._subjectArea.textArea.addEventListener(FocusEvent.FOCUS_IN, this.onFocus);
this.addChild(this._subjectArea);
this._messageArea = new TextInputArea();
this._messageArea.x = this._settings.@textInputPaddingX;
this._messageArea.y = this._subjectArea.y + this._subjectArea.height + Number(this._settings.@textInputVerticalSpace);
this._messageArea.bgFill.transform.colorTransform = this._bgColor;
this._messageArea.bgLine.transform.colorTransform = this._lineColor;
this._messageArea.bgFill.width = this._settings.@textInputWidth;
this._messageArea.bgFill.height = Number(this._settings.@messageAreaHeight) + 4;
this._messageArea.bgFill.alpha = this._settings.@textInputBgOpacity / 100;
this._messageArea.bgLine.width = this._messageArea.bgFill.width;
this._messageArea.bgLine.height = this._messageArea.bgFill.height;
this._messageArea.textArea.width = this._messageArea.bgFill.width--;
this._messageArea.textArea.height = this._settings.@messageAreaHeight;
this._messageArea.textArea.textColor = this._settings.@textInputTextColor;
this._messageArea.textArea.maxChars = this._settings.@messageAreaMaxChars;
this._messageArea.textArea.text = this._message;
this._messageArea.textArea.addEventListener(FocusEvent.FOCUS_IN, this.onFocus);
this.addChild(this._messageArea);
this._sendBtn = new SendButton();
this._sendBtn.bgFill.width = this._settings.@sendButtonWidth;
this._sendBtn.bgFill.height = this._settings.@sendButtonHeight;
this._sendBtn.bgLine.width = this._sendBtn.bgFill.width;
this._sendBtn.bgLine.height = this._sendBtn.bgFill.height;
this._sendBtn.bgFill.transform.colorTransform = this._sendBgColor;
this._sendBtn.bgFill.alpha = this._settings.@sendButtonBgOpacity / 100;
this._sendBtn.bgLine.transform.colorTransform = this._sendLineColor;
this._sendBtn.btnName.embedFonts = true;
this._sendBtn.btnName.autoSize = TextFieldAutoSize.LEFT;
this._sendBtn.btnName.wordWrap = false;
this._sendBtn.btnName.antiAliasType = AntiAliasType.ADVANCED;
this._sendBtn.btnName.styleSheet = this._css;
this._sendBtn.btnName.htmlText = this._xml.child("sendButtonText");
this._origTextColor = this._sendBtn.btnName.textColor;
this._sendBtn.btnName.x = this._sendBtn.bgFill.width / 2 - this._sendBtn.btnName.width / 2;
this._sendBtn.btnName.y = this._sendBtn.bgFill.height / 2 - this._sendBtn.btnName.height / 2;
this._sendBtn.y = this._messageArea.y + this._messageArea.height + Number(this._settings.@textInputVerticalSpace);
this._sendBtn.x = this._messageArea.x + this._messageArea.width - this._sendBtn.width;
this._sendBtn.mouseChildren = false;
this._sendBtn.buttonMode = true;
this._sendBtn.addEventListener(MouseEvent.MOUSE_OVER, this.onMouseOver);
this._sendBtn.addEventListener(MouseEvent.MOUSE_OUT, this.onMouseOut);
this._sendBtn.addEventListener(MouseEvent.CLICK, this.sendMessage);
this.addChild(this._sendBtn);
this._otherInfo = new TextField();
this._otherInfo.selectable = false;
this._otherInfo.width = this._background.width - 2 * Number(this._settings.@textInputPaddingX) - Number(this._settings.@textInputWidth) - 20;
this._otherInfo.autoSize = TextFieldAutoSize.LEFT;
this._otherInfo.wordWrap = true;
this._otherInfo.multiline = true;
this._otherInfo.embedFonts = true;
this._otherInfo.antiAliasType = AntiAliasType.ADVANCED;
this._otherInfo.condenseWhite = true;
this._otherInfo.styleSheet = this._css;
this._otherInfo.htmlText = this._xml.child("otherInfo");
this._otherInfo.x = this._background.width - Number(this._settings.@textInputPaddingX) - this._otherInfo.width;
this._otherInfo.y = Number(this._settings.@textInputPaddindY);
this.addChild(this._otherInfo);
return;
}
private function onMouseOver(param1:MouseEvent) : void
{
Tweener.addTween(param1.target.bgFill, {_color:this._settings.@sendButtonBgColorOnMouseOver, alpha:this._settings.@sendButtonBgOpacityOnMouseOver / 100, time:0.4});
Tweener.addTween(param1.target.bgLine, {_color:this._settings.@sendButtonLineColorOnMouseOver, time:0.4});
param1.target.btnName.textColor = this._settings.@sendButtonTextColorOnMouseOver;
return;
}
private function onMouseOut(param1:MouseEvent) : void
{
Tweener.addTween(param1.target.bgFill, {_color:this._settings.@sendButtonBgColor, alpha:this._settings.@sendButtonBgOpacity / 100, time:0.4});
Tweener.addTween(param1.target.bgLine, {_color:this._settings.@sendButtonLineColor, time:0.4});
param1.target.btnName.textColor = this._origTextColor;
return;
}
private function sendMessage(param1:MouseEvent) : void
{
var _loc_8:URLLoader;
var _loc_9:URLRequest;
var _loc_10:URLVariables;
var _loc_2:* = this._nameArea.textArea.text;
var _loc_3:* = this._emailArea.textArea.text;
var _loc_4:* = this._subjectArea.textArea.text;
var _loc_5:* = this._messageArea.textArea.text;
var _loc_6:* = this._xml.child("companyEmail");
var _loc_7:* = this._xml.child("siteName");
if (this.validateEmail(_loc_3))
{
_loc_8 = new URLLoader();
_loc_9 = new URLRequest(this._xml.child("phpFile").@src);
_loc_10 = new URLVariables();
_loc_8.dataFormat = URLLoaderDataFormat.VARIABLES;
_loc_9.method = URLRequestMethod.POST;
_loc_10.senderName = _loc_2;
_loc_10.senderEmail = _loc_3;
_loc_10.senderSubject = _loc_4;
_loc_10.senderMessage = _loc_5;
_loc_10.companyEmail = _loc_6;
_loc_10.siteName = _loc_7;
_loc_9.data = _loc_10;
_loc_8.load(_loc_9);
_loc_8.addEventListener(Event.COMPLETE, this.variablesSent);
}
else
{
this._emailArea.textArea.text = "Email is not valid";
}// end else if
return;
}
private function variablesSent(param1:Event) : void
{
param1.target.removeEventListener(Event.COMPLETE, this.variablesSent);
this._nameArea.textArea.text = this._name;
Tweener.addTween(this._nameArea.bgFill, {_color:this._settings.@textInputBgColor, alpha:this._settings.@textInputBgOpacity / 100, time:0.4});
Tweener.addTween(this._nameArea.bgLine, {_color:this._settings.@textInputLineColor, time:0.4});
this._nameArea.textArea.textColor = this._settings.@textInputTextColor;
this._emailArea.textArea.text = this._email;
Tweener.addTween(this._emailArea.bgFill, {_color:this._settings.@textInputBgColor, alpha:this._settings.@textInputBgOpacity / 100, time:0.4});
Tweener.addTween(this._emailArea.bgLine, {_color:this._settings.@textInputLineColor, time:0.4});
this._emailArea.textArea.textColor = this._settings.@textInputTextColor;
this._subjectArea.textArea.text = this._subject;
Tweener.addTween(this._subjectArea.bgFill, {_color:this._settings.@textInputBgColor, alpha:this._settings.@textInputBgOpacity / 100, time:0.4});
Tweener.addTween(this._subjectArea.bgLine, {_color:this._settings.@textInputLineColor, time:0.4});
this._subjectArea.textArea.textColor = this._settings.@textInputTextColor;
this._messageArea.textArea.text = this._message;
Tweener.addTween(this._messageArea.bgFill, {_color:this._settings.@textInputBgColor, alpha:this._settings.@textInputBgOpacity / 100, time:0.4});
Tweener.addTween(this._messageArea.bgLine, {_color:this._settings.@textInputLineColor, time:0.4});
this._messageArea.textArea.textColor = this._settings.@textInputTextColor;
stage.focus = null;
return;
}
private function onFocus(param1:FocusEvent) : void
{
this.setName();
if (param1.target.text == this._name)
{
this._nameArea.textArea.text = "";
Tweener.addTween(this._nameArea.bgFill, {_color:this._settings.@textInputBgColorOnFocus, alpha:this._settings.@textInputBgOpacityOnFocus / 100, time:0.4});
Tweener.addTween(this._nameArea.bgLine, {_color:this._settings.@textInputLineColorOnFocus, time:0.4});
this._nameArea.textArea.textColor = this._settings.@textInputTextColorOnFocus;
}// end if
if (param1.target.text == this._email || param1.target.text == "Email is not valid")
{
this._emailArea.textArea.text = "";
Tweener.addTween(this._emailArea.bgFill, {_color:this._settings.@textInputBgColorOnFocus, alpha:this._settings.@textInputBgOpacityOnFocus / 100, time:0.4});
Tweener.addTween(this._emailArea.bgLine, {_color:this._settings.@textInputLineColorOnFocus, time:0.4});
this._emailArea.textArea.textColor = this._settings.@textInputTextColorOnFocus;
}// end if
if (param1.target.text == this._subject)
{
this._subjectArea.textArea.text = "";
Tweener.addTween(this._subjectArea.bgFill, {_color:this._settings.@textInputBgColorOnFocus, alpha:this._settings.@textInputBgOpacityOnFocus / 100, time:0.4});
Tweener.addTween(this._subjectArea.bgLine, {_color:this._settings.@textInputLineColorOnFocus, time:0.4});
this._subjectArea.textArea.textColor = this._settings.@textInputTextColorOnFocus;
}// end if
if (param1.target.text == this._message)
{
this._messageArea.textArea.text = "";
Tweener.addTween(this._messageArea.bgFill, {_color:this._settings.@textInputBgColorOnFocus, alpha:this._settings.@textInputBgOpacityOnFocus / 100, time:0.4});
Tweener.addTween(this._messageArea.bgLine, {_color:this._settings.@textInputLineColorOnFocus, time:0.4});
this._messageArea.textArea.textColor = this._settings.@textInputTextColorOnFocus;
}// end if
return;
}
private function setName() : void
{
if (this._nameArea.textArea.text == "")
{
this._nameArea.textArea.text = this._name;
Tweener.addTween(this._nameArea.bgFill, {_color:this._settings.@textInputBgColor, alpha:this._settings.@textInputBgOpacity / 100, time:0.4});
Tweener.addTween(this._nameArea.bgLine, {_color:this._settings.@textInputLineColor, time:0.4});
this._nameArea.textArea.textColor = this._settings.@textInputTextColor;
}// end if
if (this._emailArea.textArea.text == "")
{
this._emailArea.textArea.text = this._email;
Tweener.addTween(this._emailArea.bgFill, {_color:this._settings.@textInputBgColor, alpha:this._settings.@textInputBgOpacity / 100, time:0.4});
Tweener.addTween(this._emailArea.bgLine, {_color:this._settings.@textInputLineColor, time:0.4});
this._emailArea.textArea.textColor = this._settings.@textInputTextColor;
}// end if
if (this._subjectArea.textArea.text == "")
{
this._subjectArea.textArea.text = this._subject;
Tweener.addTween(this._subjectArea.bgFill, {_color:this._settings.@textInputBgColor, alpha:this._settings.@textInputBgOpacity / 100, time:0.4});
Tweener.addTween(this._subjectArea.bgLine, {_color:this._settings.@textInputLineColor, time:0.4});
this._subjectArea.textArea.textColor = this._settings.@textInputTextColor;
}// end if
if (this._messageArea.textArea.text == "")
{
this._messageArea.textArea.text = this._message;
Tweener.addTween(this._messageArea.bgFill, {_color:this._settings.@textInputBgColor, alpha:this._settings.@textInputBgOpacity / 100, time:0.4});
Tweener.addTween(this._messageArea.bgLine, {_color:this._settings.@textInputLineColor, time:0.4});
this._messageArea.textArea.textColor = this._settings.@textInputTextColor;
}// end if
return;
}
private function validateEmail(param1:String) : Boolean
{
if (param1.length >= 10)
{
if (param1.indexOf("@") > 1)
{
if (param1.indexOf("@") + 2 < param1.indexOf("."))
{
if (param1.lastIndexOf(".") < param1.length - 2)
{
return true;
}// end if
}// end if
}// end if
}// end if
return false;
}
private function removedFromStage(param1:Event = null) : void
{
removeEventListener(Event.REMOVED_FROM_STAGE, this.removedFromStage);
this._sendBtn.removeEventListener(MouseEvent.MOUSE_OVER, this.onMouseOver);
this._sendBtn.removeEventListener(MouseEvent.MOUSE_OUT, this.onMouseOut);
this._sendBtn.removeEventListener(MouseEvent.CLICK, this.sendMessage);
this._nameArea.textArea.removeEventListener(FocusEvent.FOCUS_IN, this.onFocus);
this._emailArea.textArea.removeEventListener(FocusEvent.FOCUS_IN, this.onFocus);
this._subjectArea.textArea.removeEventListener(FocusEvent.FOCUS_IN, this.onFocus);
this._messageArea.textArea.removeEventListener(FocusEvent.FOCUS_IN, this.onFocus);
while (_loc_2-- >= 1)
{
// label
removeChildAt(this.numChildren--);
}
removeChildAt(0);
return;
}
}
}
|