09-01-2005, 18:51
|
|
|
חבר מתאריך: 25.10.01
הודעות: 744
|
|
יש איזה פונקציה שעושה שינוי צד לאפילקציה בפלאש, כמו RTL ב html ?
יש לי אפילקציה ממש מורכבת שכתובה כולה בצד שמאל... כמו חלון טקסט ורשימת אנשים וכד'..
ואני רוצה להפוך הכל לצד ימין... שטקסט שבתיבת טקסט יופיע מימין לשמאל... וכד'...
יש פונקציה שיכולה לעשות את זה??
זה קוד לדוגמא של קובץ as באפילקציה:
קוד:
#initclip 10
_global.LoginBox = function() {
super();
this.dialog_name = 'loginbox';
this.setCloseButtonEnabled(false);
this._visible = false;
this.txtLabel.autoSize = 'left';
this.txtPassword.password = true;
this.languageList = null;
this.selectedLanguage = null;
this.languageTarget = null;
this.labelTextId = null;
this.language = null;
this.txtUserName._height = this.txtPassword._height = 20;
this.txtUserNameBackground._height = this.txtPasswordBackground._height = this.txtUserName._height;
this.txtUserName.onChanged = function() {
this._parent.languageChooser.myOnKillFocus();
this._parent.textValidator();
};
this.txtPassword.onChanged = function() {
this._parent.languageChooser.myOnKillFocus();
//this._parent.textValidator();
};
this.txtUserName.background = false;
this.txtPassword.background = false;
this.txtUserName.onSetFocus = function() {
this.borderColor = this._style.bodyText;
};
this.txtUserName.onKillFocus = function() {
this.borderColor = this._style.borderColor;
};
this.txtPassword.onSetFocus = function() {
this.borderColor = this._style.bodyText;
};
this.txtPassword.onKillFocus = function() {
this.borderColor = this._style.borderColor;
};
};
_global.LoginBox.prototype = new _global.DialogBox();
//PUBLIC METHODS.
_global.LoginBox.prototype.setEnabled = function(inDialogEnabled) {
super.setEnabled(inDialogEnabled);
this.textValidator();
this.languageChooser.enabled = (inDialogEnabled);
};
_global.LoginBox.prototype.show = function()
{
this.btnLogin.setClickHandler('processButton', this);
/*
this.event_listener = new Object();
this.btnLogin.addEventListener("click", this.event_listener);
this.event_listener.click = function( evt )
{
if(evt.target._name == "btnLogin")
{
evt.target._parent.processButton();
}
}*/
this.languageChooser.setChangeHandler('processLang uageChooser', this);
this.txtUserName.text = '';
this.txtPassword.text = '';
this.textValidator();
this.setLanguageList(this.languageList);
this.setLabelText(this.labelTextId);
this.setSelectedLanguage(this.selectedLanguage);
Key.addListener(this);
this._visible = true;
Selection.setFocus(this.txtUserName);
};
_global.LoginBox.prototype.setLabelText = function(inLabelText) {
this.labelTextId = inLabelText;
this.txtLabel.text = this.language.messages[this.labelTextId];
this.txtLabel._y = (this.txtUserName._y - this.txtLabel.textHeight - this.dbTop._height)/2 + this.dbTop._height;
if( this.txtLabel._y < this.dbTop._height+this.dbTop._y) this.txtLabel._y = this.dbTop._height + this.dbTop._y;
//this.txtLabel.text = inLabelText;
};
_global.LoginBox.prototype.setLanguageList = function(inLanguageList) {
this.languageList = inLanguageList;
this.languageChooser.removeAll();
for (var i = 0; i < this.languageList.length; i ++) {
this.languageChooser.addItem(this.languageList[i].name, this.languageList[i]);
//trace(this.languageList[i].name);
}
this.languageTarget.setSelectedLanguage(this.langu ageList[0]);
this.languageTarget.applyLanguage(this.languageLis t[0]);
};
_global.LoginBox.prototype.setSelectedLanguage = function(inSelectedLanguage) {
this.selectedLanguage = inSelectedLanguage;
for (var i = 0; i < this.languageList.length; i ++) {
if (this.languageList[i].name == inSelectedLanguage.name) {
this.languageChooser.setSelectedIndex(i);
this.languageTarget.applyLanguage(inSelectedLangua ge);
return;
}
}
};
_global.LoginBox.prototype.setLanguageTarget = function(inLanguageTarget) {
this.languageTarget = inLanguageTarget;
};
_global.LoginBox.prototype.getUserName = function() {
return this.txtUserName.text;
};
_global.LoginBox.prototype.getPassword = function() {
return this.txtPassword.text;
};
_global.LoginBox.prototype.getSelectedLanguage = function() {
return this.languageChooser.getSelectedItem().data;
};
_global.LoginBox.prototype.initialized = function() {
return (super.initialized() && (this.btnLogin.setEnabled != null));
};
_global.LoginBox.prototype.applyTextProperty = function(propName, val)
{
setTextProperty(propName, val, this.txtLabel);
setTextProperty(propName, val, this.lblUserName);
setTextProperty(propName, val, this.lblPassword);
setTextProperty(propName, val, this.lblLanguage);
}
_global.LoginBox.prototype.applyStyle = function(inStyle) {
if (!inStyle.showBackgroundImagesOnLogin) {
inStyle.dialogBackgroundImage = null;
}
super.applyStyle(inStyle);
this.txtLabel.textColor = inStyle.bodyText;
this.lblUserName.textColor = inStyle.bodyText;
this.lblPassword.textColor = inStyle.bodyText;
this.lblModerator.textColor = inStyle.bodyText;
this.lblLanguage.textColor = inStyle.bodyText;
this.txtUserName.textColor = inStyle.buttonText;
this.txtUserName._style = inStyle;
this.txtUserName.borderColor = inStyle.borderColor;
this.txtUserName.border = true;
this.txtPassword.textColor = inStyle.buttonText;
this.txtPassword._style = inStyle;
this.txtPassword.borderColor = inStyle.borderColor;
this.txtPassword.border = true;
var c = new Color(this.txtUserNameBackground);
c.setRGB(inStyle.inputBoxBackground);
this.txtUserNameBackground._alpha = inStyle.uiAlpha;
c = new Color(this.txtPasswordBackground);
c.setRGB(inStyle.inputBoxBackground);
this.txtPasswordBackground._alpha = inStyle.uiAlpha;
};
_global.LoginBox.prototype.applyLanguage = function(inLanguage) {
this.language = inLanguage;
this.setLabelText(this.labelTextId);
this.lblUserName.text = this.language.dialog.login.username;
this.lblPassword.text = this.language.dialog.login.password;
this.lblModerator.text = this.language.dialog.login.moderator;
this.lblLanguage.text = this.language.dialog.login.language;
this.btnLogin.setLabel( this.language.dialog.login.loginBtn );
this.btnLogin._x = (this.dialogWidth - this.btnLogin._width) / 2;
};
//PRIVATE METHODS.
_global.LoginBox.prototype.onKeyDown = function() {
if(this.btnLogin.enabled)
{
if(this.handlerObj.isSpecialLanguage(this.language Chooser.getSelectedItem().data.id))
{
if(Key.isDown(Key.CONTROL) && Key.isDown(Key.ENTER))
{
this.processButton();
}
}
else if (Key.isDown(Key.ENTER))
{
this.processButton();
}
}
};
_global.LoginBox.prototype.processButton = function() {
var usr = this.getUserName();
if(usr.trim() != '')
{
this._visible = false;
Key.removeListener(this);
this.handlerObj[this.handlerFunctionName](this);
}
else
{
this.txtUserName.text = '';
Selection.setFocus(this.txtUserName);
}
};
_global.LoginBox.prototype.processLanguageChooser = function() {
var chosenLanguage = this.languageChooser.getSelectedItem().data;
this.languageTarget.setSelectedLanguage(chosenLang uage);
this.languageTarget.applyLanguage(chosenLanguage);
};
_global.LoginBox.prototype.textValidator = function() {
this.btnLogin.setEnabled( (this.getEnabled() && (this.txtUserName.text.length > 0)) );
};
Object.registerClass('LoginBox', _global.LoginBox);
#endinitclip
|