Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Feb 2009
    Location
    Mumbai, India
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    slideshow transition problem

    I have a slideshow in CS3 (using AS2). Its working fine. I want to add a mx transition to it like a wipe or a tween.
    Currently there is a alpha given to the next and previous image, but I feel the transition is not smooth enough. I would like to apply the MX Transition effect to this code.
    The other feature of this slideshow is that the first image loaded is a random image. Please HELP to add the MX Transition code.

    Flash Code:

    Code:
    function loadXML(loaded)
    {
        if (loaded)
        {
            xmlNode = this.firstChild;
            image = [];
            caption = [];
            total = xmlNode.childNodes.length;
            for (i = 0; i < total; i++)
            {
                image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
                caption[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
           
    		} // end of for
    		firstImage1();
        }
        else
        {
            content = "file not loaded!";
        } // end else if
    } // End of the function
    
    function nextImage()
    {
    	previous_btn._alpha = 100;
    	nextImg = startImgNo + 1;
    	if(nextImg < total)
    	{
    		picture._alpha = 0;
    		picture.loadMovie("photos/" + image[nextImg], 1);
    		caption_txt.text = caption[nextImg];
    		if(nextImg == (total-1))
    			next_btn._alpha = 50;   
    		startImgNo = nextImg;
    	}
    } // End of the function
    
    function prevImage()
    {
    	next_btn._alpha = 100;
    	prevImg = startImgNo - 1;
    		
    	if(prevImg >= 0)
    	{
    		picture._alpha = 0;
    		picture.loadMovie("photos/" + image[prevImg], 1);
    		caption_txt.text = caption[prevImg];
    		if(prevImg == 0)
    			previous_btn._alpha = 50;
    		startImgNo = prevImg;
    	}
    	
    	
    	
    } // End of the function
    
    function firstImage1()
    {
        if (loaded == filesize)
        {
    		var rand_no = Math.round(Math.random()*(total-1));
    		
    		if(rand_no >= 0 && rand_no < total)
    		{
    			picture.loadMovie("photos/" + image[rand_no], 1);
    	        caption_txt.text = caption[rand_no];
    			if(rand_no == (total-1))
    				next_btn._alpha = 50; 
    			if(rand_no == 0)
    				previous_btn._alpha = 50;	
    		}
    		startImgNo = rand_no;
        } // end if
    } // End of the function
    
    xmlData = new XML();
    xmlData.ignoreWhite = true;
    xmlData.onLoad = loadXML;
    xmlData.load("photos.xml");
    var startImgNo;
    var total = xmlNode.childNodes.length;
    listen = new Object();
    listen.onKeyDown = function ()
    {
        if (Key.getCode() == 37)
        {
            prevImage();
        }
        else if (Key.getCode() == 39)
        {
            nextImage();
        } // end else if
    };
    Key.addListener(listen);
    previous_btn.onRelease = function ()
    {
        prevImage();
    };
    next_btn.onRelease = function ()
    {
        nextImage();
    };
    p = 0;
    this.onEnterFrame = function ()
    {
        filesize = picture.getBytesTotal();
        loaded = picture.getBytesLoaded();
        preloader._visible = true;
        if (loaded != filesize)
        {
            preloader.preload_bar._xscale = 100 * loaded / filesize;
        }
        else
        {
            preloader._visible = false;
            if (picture._alpha < 100)
            {
                picture._alpha = picture._alpha + 10;
            } // end if
        } // end else if
    };
    XML Code:
    Code:
    <?xml version="1.0" encoding="utf-8" standalone="yes"?>
    <images>
        <pic>
            <image>ice1.jpg</image>
            <caption>Cheery Pie ala Mode</caption>
        </pic>
        <pic>
            <image>ice2.jpg</image>
            <caption>Ice Cream Dessert</caption>
        </pic>
        <pic>
            <image>ice3.jpg</image>
            <caption>Ice Cream Tower</caption>
        </pic>
        <pic>
            <image>ice4.jpg</image>
            <caption>Ice Cream and Raspberries</caption>
        </pic>
        <pic>
            <image>ice5.jpg</image>
            <caption>Iced Dessert </caption>
        </pic>
    I have also attached a zip file which has all the files.
    Attached Files Attached Files

  • #2
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    http://codingforums.com/showthread.php?t=129968

    Similar thread with details on how to merge.
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •