A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [RESOLVED] Image gallery contained in a movieclip symbol.

  1. #1
    Junior Member
    Join Date
    Oct 2012
    Posts
    7

    resolved [RESOLVED] Image gallery contained in a movieclip symbol.

    I'm making a simple interactive ad. I set up an image gallery within a movieclip, so that when the movieclip is clicked, it should go to the 2nd frame of the clip where the image gallery starts. Right now, it does nothing. Code:

    Code:
    package {
    	import flash.display.*;
    	import flash.events.*;
    	import flash.media.Sound;
    	import flash.media.SoundMixer;
    	import flash.net.URLRequest;
    	
    	public class Deftones extends MovieClip{
    	
    	function Deftones() {
    	
    	swerve1.addEventListener(MouseEvent.MOUSE_DOWN, dragStartS);
        swerve1.addEventListener(MouseEvent.MOUSE_UP, dragEndS);
    	polt1.addEventListener(MouseEvent.MOUSE_DOWN, dragStartS);
        polt1.addEventListener(MouseEvent.MOUSE_UP, dragEndS);
    	rd1.addEventListener(MouseEvent.MOUSE_DOWN, dragStartS);
        rd1.addEventListener(MouseEvent.MOUSE_UP, dragEndS);
    	gauze1.addEventListener(MouseEvent.MOUSE_DOWN, dragStartS);
        gauze1.addEventListener(MouseEvent.MOUSE_UP, dragEndS);
    	stop1.addEventListener(MouseEvent.CLICK, stopMusic);
    	var sound1:Sound= new Sound();
    	var sound2:Sound= new Sound();
    	var sound3:Sound= new Sound();
    	var sound4:Sound= new Sound();
    	sound1.load(new URLRequest("music/Swerve_City.mp3"));
    	sound2.load(new URLRequest("music/Poltergeist.mp3"));
    	sound3.load(new URLRequest("music/Romantic_Dreams.mp3"));
    	sound4.load(new URLRequest("music/Gauze.mp3"));
    
        function dragStartS(e:MouseEvent){
        	e.currentTarget.startDrag();
        }
        function dragEndS(e:MouseEvent){
        	e.currentTarget.stopDrag();
    		if (swerve1.hitTestObject(speaker1)){
    				SoundMixer.stopAll();
    				sound1.play(0);
    				title.text="  Swerve City";
    				swerve1.x= 218.30;
    				swerve1.y= 135.10;
    		}
    		else if (polt1.hitTestObject(speaker1)){
    				SoundMixer.stopAll();
    				sound2.play(0);
    				title.text="  Poltergeist";
    				polt1.x= 217.55;
    				polt1.y= 165.35;
    		}
    		else if (rd1.hitTestObject(speaker1)){
    				SoundMixer.stopAll();
    				sound3.play(0);
    				title.text="Romantic Dreams";
    				rd1.x= 217.55;
    				rd1.y= 195.60;
    		}
    		else if (gauze1.hitTestObject(speaker1)){
    				SoundMixer.stopAll();
    				sound4.play(0);
    				title.text="      Gauze";
    				gauze1.x= 217.55;
    				gauze1.y= 225.85;
    		}
    	}
    	function stopMusic(e:MouseEvent){
    			SoundMixer.stopAll();
    		}
    	}
    	function photoGallery(){
    		photos1.addEventListener(MouseEvent.MOUSE_DOWN, startGallery);
    		photos1.next1.addEventListener(MouseEvent.CLICK, nextPhoto);
    		photos1.prev1.addEventListener(MouseEvent.CLICK, prevPhoto);
    		
    		function startGallery(event:MouseEvent){
    			photos1.gotoAndStop(2);
    		}
    		function nextPhoto(event:MouseEvent){
    			photos1.nextFrame();
    		}
    		function prevPhoto(event:MouseEvent){
    			photos1.prevFrame();
    		}
    	}
    		
    }
    }
    Screenshot:
    screen.jpg

    Any help or suggestions would be greatly appreciated.

  2. #2
    :
    Join Date
    Dec 2002
    Posts
    3,518
    You are not calling the photoGallery function...
    Code:
    photoGallery();
    function photoGallery(){
            photos1.addEventListener(MouseEvent.MOUSE_DOWN, startGallery);
            photos1.next1.addEventListener(MouseEvent.CLICK, nextPhoto);
            photos1.prev1.addEventListener(MouseEvent.CLICK, prevPhoto);
    
            function startGallery(event:MouseEvent){
                    photos1.gotoAndStop(2);
            }
            function nextPhoto(event:MouseEvent){
                    photos1.nextFrame();
            }
            function prevPhoto(event:MouseEvent){
                    photos1.prevFrame();
            }
    }

  3. #3
    Junior Member
    Join Date
    Oct 2012
    Posts
    7
    I got it resolved. It came down to combining everything into one movieclip, with nested movieclips, and a lot of renaming. Thanks though.

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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center