Comunidad de diseño web y desarrollo en internet online

ejecutar funcion sin hacer click a boton

Citar            
MensajeEscrito el 04 Feb 2010 05:41 pm
Hola gente, tengo un pequenio detalle, ya tengo la web que estoy trabajando ista.

la cosa es la siguiente: una galeria de fotos con albums. Al cargarla me pone automaticamente la primera galeria que lee de un config.xml....eso esta muy bien...pero tambien tiene un boton de Categorías, el cual al hacer click te manda a un menu de categorias.

Me gustaría saber cómo ejecutar la accion de ese boton al cargarse el swf sin tener que poner a la gente a darle a Categorias.


coloco el codigo abajo para que lo vean

Código :


import flash.display.*;
//
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//
timeBar._visible = false;
blackBack._visible = false;
blackBack._alpha = 0;
categoriesAdd._visible = false;
bottomBar.closeCategories._visible = false;
bottomBar.openCategories._visible = true;

bottomBar.btPlay._visible = true;
bottomBar.btStop._visible = false;

contentBox._visible = false;
contentBox._alpha = 0;
//
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//
loadCategoriesXMLFirstTime ();
//
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//
function loadCategoriesXMLFirstTime () {

   var mainCatFirstTime:XML = new XML ();
   mainCatFirstTime.ignoreWhite = true;
   mainCatFirstTime.onLoad = function (success) {
      if (success) {
         var xml:XMLNode = this.firstChild;
         var categoryTitleFirstTime:String = xml.childNodes[0].childNodes[0].childNodes[0].nodeValue;
         newCategoryTitle = categoryTitleFirstTime;
         categoryTitleForContent = xml.childNodes[0].childNodes[0].childNodes[0].nodeValue;

         displayPositions ();
         loadImages ();
      }
   };
   mainCatFirstTime.load ("elite_xml_imagegallery_xml/categories.xml");
}
//
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//
function setCategoriesSize () {
   if (isModule == true) {
      if (_root.subMenuOpened == true) {
         for (catId = 0; catId < xmlCatTotalItems; catId++) {
            categoriesAdd.attach["categoriesAttach" + catId].descriptionMC.scrollSlider.arrows._tint = color;
            categoriesAdd.attach["categoriesAttach" + catId].grey._height = (Stage.height - 120) - 50;
            categoriesAdd.attach["categoriesAttach" + catId].black._height = (Stage.height - 120) - 54;
            categoriesAdd.attach["categoriesAttach" + catId].bt._height = (Stage.height - 120) - 50;
            categoriesAdd.attach["categoriesAttach" + catId].masker._height = ((Stage.height - 120) - categoriesAdd.attach["categoriesAttach" + catId].masker._y) - 70;
            categoriesAdd.attach["categoriesAttach" + catId].descriptionMC.scrollBar._height = categoriesAdd.attach["categoriesAttach" + catId].masker._height;
         }
      }
      else {
         for (catId = 0; catId < xmlCatTotalItems; catId++) {
            categoriesAdd.attach["categoriesAttach" + catId].descriptionMC.scrollSlider.arrows._tint = color;
            categoriesAdd.attach["categoriesAttach" + catId].grey._height = (Stage.height - 95) - 50;
            categoriesAdd.attach["categoriesAttach" + catId].black._height = (Stage.height - 95) - 54;
            categoriesAdd.attach["categoriesAttach" + catId].bt._height = (Stage.height - 95) - 50;
            categoriesAdd.attach["categoriesAttach" + catId].masker._height = ((Stage.height - 95) - categoriesAdd.attach["categoriesAttach" + catId].masker._y) - 70;
            categoriesAdd.attach["categoriesAttach" + catId].descriptionMC.scrollBar._height = categoriesAdd.attach["categoriesAttach" + catId].masker._height;
         }
      }
   }
   else {
      for (catId = 0; catId < xmlCatTotalItems; catId++) {
         categoriesAdd.attach["categoriesAttach" + catId].descriptionMC.scrollSlider.arrows._tint = color;
         categoriesAdd.attach["categoriesAttach" + catId].grey._height = Stage.height - 50;
         categoriesAdd.attach["categoriesAttach" + catId].black._height = Stage.height - 54;
         categoriesAdd.attach["categoriesAttach" + catId].bt._height = Stage.height - 50;
         categoriesAdd.attach["categoriesAttach" + catId].masker._height = (Stage.height - categoriesAdd.attach["categoriesAttach" + catId].masker._y) - 70;
         categoriesAdd.attach["categoriesAttach" + catId].descriptionMC.scrollBar._height = categoriesAdd.attach["categoriesAttach" + catId].masker._height;
      }
   }
   setPositions ();
}
//
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//
function loadCategories () {
   abortSlideShow ();
   blackBack._visible = true;
   ZigoEngine.doTween (blackBack,'_alpha',100,1,"linear",0,function () {
      loadCategoriesXML ();
   });
}
//
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//
function loadCategoriesXML () {
   //
   categoriesAdd._visible = true;
   categoriesAdd._alpha = 100;
   //
   bottomBar.closeCategories._visible = true;
   bottomBar.openCategories._visible = false;
   //
   var mainCategories:XML = new XML ();
   mainCategories.ignoreWhite = true;
   mainCategories.onLoad = function (success) {
      if (success) {
         var xml:XMLNode = this.firstChild;
         xmlCatTotalItems = xml.childNodes.length;
         for (i = 0; i < xml.childNodes.length; i++) {
            var categoryTitle:String = xml.childNodes[i].childNodes[0].childNodes[0].nodeValue;
            var categoryDescription:String = xml.childNodes[i].childNodes[1].childNodes[0].nodeValue;
            var categoryPicture:String = xml.childNodes[i].childNodes[2].childNodes[0].nodeValue;
            var categoryXml:String = xml.childNodes[i].childNodes[3].childNodes[0].nodeValue;
            //
            categoriesAdd.attach.attachMovie ("categoriesAttach","categoriesAttach" + i,i);
            categoriesAdd.attach["categoriesAttach" + i].descriptionMC.scrollBar._visible = false;
            categoriesAdd.attach["categoriesAttach" + i].descriptionMC.scrollSlider._visible = false;
            //
            categoriesAdd.attach["categoriesAttach" + i].titleTxt.htmlText = categoryTitle;
            categoryTitleForContent = xml.childNodes[0].childNodes[0].childNodes[0].nodeValue;
            //
            categoriesAdd.attach["categoriesAttach" + i].descriptionMC.descriptionTxt.txt.autoSize = true;
            categoriesAdd.attach["categoriesAttach" + i].descriptionMC.descriptionTxt.txt.htmlText = categoryDescription;
            //
            if (categoriesAdd.attach["categoriesAttach" + i].descriptionMC.descriptionTxt.txt._height > categoriesAdd.attach["categoriesAttach" + i].masker._height) {
               categoriesAdd.attach["categoriesAttach" + i].descriptionMC.scrollSlider._visible = true;
               categoriesAdd.attach["categoriesAttach" + i].descriptionMC.scrollBar._visible = true;
            }
            //                 
            catImagesArr.push (categoryPicture);
            catId = i;
            //
            categoriesAdd.attach["categoriesAttach" + i].bt.instanceCatTitle = categoryTitle;
            categoriesAdd.attach["categoriesAttach" + i].bt.instanceXML = categoryXml;

            loadCategoriesSmoothed (catImagesArr[catId],categoriesAdd.attach["categoriesAttach" + catId].picture);
            ZigoEngine.doTween (categoriesAdd.attach["categoriesAttach" + i],'_x',260 * i,0.5,"linear",i / 260);
            //
            categoriesAdd.attach["categoriesAttach" + i].bt.onRelease = function () {
               newCategoryTitle = this.instanceCatTitle;
               categoryTitleForContent = this.instanceCatTitle
               newCategoryXML = this.instanceXML;
               closeCategories ();
               removeThumbnails ();
            };
            initFloat (categoriesAdd);
            setCategoriesSize ();
         }
      }
   };
   mainCategories.load ("elite_xml_imagegallery_xml/categories.xml");
}
//
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//
function closeCategories () {
   ZigoEngine.doTween (categoriesAdd,'_alpha',0,1,"linear",0,function () {
      categoriesAdd._visible = false;
      removeCategoriesList ();
   });
   //
   ZigoEngine.doTween (blackBack,'_alpha',0,1,"linear",1,function () {
      blackBack._visible = false;
      bottomBar.closeCategories._visible = false;
      bottomBar.openCategories._visible = true;
   });
}
//
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//
function removeCategoriesList () {
   for (catId = 0; catId < xmlCatTotalItems; catId++) {
      removeMovieClip (categoriesAdd.attach["categoriesAttach" + catId]);
   }
}
//
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//
function removeThumbnails () {
   ZigoEngine.doTween (imageContainer,'_alpha',0,1,"linear");
   for (tmbId = 0; tmbId < totalImages; tmbId++) {
      removeMovieClip (tmbs.containerTmbs["attach" + tmbId]);
      if (tmbId == totalImages - 1) {
         delete tmbs.containerTmbs.onEnterFrame;
         loadImagesByCat ();
         tmbs._alpha = 100;
         tmbs.containerTmbs._x = 0;
      }
   }
}
//
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//
function loadImages () {
   var images:XML = new XML ();
   images.ignoreWhite = true;
   images.onLoad = function (success) {
      if (success) {
         var xml:XMLNode = this.firstChild;
         totalImages = xml.childNodes.length;
         for (i = 0; i < xml.childNodes.length; i++) {
            var imagesTitle:String = xml.childNodes[i].childNodes[0].childNodes[0].nodeValue;
            var imagesLarge:String = xml.childNodes[i].childNodes[1].childNodes[0].nodeValue;
            var imagesTmb:String = xml.childNodes[i].childNodes[2].childNodes[0].nodeValue;
            var imagesDesc:String = xml.childNodes[i].childNodes[3].childNodes[0].nodeValue;
            //
            bottomBar.rightSide.imageTxt.txt.autoSize = true;
            bottomBar.rightSide.imageTxt.txt.text = "1";
            //
            bottomBar.rightSide.totalTxt.txt.autoSize = true;
            bottomBar.rightSide.totalTxt.txt.text = totalImages;
            //
            displayPositions ();
            //
            imageTitleArr.push (imagesTitle);
            imagesArr.push (imagesLarge);
            imageDescArr.push (imagesDesc);
            //
            tmbs.containerTmbs.attachMovie ("attach","attach" + i,i);
            tmbs.containerTmbs["attach" + i]._x = i * 30;
            //
            loadThumbnails (imagesTmb,tmbs.containerTmbs["attach" + i].picture);
            loadThumbnails (imagesTmb,tmbs.containerTmbs["attach" + i].largeTmb.picture);
            //
            contentBox.contentBox_text.catText.text = categoryTitleForContent;
            contentBox.contentBox_text.titleText.text = xml.childNodes[0].childNodes[0].childNodes[0].nodeValue;
            contentBox.contentBox_text.descText.htmlText = xml.childNodes[0].childNodes[3].childNodes[0].nodeValue;
            contentBox.contentBox_text.descText.autoSize = true;
            myListenerload.onResize ();
            //
            tmbs.containerTmbs["attach" + i].bt.idInstance = i;
            //
            tmbs.containerTmbs["attach" + i].bt.onRelease = function () {
               //
               cursorArr = this.idInstance;
               //
               for (a = 0; a < totalImages; a++) {
                  if(tmbs.containerTmbs["attach" + a].back._tint == color){
                     tmbs.containerTmbs["attach" + a].bt.enabled = true;
                     tmbs.containerTmbs["attach" + a].back._tint = 0x353535;
                  }
                  //
                  if(a > 0){
                     if(a == totalImages - 1){
                        tmbs.containerTmbs["attach" + cursorArr].gotoAndPlay("close");
                        tmbs.containerTmbs["attach" + cursorArr].bt.enabled = false;
                        tmbs.containerTmbs["attach" + cursorArr].back._tint = color;
                     }
                  }
               }
               //
               abortSlideShow ();
               //
               bottomBar.rightSide.imageTxt.txt.autoSize = true;
               bottomBar.rightSide.imageTxt.txt.text = cursorArr + 1;
               //
               displayPositions ();
               //
               contentBox.contentBox_text.catText.text = categoryTitleForContent;
               contentBox.contentBox_text.titleText.text = imageTitleArr[cursorArr];
               contentBox.contentBox_text.descText.htmlText = imageDescArr[cursorArr];
               contentBox.contentBox_text.descText.autoSize = true;
               myListenerload.onResize ();
               //
               ZigoEngine.doTween (imageContainer,'_alpha',0,1,"easeOutExpo",0,function () {
                  loadBitmapSmoothed (imagesArr[cursorArr],imageContainer);
               });
            };
         }
      }
      loadBitmapSmoothed (imagesArr[cursorArr],imageContainer);
   };
   images.load ("elite_xml_imagegallery_xml/category1.xml");
}
//
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//
function loadImagesByCat () {
   //
   commingFromNewCat = true;
   tmbs.startEnterFrame ();
   imagesArrByCat.splice (0);
   cursorArr = 0;
   //
   var imagesByCat:XML = new XML ();
   imagesByCat.ignoreWhite = true;
   imagesByCat.onLoad = function (success) {
      if (success) {
         var xml:XMLNode = this.firstChild;
         totalImages = xml.childNodes.length;
         for (i = 0; i < xml.childNodes.length; i++) {
            var imagesTitleByCat:String = xml.childNodes[i].childNodes[0].childNodes[0].nodeValue;
            var imagesLargeByCat:String = xml.childNodes[i].childNodes[1].childNodes[0].nodeValue;
            var imagesTmbByCat:String = xml.childNodes[i].childNodes[2].childNodes[0].nodeValue;
            var imagesDescByCat:String = xml.childNodes[i].childNodes[3].childNodes[0].nodeValue;
            //
            bottomBar.rightSide.imageTxt.txt.autoSize = true;
            bottomBar.rightSide.imageTxt.txt.text = "1";
            //
            bottomBar.rightSide.totalTxt.txt.autoSize = true;
            bottomBar.rightSide.totalTxt.txt.text = totalImages;
            //
            displayPositions ();
            //
            imagesArrByCat.push (imagesLargeByCat);
            //
            tmbs.containerTmbs.attachMovie ("attach","attach" + i,i);
            tmbs.containerTmbs["attach" + i]._x = i * 30;
            //
            loadThumbnails (imagesTmbByCat,tmbs.containerTmbs["attach" + i].picture);
            loadThumbnails (imagesTmbByCat,tmbs.containerTmbs["attach" + i].largeTmb.picture);
            //
            contentBox.contentBox_text.catText.text = categoryTitleForContent;
            contentBox.contentBox_text.titleText.text = xml.childNodes[0].childNodes[0].childNodes[0].nodeValue;
            contentBox.contentBox_text.descText.htmlText = xml.childNodes[0].childNodes[3].childNodes[0].nodeValue;
            contentBox.contentBox_text.descText.autoSize = true;
            myListenerload.onResize ();
            //
            tmbs.containerTmbs["attach" + i].bt.idInstance = i;
            //
            tmbs.containerTmbs["attach" + i].bt.onRelease = function () {
               cursorArr = this.idInstance;
               //
               for (a = 0; a < totalImages; a++) {
                  if(tmbs.containerTmbs["attach" + a].back._tint == color){
                     tmbs.containerTmbs["attach" + a].bt.enabled = true;
                     tmbs.containerTmbs["attach" + a].back._tint = 0x353535;
                  }
                  //
                  if(a > 0){
                     if(a == totalImages - 1){
                        tmbs.containerTmbs["attach" + cursorArr].gotoAndPlay("close");
                        tmbs.containerTmbs["attach" + cursorArr].bt.enabled = false;
                        tmbs.containerTmbs["attach" + cursorArr].back._tint = color;
                     }
                  }
               }
               //
               abortSlideShow ();
               //
               bottomBar.rightSide.imageTxt.txt.autoSize = true;
               bottomBar.rightSide.imageTxt.txt.text = cursorArr + 1;
               //
               displayPositions ();
               //
               contentBox.contentBox_text.catText.text = categoryTitleForContent;
               contentBox.contentBox_text.titleText.text = imageTitleArr[cursorArr];
               contentBox.contentBox_text.descText.htmlText = imageDescArr[cursorArr];
               contentBox.contentBox_text.descText.autoSize = true;
               myListenerload.onResize ();
               //
               ZigoEngine.doTween (imageContainer,'_alpha',0,1,"easeOutExpo",0,function () {
                  loadBitmapSmoothed (imagesArrByCat[cursorArr],imageContainer);
               });
            };
         }
      }
      loadBitmapSmoothed (imagesArrByCat[cursorArr],imageContainer);
   };
   imagesByCat.load (newCategoryXML);
}
//
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//
function displayPositions () {
   bottomBar.rightSide.stroke1._x = Math.floor (bottomBar.rightSide.imageTxt._x + bottomBar.rightSide.imageTxt._width + 5);
   bottomBar.rightSide.labelTotal._x = Math.floor (bottomBar.rightSide.stroke1._x + 5);
   bottomBar.rightSide.totalTxt._x = Math.floor (bottomBar.rightSide.labelTotal._x + bottomBar.rightSide.labelTotal._width);
   bottomBar.rightSide.stroke2._x = Math.floor (bottomBar.rightSide.totalTxt._x + bottomBar.rightSide.totalTxt._width + 5);
}
//
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//
function loadCategoriesSmoothed (url:String, target:MovieClip) {
   //
   var bmc:MovieClip = target.createEmptyMovieClip ("bmc", target.getNextHighestDepth ());
   var listener:Object = new Object ();
   //
   listener.tmc = target;
   //
   listener.onLoadStart = function () {
      //trace("onLoadStart")
   };
   //
   listener.onLoadProgress = function (mc:MovieClip, bytesLoaded:Number, bytesTotal:Number) {
      //percent = Math.round (bytesLoaded / bytesTotal * 100);
   };
   //
   listener.onLoadInit = function (mc:MovieClip) {
      //
      var bitmap:BitmapData = new BitmapData (mc._width, mc._height, true, 0);
      this.tmc.attachBitmap (bitmap,1,"auto",true);
      bitmap.draw (mc);
      //
      setPositions ();
   };
   //
   var loader:MovieClipLoader = new MovieClipLoader ();
   loader.addListener (listener);
   loader.loadClip (url,bmc);
}
//
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//
function loadBitmapSmoothed (url:String, target:MovieClip) {
   //
   var bmc:MovieClip = target.createEmptyMovieClip ("bmc", target.getNextHighestDepth ());
   var listener:Object = new Object ();
   //
   listener.tmc = target;
   //
   listener.onLoadStart = function () {
      attachMovie ("loadPictureMC","loadPictureMC",1);
      loadPictureMC._x = Math.floor (Stage.width / 2 - loadPictureMC._width / 2);
      if (isModule == true) {
         if (_root.subMenuOpened == true) {
            loadPictureMC._y = Math.floor ((Stage.height - 120) / 2 - loadPictureMC._height / 2);
         }
         else {
            loadPictureMC._y = Math.floor ((Stage.height - 95) / 2 - loadPictureMC._height / 2);
         }
      }
      else {
         loadPictureMC._y = Math.floor (Stage.height / 2 - loadPictureMC._height / 2);
      }
   };
   //
   listener.onLoadProgress = function (mc:MovieClip, bytesLoaded:Number, bytesTotal:Number) {
      percent = Math.round (bytesLoaded / bytesTotal * 100);
      loadPictureMC.percentTxt.text = percent + "%";
   };
   //
   listener.onLoadInit = function (mc:MovieClip) {
      removeMovieClip (loadPictureMC);
      imageContainer._alpha = 0;
      var bitmap:BitmapData = new BitmapData (mc._width, mc._height, true, 0);
      this.tmc.attachBitmap (bitmap,1,"auto",true);
      bitmap.draw (mc);
      ZigoEngine.doTween (imageContainer,'_alpha',100,5,"easeOutExpo");
      imageContainer.onRelease = function(){
         abortSlideShow ();
         contentBox._visible = true;
         ZigoEngine.doTween(contentBox,'_alpha',100,1,"easeOutExpo")
      }
      setPositions ();
   };
   //
   var loader:MovieClipLoader = new MovieClipLoader ();
   loader.addListener (listener);
   loader.loadClip (url,bmc);
}
//
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//
function loadThumbnails (externalTarget:String, targetRoot:MovieClip) {
   var mcLoader:MovieClipLoader = new MovieClipLoader ();
   var listenerLoad:Object = new Object ();

   listenerLoad.tmc = targetRoot;

   listenerLoad.onLoadInit = function (mc:MovieClip) {
      var bitmap:BitmapData = new BitmapData (mc._width, mc._height, true, 0);
      this.tmc.attachBitmap (bitmap,1,"auto",true);
      bitmap.draw (mc);
   };
   mcLoader.addListener (listenerLoad);
   mcLoader.loadClip (externalTarget,targetRoot);
}
//
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//
function setPositions () {
   if (isModule == true) {
      if (_root.subMenuOpened == true) {
         if (imageContainer._height > imageContainer._width) {
            if (imageContainer._width >= Stage.width - 20) {
               imageContainer._width = Stage.width - 20;
               imageContainer._yscale = imageContainer._xscale;
            }
            else {
               imageContainer._height = (Stage.height - 120) - 20 - bottomBar._height;
               imageContainer._xscale = imageContainer._yscale;
            }
         }
         // - - - - - IF PICTURE HORIZONAL - - - - - 
         if (imageContainer._height < imageContainer._width) {
            if (imageContainer._width >= Stage.width - 20) {
               imageContainer._width = Stage.width - 20;
               imageContainer._yscale = imageContainer._xscale;
            }
            else {
               imageContainer._height = (Stage.height - 120) - 20 - bottomBar._height;
               imageContainer._xscale = imageContainer._yscale;
            }
         }
         // - - - - - IF PICTURE SQUARE - - - - - 
         if (imageContainer._height == imageContainer._width) {
            if (imageContainer._width >= Stage.width - 20) {
               imageContainer._width = Stage.width - 20;
               imageContainer._yscale = imageContainer._xscale;
            }
            else {
               imageContainer._height = (Stage.height - 120) - 20 - bottomBar._height;
               imageContainer._xscale = imageContainer._yscale;
            }
         }
         //------------------------------------------------------------------------------------------- 
         imageContainer._x = Stage.width / 2 - imageContainer._width / 2;
         imageContainer._y = (Stage.height - 120) / 2 - imageContainer._height / 2 - bottomBar._height / 2;
      }
      else {
         // - - - - - IF PICTURE VERTICAL - - - - -
         if (imageContainer._height > imageContainer._width) {
            if (imageContainer._width >= Stage.width - 20) {
               imageContainer._width = Stage.width - 20;
               imageContainer._yscale = imageContainer._xscale;
            }
            else {
               imageContainer._height = (Stage.height - 95) - 20 - bottomBar._height;
               imageContainer._xscale = imageContainer._yscale;
            }
         }
         // - - - - - IF PICTURE HORIZONAL - - - - - 
         if (imageContainer._height < imageContainer._width) {
            if (imageContainer._width >= Stage.width - 20) {
               if(imageContainer._height >= Stage.height - 95){
                  imageContainer._height = (Stage.height - 95) - 20 - bottomBar._height;
                  imageContainer._xscale = imageContainer._yscale;
               }else{
                  imageContainer._width = Stage.width - 20;
                  imageContainer._yscale = imageContainer._xscale;
               }
            }
            else {
               imageContainer._height = (Stage.height - 95) - 20 - bottomBar._height;
               imageContainer._xscale = imageContainer._yscale;
            }
         }
         // - - - - - IF PICTURE SQUARE - - - - - 
         if (imageContainer._height == imageContainer._width) {
            if (imageContainer._width >= Stage.width - 20) {
               imageContainer._width = Stage.width - 20;
               imageContainer._yscale = imageContainer._xscale;
            }
            else {
               imageContainer._height = (Stage.height - 95) - 20 - bottomBar._height;
               imageContainer._xscale = imageContainer._yscale;
            }
         }
         //------------------------------------------------------------------------------------------- 
         imageContainer._x = Stage.width / 2 - imageContainer._width / 2;
         imageContainer._y = (Stage.height - 95) / 2 - imageContainer._height / 2 - bottomBar._height / 2;
      }
   }
   else {
      // - - - - - IF PICTURE VERTICAL - - - - -
      if (imageContainer._height > imageContainer._width) {
         if (imageContainer._width >= Stage.width - 20) {
            imageContainer._width = Stage.width - 20;
            imageContainer._yscale = imageContainer._xscale;
         }
         else {
            imageContainer._height = Stage.height - 20 - bottomBar._height;
            imageContainer._xscale = imageContainer._yscale;
         }
      }
      // - - - - - IF PICTURE HORIZONAL - - - - - 
      if (imageContainer._height < imageContainer._width) {
         if (imageContainer._width >= Stage.width - 20) {
            imageContainer._width = Stage.width - 20;
            imageContainer._yscale = imageContainer._xscale;
         }
         else {
            imageContainer._height = Stage.height - 20 - bottomBar._height;
            imageContainer._xscale = imageContainer._yscale;
         }
      }
      // - - - - - IF PICTURE SQUARE - - - - - 
      if (imageContainer._height == imageContainer._width) {
         if (imageContainer._width >= Stage.width - 20) {
            imageContainer._width = Stage.width - 20;
            imageContainer._yscale = imageContainer._xscale;
         }
         else {
            imageContainer._height = Stage.height - 20 - bottomBar._height;
            imageContainer._xscale = imageContainer._yscale;
         }
      }
      //------------------------------------------------------------------------------------------- 
      imageContainer._x = Stage.width / 2 - imageContainer._width / 2;
      imageContainer._y = Stage.height / 2 - imageContainer._height / 2 - bottomBar._height / 2;
   }
}
//
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//
function setSlideShow () {
   statusSlideShow = true;
   timeBar._visible = true;
   timeBar._x = 0;
   timeBar._y = 0;
   executeLoadingImgGallery ();
   bottomBar.btPlay._visible = false;
   bottomBar.btStop._visible = true;
}
//
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//
function executeLoadingImgGallery () {
   if (statusSlideShow == true) {
      if (cursorArr == totalImages - 1) {
         cursorArr = 0;
         timeBar._xscale = 0;
         ZigoEngine.doTween (imageContainer,'_alpha',0,1,"easeOutExpo",0,function () {
            if (commingFromNewCat == true) {
               loadBitmapSmoothedSlideShow (imagesArrByCat[cursorArr],imageContainer);
            }
            else {
               loadBitmapSmoothedSlideShow (imagesArr[cursorArr],imageContainer);
            }
         });
      }
      else {
         cursorArr++;
         timeBar._xscale = 0;
         ZigoEngine.doTween (imageContainer,'_alpha',0,1,"easeOutExpo",0,function () {
            if (commingFromNewCat == true) {
               loadBitmapSmoothedSlideShow (imagesArrByCat[cursorArr],imageContainer);
            }
            else {
               loadBitmapSmoothedSlideShow (imagesArr[cursorArr],imageContainer);
            }
         });
      }
      bottomBar.rightSide.imageTxt.txt.autoSize = true;
      bottomBar.rightSide.imageTxt.txt.text = cursorArr + 1;
      displayPositions ();
   }
}
//
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//
function loadBitmapSmoothedSlideShow (url:String, target:MovieClip) {
   var bmc:MovieClip = target.createEmptyMovieClip ("bmc", target.getNextHighestDepth ());
   var listener:Object = new Object ();
   listener.tmc = target;
   //
   listener.onLoadStart = function () {
      attachMovie ("loadPictureMC_slideShow","loadPictureMC_slideShow",1);
      loadPictureMC_slideShow._x = Math.floor (Stage.width / 2 - loadPictureMC_slideShow._width / 2);
      if (isModule == true) {
         if (_root.subMenuOpened == true) {
            loadPictureMC_slideShow._y = Math.floor ((Stage.height - 120) / 2 - loadPictureMC_slideShow._height / 2);
         }
         else {
            loadPictureMC_slideShow._y = Math.floor ((Stage.height - 95) / 2 - loadPictureMC_slideShow._height / 2);
         }
      }
      else {
         loadPictureMC_slideShow._y = Math.floor (Stage.height / 2 - loadPictureMC_slideShow._height / 2);
      }
   };
   //
   listener.onLoadProgress = function (mc:MovieClip, bytesLoaded:Number, bytesTotal:Number) {
      percent = Math.round (bytesLoaded / bytesTotal * 100);
      loadPictureMC_slideShow.percentTxt.text = percent + "%";
   };
   //
   listener.onLoadInit = function (mc:MovieClip) {
      removeMovieClip (loadPictureMC_slideShow);
      //
      imageContainer._alpha = 0;
      //
      var bitmap:BitmapData = new BitmapData (mc._width, mc._height, true, 0);
      this.tmc.attachBitmap (bitmap,1,"auto",true);
      bitmap.draw (mc);
      //
      ZigoEngine.doTween (imageContainer,'_alpha',100,5,"easeOutExpo");
      //
      countTimeBar ();
      setPositions ();
   };
   //
   var loader:MovieClipLoader = new MovieClipLoader ();
   loader.addListener (listener);
   loader.loadClip (url,bmc);
}
//
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//
function abortSlideShow () {
   statusSlideShow = false;
   timeBar._visible = false;
   timeBar._xscale = 0;
   bottomBar.btPlay._visible = true;
   bottomBar.btStop._visible = false;
}
//
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//
function countTimeBar () {
   if (statusSlideShow == true) {
      ZigoEngine.doTween (timeBar,'_xscale',Stage.width + 100,5,"easeInExpo",0,executeLoadingImgGallery);
   }
}
//
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//
function updateMovies () {
   if (categoriesAdd._width > Stage.width) {
      d = 5;
      mov = _root._xmouse;
      coef = (Stage.width - (categoriesAdd._width + 100)) / Stage.width;
      categoriesAdd._x -= (((categoriesAdd._x - 50)) - coef * mov) / d;
   }
   else {
      categoriesAdd._x = Stage.width / 2 - categoriesAdd._width / 2;
   }
}
//
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//
function initFloat (mc:MovieClip) {
   temp = mc;
   temp.onEnterFrame = this.updateMovies;
}

