+ Reply to Thread
Page 1 of 2
1 2 LastLast
Results 1 to 10 of 14

Thread: Buttons to switch between clips

  1. #1

    Buttons to switch between clips

    Hello,

    I am not an experienced Flash user. I need to include a swf file on my client's web page. The swf file includes 4 movie clips appearing one by one. Each clip links to their designated page. I want to have small buttons to let viewers to click and switch to the clip they want. When click, the still shot (may be the last frame) of the clip appears. Please refer to http://www.dell.com for an example. Can anyone advise step by step on how to do that?

    Thanks in advance!

    ken.


  2. #2
    This is too complicated for me to try and explain, so I just did a mock up for you. I tried to keep it as simple as possible since you said you don't have much experience with Flash.

    View the SWF here (the animated color boxes are clickable)
    Download the FLA here

    Here's the code I used:

    Code:
    var myUrlArray:Array = Array("http://www.google.com/", "http://www.msn.com/", "http://www.yahoo.com/", "http://www.digg.com/");
    var myCounter:Number = 0; //since arrays start at element[0], for simplicity sake, start the counter at 0 as well
    
    // click button and show webpage
    
    _root.main.onRelease = function() {
         getURL(myUrlArray[myCounter]);
    };
    
    // button controls
    
    _root.myControls.btnPrev.onRelease = function() {
    	// prevents the counter from being less than 0
    	if (myCounter <= 0) {
    		myCounter = 0;
    	} else {
    		myCounter--; //subtract 1 from itself
    	};
    	_root.main.prevFrame(); //backup the timeline 1 frame
    };
    _root.myControls.btnNext.onRelease = function() {
    	// prevents the counter from being more than 3
    	if (myCounter >= 3) {
    		myCounter = 3;
    	} else {
    		myCounter++; //add 1 to itself
    	};
    	_root.main.nextFrame(); //advance the timeline 1 frame
    };
    Hope this is helpful. If you need a more detailed explanation of things, just let me know.

  3. #3
    Thanks so much SineQuaNon! But the FLA file could not be download...

  4. #4
    Hey I managed to download the FLA file now. I will explore it to modify. Thanks again SineQuaNon!

  5. #5

  6. #6
    I actually need to have 4 separate buttons. Each button click and link to their movie clip. Could you advise how to change the 2 arrows to 4 buttons. If you could prepare another example FLA file, that would be great!

  7. #7
    Sure, easy enough. Same basic principle, but instead of telling _root.main to move forward or back 1 frame using nextFrame() and prevFrame(), you tell it to go to a specific frame using gotoAndStop();

    View the new SWF here
    Download the new FLA here

    Here's the new code. I could have done some semi-fancy stuff with arrays to cut down on the repetitive code ("if you're copying and pasting, you're doing it wrong"), but I wanted to keep it simple for your sake.

    Code:
    var myUrlArray:Array = Array("http://www.google.com/", "http://www.msn.com/", "http://www.yahoo.com/", "http://www.digg.com/");
    var myCounter:Number = 0; //since arrays start at element[0], for simplicity sake, start the counter at 0 as well
    
    // click button and show webpage
    
    _root.main.onRelease = function() {
         getURL(myUrlArray[myCounter]);
    };
    
    // button controls
    
    _root.myControls.myButton1.onRelease = function() {
    	myCounter = 0; //remember arrays start at element[0]
    	_root.main.gotoAndStop(1);
    };
    _root.myControls.myButton2.onRelease = function() {
    	myCounter = 1;
    	_root.main.gotoAndStop(2);
    };
    _root.myControls.myButton3.onRelease = function() {
    	myCounter = 2;
    	_root.main.gotoAndStop(3);
    };
    _root.myControls.myButton4.onRelease = function() {
    	myCounter = 3;
    	_root.main.gotoAndStop(4);
    };

  8. #8
    Great! Thanks a lot SineQuaNon!

  9. #9
    Is there any way to make the 4 clips appear one by one instead of just showing the first clip? I don't need to loop them. They can just appear once. Thanks again for your help! :sweatdrop:

  10. #10
    To not show the first clip when it loads, insert a blank keyframe on frame 1 of "_root.main" (shifting everything over 1 frame) and then modify the gotoAndStop(); commands.
    To stop them from looping, add a "stop();" command at the end of the animation.
    Last edited by SineQuaNon; 29-06-2009 at 08:31 AM.

+ Reply to Thread
Page 1 of 2
1 2 LastLast

Similar Threads

  1. clips, loops, videos on showfootage.com
    By Wadim in forum Advertising Forum
    Replies: 1
    Last Post: 19-06-2009, 12:43 PM
  2. Clips from T3
    By PolarBear in forum Off Topic
    Replies: 10
    Last Post: 03-04-2008, 03:49 PM
  3. Server switch complete
    By Graphic Design Blog in forum Graphic Design Blog
    Replies: 0
    Last Post: 05-02-2008, 08:11 PM
  4. Animated Interactive showing clips
    By PolarBear in forum General Web Design Forum
    Replies: 1
    Last Post: 04-12-2007, 06:43 AM
  5. KVM Switch
    By Joe.Morgan in forum Off Topic
    Replies: 4
    Last Post: 11-04-2007, 09:01 PM

Bookmarks

Posting Permissions

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


The Graphics Forum Web Design Stuff Free Decent Downloads Free Quality Wallpapers Graphics Forum Free Vista Themes
The Top The Best Images Tech Talk 247 Logo Design - $149 Affordable Stock Vector Illustrations Creativecurio - Design Blog Graphic Design Advertising

Check the forum often for the latest design announcements. Everything from graphic design and web design, to films and music. Estetica is a great place for people to get together and help each other out.



Web Hosting - UK Web Hosting services for business or personal website hosting needs.

Dedicated Servers - A full range of Managed Dedicated Server solutions suitable for all your requirements.

Graphic Design Blog | Web Design Forum | Graphic Design and Print Forum | Graphic Design Links | Advertise On This Site

Web Design UK | Vision.To Design | Leaflet Printing | Estetica Design Forum's Privacy Policy

Flyer Printing | Photography Blog | Design Forum Links | Logo Design | Graphic Design Social Network | Logo Design

Graphic Design Tutorials | Logo Designer | UK Logo Design Studio | Land for sale | Vector Art Blog

Free Web Hosting | Custom Logo Design - $149 Only | Affordable Print Design Templates | Small Business Logo Design | Company Logo Design

Logo Design Service | Logo Design Firm | Logo Design Reseller | Custom Logo Design | Letterhead Printing | Flyer Printing | Business Card Printing

Printing | Leaflet Printing | Online Backup | T-Shirt Printing | Personalised Mugs | Canvas Printing

Search Engine Optimization by vBSEO 3.5.0 RC1 PL1