Resulta que estoy haciendo un catalogo usando componentes, el sistema carga mediante un archivo de texto las imagenes de una carpeta que se muestran en forma de tumbails en pantalla, al hacer clic sobre cada una estas se abre a tamaño normal y muestra la descripcion.
Hay un componente que carga un boton "cerrar ventana", al hacer clic sobre este, cierra la imagen ampliada y se ven nuevamente el catalogo (los tumbails)
el favor que les pido, no se si seria posible, es que el usuario no tenga que hacer clic tumbail para ver la imagen, ni en el boton cerrar, para cerrar la ventana, si no que esta se abra y se cierre al mover el mouse unos pixeles o simplemente con moverlo (algo asi como cuando uno hace "rollOver" "rollOut" en un boton con movieclip.
De antemano muchas gracias por la atencion y ayuda que puedan prestarme.
adjunto los archivos de la aplicacion, ojala puedan ayudarme con eso
http://www.rowellandpalmer.com/mauroreyes/catalogo.zip
Código :
<================================================>
codigo hubicado en el primer frame que carga los tumbails
<================================================>
//----------------------------------------------------------------------------
function successFiles(success) {
if (success) {
loadingQR._visible = false;
listFiles();
} else {
statusQR.htmlText = " Failed...!";
}
}
//----------------------------------------------------------------------------
function loadFiles() {
filesVars = new LoadVars();
filesVars.onLoad = successFiles;
filesVars.load("datamontables.txt", filesVars, "POST");
loadingQR._visible = true;
}
//----------------------------------------------------------------------------
function listFiles() {
//load category list
for (i=0; i<filesVars.theNumberofYourCategories; i++) {
comboCat.addItem(filesVars["category"+i], filesVars["category"+i]);
}
//load default category
ct.htmlText = filesVars["category0"];
//load total images of default category
totalImg.htmlText = filesVars[ct.text];
//load gallery title
gallerytittleTxt.htmlText = filesVars["gallerytittle"];
//load description of each image
description1.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"1"];
description2.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"2"];
description3.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"3"];
description4.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"4"];
description5.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"5"];
description6.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"6"];
description7.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"7"];
description8.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"8"];
description9.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"9"];
//load images
img1.loadImage("images/"+ct.text+numImage+"1.jpg");
img2.loadImage("images/"+ct.text+numImage+"2.jpg");
img3.loadImage("images/"+ct.text+numImage+"3.jpg");
img4.loadImage("images/"+ct.text+numImage+"4.jpg");
img5.loadImage("images/"+ct.text+numImage+"5.jpg");
img6.loadImage("images/"+ct.text+numImage+"6.jpg");
img7.loadImage("images/"+ct.text+numImage+"7.jpg");
img8.loadImage("images/"+ct.text+numImage+"8.jpg");
img9.loadImage("images/"+ct.text+numImage+"9.jpg");
//load total page
totalPage.htmlText = "<b>"+math.ceil(Number(totalImg.text/9))+"</b>";
}
//----------------------------------------------------------------------------
//choosen category
function chooseCategory() {
//default dummies value
page.text = "1";
maksImage.text = "2";
numImage = "0";
//get choose category
category = comboCat.getValue();
//load total image of specific category
totalImg.htmlText = filesVars[ct.text];
//load total page
totalPage.htmlText = "<b>"+math.ceil(Number(totalImg.text/9))+"</b>";
//load page validation
pageValidate();
//load description of each image
description1.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"1"];
description2.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"2"];
description3.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"3"];
description4.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"4"];
description5.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"5"];
description6.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"6"];
description7.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"7"];
description8.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"8"];
description9.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"9"];
//load images
img1.loadImage("images/"+ct.text+numImage+"1.jpg");
img2.loadImage("images/"+ct.text+numImage+"2.jpg");
img3.loadImage("images/"+ct.text+numImage+"3.jpg");
img4.loadImage("images/"+ct.text+numImage+"4.jpg");
img5.loadImage("images/"+ct.text+numImage+"5.jpg");
img6.loadImage("images/"+ct.text+numImage+"6.jpg");
img7.loadImage("images/"+ct.text+numImage+"7.jpg");
img8.loadImage("images/"+ct.text+numImage+"8.jpg");
img9.loadImage("images/"+ct.text+numImage+"9.jpg");
//change the scale
img1.setScaleMode("exactFit");
img2.setScaleMode("exactFit");
img3.setScaleMode("exactFit");
img4.setScaleMode("exactFit");
img5.setScaleMode("exactFit");
img6.setScaleMode("exactFit");
img7.setScaleMode("exactFit");
img8.setScaleMode("exactFit");
img9.setScaleMode("exactFit");
//change the position
_root.img1._x = 58.6;
_root.img1._y = 81.7;
_root.img2._x = 294.9;
_root.img2._y = 81.7;
_root.img3._x = 531.1;
_root.img3._y = 81.7;
_root.img4._x = 58.6;
_root.img4._y = 196.2;
_root.img5._x = 294.9;
_root.img5._y = 196.2;
_root.img6._x = 531.1;
_root.img6._y = 196.2;
_root.img7._x = 58.6;
_root.img7._y = 311.2;
_root.img8._x = 294.9;
_root.img8._y = 311.2;
_root.img9._x = 531.1;
_root.img9._y = 311.2;
//hidden features
description1._visible = false;
description2._visible = false;
description3._visible = false;
description4._visible = false;
description5._visible = false;
description6._visible = false;
description7._visible = false;
description8._visible = false;
description9._visible = false;
closeBtt._visible = false;
backDesc._visible = false;
dummies_navigation._visible = false;
//show navigation
_root.firstBtt._visible = true;
_root.prevBtt._visible = true;
_root.nextBtt._visible = true;
_root.lastBtt._visible = true;
_root.goBtt.enabled = true;
}
//----------------------------------------------------------------------------
//page validation
function pageValidate(){
//check if the total page is "0" and "1"
if (totalPage.text == "0" || totalPage.text == "1") {
firstBtt.enabled = false;
prevBtt.enabled = false;
nextBtt.enabled = false;
lastBtt.enabled = false;
} else {
firstBtt.enabled = false;
prevBtt.enabled = false;
nextBtt.enabled = true;
lastBtt.enabled = true;
}
//hidden thumbnails if page = "0"
if(totalPage.text == "0") {
img1._visible = false;
img2._visible = false;
img3._visible = false;
img4._visible = false;
img5._visible = false;
img6._visible = false;
img7._visible = false;
img8._visible = false;
img9._visible = false;
} else {
img1._visible = true;
img2._visible = true;
img3._visible = true;
img4._visible = true;
img5._visible = true;
img6._visible = true;
img7._visible = true;
img8._visible = true;
img9._visible = true;
}
//visible warning box when the total page is "0"
if (totalPage.text == "0") {
_root.messageBox._visible = true;
_root.messageBox.setMessage("No hay imagenes en esta sección, por favor seleccione otra!");
} else {
_root.messageBox._visible = false;
}
}
//----------------------------------------------------------------------------
//Run function
loadFiles();
//----------------------------------------------------------------------------
//hidden features
messageBox._visible = false;
description1._visible = false;
description2._visible = false;
description3._visible = false;
description4._visible = false;
description5._visible = false;
description6._visible = false;
description7._visible = false;
description8._visible = false;
description9._visible = false;
dummies_navigation._visible = false;
closeBtt._visible = false;
backDesc._visible = false;
//----------------------------------------------------------------------------
//set restriction
gtptxt.restrict = "0-9";
//----------------------------------------------------------------------------
//disable features
firstBtt.enabled = false;
prevBtt.enabled = false;
//----------------------------------------------------------------------------
//set code for message box close button
messageCode = function(AdvancedMessageBox){
_root.messageBox._visible = false;
}
//----------------------------------------------------------------------------
//set code for preview close button
closePreview = function(){
//hidden close button
closeBtt._visible = false;
backDesc._visible = false;
//hidden description
_root.description1._visible = false;
_root.description2._visible = false;
_root.description3._visible = false;
_root.description4._visible = false;
_root.description5._visible = false;
_root.description6._visible = false;
_root.description7._visible = false;
_root.description8._visible = false;
_root.description9._visible = false;
//hidden features
dummies_navigation._visible = false;
//show navigation
_root.firstBtt._visible = true;
_root.prevBtt._visible = true;
_root.nextBtt._visible = true;
_root.lastBtt._visible = true;
_root.goBtt.enabled = true;
//show thumbnail
_root.img1._visible = true;
_root.img2._visible = true;
_root.img3._visible = true;
_root.img4._visible = true;
_root.img5._visible = true;
_root.img6._visible = true;
_root.img7._visible = true;
_root.img8._visible = true;
_root.img9._visible = true;
//change the scale
img1.setScaleMode("exactFit");
img2.setScaleMode("exactFit");
img3.setScaleMode("exactFit");
img4.setScaleMode("exactFit");
img5.setScaleMode("exactFit");
img6.setScaleMode("exactFit");
img7.setScaleMode("exactFit");
img8.setScaleMode("exactFit");
img9.setScaleMode("exactFit");
//change the position
_root.img1._x = 58.6;
_root.img1._y = 81.7;
_root.img2._x = 294.9;
_root.img2._y = 81.7;
_root.img3._x = 531.1;
_root.img3._y = 81.7;
_root.img4._x = 58.6;
_root.img4._y = 196.2;
_root.img5._x = 294.9;
_root.img5._y = 196.2;
_root.img6._x = 531.1;
_root.img6._y = 196.2;
_root.img7._x = 58.6;
_root.img7._y = 311.2;
_root.img8._x = 294.9;
_root.img8._y = 311.2;
_root.img9._x = 531.1;
_root.img9._y = 311.2;
}
//----------------------------------------------------------------------------
//set code go to page button
goBtt.onRelease = function () {
//variable
a = (gtptxt.text)-1;
//create new text field
_root.createTextField("chkimg",1,800,300,100,25);
chkimg.text = filesVars[ct.text+a+"1"]
chkimg.type = "dynamic";
chkimg.border = true;
//check the form is blank
if (!gtptxt.length){
_root.messageBox._visible = true;
_root.messageBox.setMessage("Por favor, ingrese un valor en el cuadro de texto!");
} else {
messageBox._visible = false;
//check the page 0
if (Number(gtptxt.text) < 1){
messageBox._visible = true;
messageBox.setMessage("No hay imagenes en esta sección, por favor seleccione otra!");
}
//load image and check if there's no such image on the query
if (!_root.chkimg.length){
messageBox._visible = true;
messageBox.setMessage("No hay imagenes en esta sección, por favor seleccione otra!");
} else {
numImage = gtptxt.text-1;
page.text = gtptxt.text;
messageBox._visible = false;
//load description of each image
description1.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+a+"1"];
description2.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+a+"2"];
description3.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+a+"3"];
description4.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+a+"4"];
description5.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+a+"5"];
description6.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+a+"6"];
description7.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+a+"7"];
description8.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+a+"8"];
description9.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+a+"9"];
//load image
img1.loadImage("images/"+ct.text+a+"1.jpg");
img2.loadImage("images/"+ct.text+a+"2.jpg");
img3.loadImage("images/"+ct.text+a+"3.jpg");
img4.loadImage("images/"+ct.text+a+"4.jpg");
img5.loadImage("images/"+ct.text+a+"5.jpg");
img6.loadImage("images/"+ct.text+a+"6.jpg");
img7.loadImage("images/"+ct.text+a+"7.jpg");
img8.loadImage("images/"+ct.text+a+"8.jpg");
img9.loadImage("images/"+ct.text+a+"9.jpg");
}
}
//enabled and disabled prev and first
if (page.text <= 1) {
_root.prevBtt.enabled = false;
_root.firstBtt.enabled = false;
} else {
_root.prevBtt.enabled = true;
_root.firstBtt.enabled = true;
}
//enabled and disabled next and last
if (page.text <> totalPage.text) {
_root.nextBtt.enabled = true;
_root.lastBtt.enabled = true;
} else {
_root.nextBtt.enabled = false;
_root.lastBtt.enabled = false;
}
}
//----------------------------------------------------------------------------
//code for navigation buttons
//----------------------------------------------------------------------------
//first button
firstBtt.onRelease = function () {
//default dummies value
page.text = "1";
maksImage.text = "2";
numImage = "0";
//-------------------------------------------------------------------------
//disabled first and last button at the first page
prevBtt.enabled = false;
firstBtt.enabled = false;
//-------------------------------------------------------------------------
//enable next and last button
nextBtt.enabled = true;
lastBtt.enabled = true;
//-------------------------------------------------------------------------
//load description of each image
description1.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"1"];
description2.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"2"];
description3.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"3"];
description4.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"4"];
description5.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"5"];
description6.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"6"];
description7.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"7"];
description8.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"8"];
description9.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"9"];
//load images
img1.loadImage("images/"+ct.text+numImage+"1.jpg");
img2.loadImage("images/"+ct.text+numImage+"2.jpg");
img3.loadImage("images/"+ct.text+numImage+"3.jpg");
img4.loadImage("images/"+ct.text+numImage+"4.jpg");
img5.loadImage("images/"+ct.text+numImage+"5.jpg");
img6.loadImage("images/"+ct.text+numImage+"6.jpg");
img7.loadImage("images/"+ct.text+numImage+"7.jpg");
img8.loadImage("images/"+ct.text+numImage+"8.jpg");
img9.loadImage("images/"+ct.text+numImage+"9.jpg");
}
//-------------------------------------------------------------------------
//prev button
prevBtt.onRelease = function () {
numImage = --numImage;
maksImage.text = "2";
//-------------------------------------------------------------------------
//check the first page
if (page.text < 2) {
page.text = "1";
}else{
page.text = --page.text;
}
//-------------------------------------------------------------------------
//disabled first and last button at the first page
if (numImage < 1){
prevBtt.enabled = false;
firstBtt.enabled = false;
} else {
prevBtt.enabled = true;
firstBtt.enabled = true;
}
//-------------------------------------------------------------------------
//enable next and last button
nextBtt.enabled = true;
lastBtt.enabled = true;
//-------------------------------------------------------------------------
//load description of each image
description1.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"1"];
description2.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"2"];
description3.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"3"];
description4.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"4"];
description5.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"5"];
description6.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"6"];
description7.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"7"];
description8.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"8"];
description9.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"9"];
//load images
img1.loadImage("images/"+ct.text+numImage+"1.jpg");
img2.loadImage("images/"+ct.text+numImage+"2.jpg");
img3.loadImage("images/"+ct.text+numImage+"3.jpg");
img4.loadImage("images/"+ct.text+numImage+"4.jpg");
img5.loadImage("images/"+ct.text+numImage+"5.jpg");
img6.loadImage("images/"+ct.text+numImage+"6.jpg");
img7.loadImage("images/"+ct.text+numImage+"7.jpg");
img8.loadImage("images/"+ct.text+numImage+"8.jpg");
img9.loadImage("images/"+ct.text+numImage+"9.jpg");
}
//-------------------------------------------------------------------------
//next button
nextBtt.onRelease = function () {
page.text = ++page.text;
numImage = ++numImage;
maksImage.text = ++maksImage.text;
//-------------------------------------------------------------------------
//enabled first and prev button
firstBtt.enabled = true;
prevBtt.enabled = true;
//-------------------------------------------------------------------------
//check the last page
if (Number(maksImage.text) > Number(totalPage.text)) {
nextBtt.enabled = false;
lastBtt.enabled = false;
} else {
nextBtt.enabled = true;
lastBtt.enabled = true;
}
//-------------------------------------------------------------------------
//load description of each image
description1.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"1"];
description2.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"2"];
description3.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"3"];
description4.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"4"];
description5.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"5"];
description6.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"6"];
description7.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"7"];
description8.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"8"];
description9.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"9"];
//load images
img1.loadImage("images/"+ct.text+numImage+"1.jpg");
img2.loadImage("images/"+ct.text+numImage+"2.jpg");
img3.loadImage("images/"+ct.text+numImage+"3.jpg");
img4.loadImage("images/"+ct.text+numImage+"4.jpg");
img5.loadImage("images/"+ct.text+numImage+"5.jpg");
img6.loadImage("images/"+ct.text+numImage+"6.jpg");
img7.loadImage("images/"+ct.text+numImage+"7.jpg");
img8.loadImage("images/"+ct.text+numImage+"8.jpg");
img9.loadImage("images/"+ct.text+numImage+"9.jpg");
}
//-------------------------------------------------------------------------
//last button
lastBtt.onRelease = function () {
page.text = totalPage.text;
numImage = (totalPage.text)-1;
//-------------------------------------------------------------------------
//enabled first and prev button
firstBtt.enabled = true;
prevBtt.enabled = true;
//-------------------------------------------------------------------------
//check the last page
nextBtt.enabled = false;
lastBtt.enabled = false;
//-------------------------------------------------------------------------
//load description of each image
description1.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"1"];
description2.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"2"];
description3.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"3"];
description4.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"4"];
description5.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"5"];
description6.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"6"];
description7.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"7"];
description8.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"8"];
description9.htmlText = "<b>Descripción.</b><br>" + filesVars[ct.text+numImage+"9"];
//load images
img1.loadImage("images/"+ct.text+numImage+"1.jpg");
img2.loadImage("images/"+ct.text+numImage+"2.jpg");
img3.loadImage("images/"+ct.text+numImage+"3.jpg");
img4.loadImage("images/"+ct.text+numImage+"4.jpg");
img5.loadImage("images/"+ct.text+numImage+"5.jpg");
img6.loadImage("images/"+ct.text+numImage+"6.jpg");
img7.loadImage("images/"+ct.text+numImage+"7.jpg");
img8.loadImage("images/"+ct.text+numImage+"8.jpg");
img9.loadImage("images/"+ct.text+numImage+"9.jpg");
}
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
//set Flash UI component style
comboCat.setStyleProperty("arrow", 0x4D6185);
comboCat.setStyleProperty("check", 0x4D6185);
comboCat.setStyleProperty("track", 0xEEEEEE);
comboCat.setStyleProperty("selectionDisabled", 0xEFEFEF);
comboCat.setStyleProperty("selectionUnfocused", 0x316AC5);
comboCat.setStyleProperty("background", 0xffffff);
comboCat.setStyleProperty("darkshadow", 0x7C9FD3);
comboCat.setStyleProperty("shadow", 0xFFFFFF);
comboCat.setStyleProperty("highlight", 0xFFFFFF);
comboCat.setStyleProperty("highlight3D", 0x7C9FD3);
comboCat.setStyleProperty("face", 0xB1CDFA);
comboCat.setStyleProperty("radioDot", 0x4D6185);
comboCat.setStyleProperty("foregroundDisabled", 0x999999);
comboCat.setStyleProperty("backgroundDisabled", 0xFFFFFF);
comboCat.setStyleProperty("textColor", 0x000033);
comboCat.setStyleProperty("textDisabled", 0x666666);
comboCat.setStyleProperty("selection", 0x316AC5);
//----------------------------------------------------------------------------
cr.htmlText= "copyright © 2003. " + "<font color='#000066'><u><a href='mailto:[email protected]'>[email protected]</a></u></font>";
//----------------------------------------------------------------------------
stop();
<================================================>
codigo hubicado en el boton que cierra la imagen
<================================================>
#initclip 1
function FPushButtonClass()
{
this.init();
}
FPushButtonClass.prototype = new FUIComponentClass();
Object.registerClass("FPushButtonSymbol", FPushButtonClass);
FPushButtonClass.prototype.init = function()
{
super.setSize(this._width,this._height);
this.boundingBox_mc.unloadMovie();
this.attachMovie("fpb_states","fpbState_mc",1);
this.attachMovie("FLabelSymbol","fLabel_mc",2);
this.attachMovie("fpb_hitArea","fpb_hitArea_mc",3);
super.init();
this.btnState = false;
this.setClickHandler(this.clickHandler);
this._xscale = 100;
this._yscale = 100;
this.setSize(this.width,this.height);
if(this.label != undefined)this.setLabel(this.label);
// ACCESSIBILITY DEFINED ::o:: _accImpl object defined in base class ::o::
this.ROLE_SYSTEM_PUSHBUTTON = 0x2b;
this.STATE_SYSTEM_PRESSED = 0x00000008;
this.EVENT_OBJECT_STATECHANGE = 0x800a;
this.EVENT_OBJECT_NAMECHANGE = 0x800c;
this._accImpl.master = this;
this._accImpl.stub = false;
this._accImpl.get_accRole = this.get_accRole;
this._accImpl.get_accName = this.get_accName;
this._accImpl.get_accState = this.get_accState;
this._accImpl.get_accDefaultAction = this.get_accDefaultAction;
this._accImpl.accDoDefaultAction = this.accDoDefaultAction;
}
FPushButtonClass.prototype.setHitArea = function(w,h)
{
var hit = this.fpb_hitArea_mc;
this.hitArea = hit;
hit._visible = false;
hit._width = w;
hit._height = (arguments.length > 1) ? h : hit._height;
}
FPushButtonClass.prototype.setSize = function(w,h)
{
w = (w < 6) ? 6 : w;
if (arguments.length >1){
if (h < 6){
h = 6;
}
}
super.setSize(w,h)
this.setLabel(this.getLabel());
this.arrangeLabel();
this.setHitArea(w,h);
this.boundingBox_mc._width = w;
this.boundingBox_mc._height = h;
this.drawFrame();
if(this.focused)super.myOnSetFocus();
this.initContentPos("fLabel_mc");
}
FPushButtonClass.prototype.arrangeLabel = function()
{
var label = this.fLabel_mc;
var h = this.height;
var w = this.width-2;
var b = 1; // frame border width
this.fLabel_mc.setSize(w - (b * 4));
label._x = (b * 3);//padding value;
label._y = ( h/2-label._height/2);
}
FPushButtonClass.prototype.getLabel = function()
{
return (this.fLabel_mc.labelField.text);
}
FPushButtonClass.prototype.setLabel = function(label)
{
this.fLabel_mc.setLabel(label);
this.txtFormat();
this.arrangeLabel()
// ACCESSIBILITY EVENT
if (Accessibility.isActive()){
Accessibility.sendEvent( this, 0, this.EVENT_OBJECT_NAMECHANGE );
}
}
FPushButtonClass.prototype.getEnabled = function()
{
return(this.enabled);
}
FPushButtonClass.prototype.setEnabled = function(enable)
{
if ( enable || enable == undefined ) {
this.gotoFrame(1);
this.drawFrame();
this.flabel_mc.setEnabled(true);
this.enabled = true;
super.setEnabled(true);
} else {
this.gotoFrame(4);
this.drawFrame();
this.flabel_mc.setEnabled(false);
this.enabled = false;
super.setEnabled(false);
}
}
FPushButtonClass.prototype.txtFormat = function()
{
var txtS = this.textStyle;
var sTbl = this.styleTable;
txtS.align = (sTbl.textAlign.value == undefined) ? txtS.align = "center" : undefined;
txtS.leftMargin = (sTbl.textLeftMargin.value == undefined) ? txtS.leftMargin = 1 : undefined;
txtS.rightMargin = (sTbl.textRightMargin.value == undefined) ? txtS.rightMargin = 1 : undefined
if(this.fLabel_mc._height > this.height){
super.setSize(this.width,this.fLabel_mc._height);
}else{
super.setSize(this.width,this.height);
}
this.fLabel_mc.labelField.setTextFormat(this.textStyle);
this.setEnabled(this.enable);
}
FPushButtonClass.prototype.drawFrame = function ()
{
var b = 1; // border width of frame;
var x1 = 0;
var y1 = 0;
var x2 = this.width;
var y2 = this.height;
var mc_array = ["up_mc","over_mc","down_mc","disabled_mc"];
var frame = mc_array[(this.fpbState_mc._currentframe) -1];
var mc = "frame";
for (var i =0;i<6; i++){
x1 += ((i)%2)*b;
y1 += ((i)%2)*b;
x2 -= ((i+1)%2)*b;
y2 -= ((i+1)%2)*b;
var w = Math.abs (x1 - x2)+2*b;
var h = Math.abs (y1 - y2)+2*b;
this.fpbState_mc[frame][mc+i]._width = w;
this.fpbState_mc[frame][mc+i]._height = h;
this.fpbState_mc[frame][mc+i]._x = x1-b;
this.fpbState_mc[frame][mc+i]._y = y1-b;
}
}
FPushButtonClass.prototype.setClickHandler = function(chng,obj)
{
this.handlerObj = (arguments.length<2) ? this._parent : obj;
this.clickHandler = chng;
}
FPushButtonClass.prototype.executeCallBack = function()
{
this.handlerObj[this.clickHandler](this);
}
FPushButtonClass.prototype.initContentPos = function (mc)
{
this.incrVal = 1; // DISTANCE TEXT SHIFTS DOWN AND RIGHT ::mr::
this.initx = this[mc]._x - (this.getBtnState())*this.incrVal;
this.inity = this[mc]._y - (this.getBtnState())*this.incrVal;
this.togx = this.initx + this.incrVal;
this.togy = this.inity + this.incrVal;
}
FPushButtonClass.prototype.setBtnState = function (state)
{
this.btnState = state;
if (state) {
this.fLabel_mc._x = this.togx;
this.fLabel_mc._y = this.togy;
}else{
this.fLabel_mc._x = this.initx;
this.fLabel_mc._y = this.inity;
}
}
FPushButtonClass.prototype.getBtnState = function ()
{
return this.btnState;
}
FPushButtonClass.prototype.myOnSetFocus = function()
{
this.focused = true;
super.myOnSetFocus()
}
FPushButtonClass.prototype.onPress = function ()
{
this.pressFocus();
this.fpbState_mc.gotoAndStop(3);
this.drawFrame();
this.setBtnState(true);
// ACCESSIBILITY EVENT
if (Accessibility.isActive()){
Accessibility.sendEvent( this, 0, this.EVENT_OBJECT_STATECHANGE,true );
}
}
FPushButtonClass.prototype.onRelease = function ()
{
this.fpbState_mc.gotoAndStop(2);
this.drawFrame();
this.executeCallBack();
this.setBtnState(false)
// ACCESSIBILITY EVENT
if (Accessibility.isActive()){
Accessibility.sendEvent( this, 0, this.EVENT_OBJECT_STATECHANGE,true );
}
}
FPushButtonClass.prototype.onRollOver = function ()
{
this.fpbState_mc.gotoAndStop(2);
this.drawFrame();
}
FPushButtonClass.prototype.onRollOut = function ()
{
this.fpbState_mc.gotoAndStop(1);
this.drawFrame();
}
FPushButtonClass.prototype.onReleaseOutside = function ()
{
this.setBtnState(false);
this.fpbState_mc.gotoAndStop(1);
this.drawFrame();
}
FPushButtonClass.prototype.onDragOut = function ()
{
this.setBtnState(false);
this.fpbState_mc.gotoAndStop(1);
this.drawFrame();
}
FPushButtonClass.prototype.onDragOver = function ()
{
this.setBtnState(true);
this.fpbState_mc.gotoAndStop(3);
this.drawFrame();
}
FPushButtonClass.prototype.myOnKeyDown = function( )
{
if (Key.getCode() == Key.SPACE && this.pressOnce == undefined ) {
this.onPress();
this.pressOnce = 1;
}
}
FPushButtonClass.prototype.myOnKeyUp = function( )
{
if (Key.getCode() == Key.SPACE) {
this.onRelease();
this.pressOnce = undefined;
}
}
// START ACCESSIBILITY METHODS
FPushButtonClass.prototype.get_accRole = function(childId)
{
return this.master.ROLE_SYSTEM_PUSHBUTTON;
}
FPushButtonClass.prototype.get_accName = function(childId)
{
return this.master.getLabel();
}
FPushButtonClass.prototype.get_accState = function(childId)
{
if(this.pressOnce){
return this.master.STATE_SYSTEM_PRESSED;
}else{
return this.master.STATE_SYSTEM_DEFAULT;
}
}
FPushButtonClass.prototype.get_accDefaultAction = function(childId)
{
return "Press";
}
FPushButtonClass.prototype.accDoDefaultAction = function(childId)
{
this.master.onPress();
this.master.onRelease();
}
// END ACCESSIBILITY METHODS
#endinitclip
boundingBox_mc._visible = false;
deadPreview._visible = false;Editado por Cep. Por favor usa las etiquetas de código.
