Skip to main content
Known Participant
July 1, 2013
Question

how we can add 2 gallery for 2 function...

  • July 1, 2013
  • 1 reply
  • 322 views

i want to call function "callThums" from 1st gallery and function "callFullImages" from 2nd gallery........

but here both function working from only 1 gallery.

my gallery is...............

import mx.transitions.Tween;

import mx.transitions.Zoom.*;

import caurina.transitions.*;

var j=0;

var k=6;

var l=6;

var m=12;

var myGalleryXML = new XML();

myGalleryXML.ignoreWhite = true;

myGalleryXML.load("1-july.xml");     // gallery loading from here

myGalleryXML.onLoad = function()

{

_root.gallery_y = myGalleryXML.firstChild.attributes.gallery_y;

    _root.gallery_width = myGalleryXML.firstChild.attributes.gallery_width;

    _root.gallery_height = myGalleryXML.firstChild.attributes.gallery_height;

    _root.myImages = myGalleryXML.firstChild.childNodes;

    _root.myImagesTotal = myImages.length;

    _root.thumb_height = myGalleryXML.firstChild.attributes.thumb_height;

    _root.thumb_width = myGalleryXML.firstChild.attributes.thumb_width;

    _root.full_x = myGalleryXML.firstChild.attributes.full_x;

    _root.full_y = myGalleryXML.firstChild.attributes.full_y;

    callThumbs();

     

};

function callThumbs()

{

    _root.createEmptyMovieClip("wall",_root.getNextHighestDepth());

    wall._x = _root.gallery_x = 0;

    wall._y = _root.gallery_y = 230;

    wall.addEventListener(MouseEvent.CLICK);

    var clipLoader = new MovieClipLoader();

    var preloader = new Object();

    clipLoader.addListener(preloader);

   

        for (i =j; i<k; i++)

   

    {

        thumbURL = myImages.attributes.thumb_url;

        myThumb_mc = wall.createEmptyMovieClip(i, wall.getNextHighestDepth());

        myThumb_mc._x = _root.thumb_height * i;

        myThumb_mc._x = _root.thumb_position = -3150 + (i-j) * 765;

       

    clipLoader.loadClip("shop/" + thumbURL,myThumb_mc);

preloader.onLoadStart = function(target)

        {

            target.createTextField("my_txt",target.getNextHighestDepth(),0,0,10,10);

            target.my_txt.selectable = false;

        };

        preloader.onLoadProgress = function(target, loadedBytes, totalBytes)

        {

            target.my_txt.text = Math.floor((loadedBytes / totalBytes) * 100);

        };

        preloader.onLoadComplete = function(target)

        {

            new Tween(target, "_alpha", Strong.easeOut, 0, 100, .5, true);

            target.my_txt.removeTextField();

            target.onRelease = function()

            {

                callFullImage(this._name);

            };

            target.onRollOver = function()

            {

                this._alpha = 100;

            };

            target.onRollOut = function()

            {

                this._alpha = 100;

            };

        };

   

   

    }

   

function callFullImage(myNumber)

{

    myURL =   myImages[myNumber].attributes.full_url;

    myTitle = myImages[myNumber].attributes.title;

    myDesc =  myImages[myNumber].attributes.desc;

    _root.createEmptyMovieClip("ajit",_root.getNextHighestDepth());

    ajit._x = _root.full_x = 130;

    ajit._y = _root.full_y = 32;

   

    _root.onEnterFrame = function()

    {

        wall._alpha = 0;

        if (_root._currentframe == 2)

        {

            wall._alpha = 100;

        }

    };

    this.gotoAndStop(21);

    var fullClipLoader = new MovieClipLoader("ajit");

    var fullPreloader = new Object();

    fullClipLoader.addListener(fullPreloader);

    fullPreloader.onLoadStart = function(target)

    {

        target.createTextField("my_txt",ajit.getNextHighestDepth(),20,0,700,20);

        my_txt.selectable = true;

       

       

    };

    fullPreloader.onLoadProgress = function(target, loadedBytes, totalBytes)

    {

        target.my_txt.text = Math.floor((loadedBytes / totalBytes) * 00);

    };

    fullPreloader.onLoadComplete = function(target)

    {

        new Tween(target, "_alpha", Strong.easeOut, 60, 100, .5, true);

        target.my_txt.text = myTitle;

        target.my_txt._y=480;

        target.my_txt.textColor = 0xffffff;

        target.my_txt.html = true;

        target.my_txt.text = myDesc;

        target.my_txt._y=280;

       

    };

   

    fullClipLoader.loadClip("full_images/" + myURL,ajit);

}

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
July 1, 2013

you're only loading one gallery and callFullImage should be called when a thumbnail is clicked.