Por unasemana

Claber

166 de clabLevel



 

Venezuela

firefox
Citar            
MensajeEscrito el 04 Feb 2010 07:19 pm
Bueno... la verdad es que ya estoy un poco "oxidado" en cuanto a AS2, en realidad después de haberme encontrado con AS3 he migrado completamente. Te recomiendo que lo uses ya que es un lenguaje mucho más orientado a objetos y tiene un manejo de eventos muy potente, que es lo que pudoeras utiliar en lo que haces.

Bueno... voliviendo a AS2, te puedo aconsejar que la acción que haces una vez que le daz click al botón Categorías, la pongas despues de cargar el xml que tiene las imágenes a mostrar.

De hecho, a esta función podrías pasarle un arreglo con las imagenes que vas a mostrar y resultaría "creo" un poco más comodo.

Saludos...
P.

Por pmolina88

74 de clabLevel



Genero:Masculino  

Ingeniero en Sistemas

firefox
Citar            
MensajeEscrito el 04 Feb 2010 07:47 pm
hola por los momentos resolvi con

onClipEvent(load){
_parent._parent.loadCategories ();
trace("aca va la instruccion que quieres que se ejecute");
}

al boton openCategories

espero les sirva la info para algo.

saludos


que tutorial de AS3 me recomiendan. Quiero migrar a as3

Por unasemana

Claber

166 de clabLevel



 

Venezuela

safari
Citar            
MensajeEscrito el 04 Feb 2010 09:37 pm
Bueno, te puedo recomendar los video tutoriales que se encuentran en el sitio [/url], puedes también auxiliarte de los tutoriales y ejemplos que se encuentran aquí en el sitio.

Puedes descargarte este libro que habla también de la programación orientada a objetos en AS3 (Desgraciadamente está en inglés :? , pero cuando hay ganas de aprender nada es imposible, jejeje)
[url=http://www.ebookpdf.net/ebook-pdf_object-oriented-actionscript-30_203.html]


Bueno, por el momento esto es lo que he podido encontrar, por los libros que yo aprendí los tengo almacenados en mi PC y para ser sincero, no recuerdo de donde los saqué. De todas formas, seguré buscando.

Saludos...
P.

Por pmolina88

74 de clabLevel



Genero:Masculino  

Ingeniero en Sistemas

firefox
Citar            
MensajeEscrito el 04 Feb 2010 09:58 pm
Revisa en el forro de Flex, AS3 y AIR que en el primer tema que aparece hay varias entradas de compañeros que han publicado links de descarga para libros de AS3

Por pmolina88

74 de clabLevel



Genero:Masculino  

Ingeniero en Sistemas

firefox
Citar            
MensajeEscrito el 07 Feb 2010 05:52 pm
gracias por el dato!

Por unasemana

Claber

166 de clabLevel



 

Venezuela

safari

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.