Skip navigation
_ELBEE_
Currently Being Moderated

Bugs with my site

Feb 9, 2010 10:40 AM

Hi,

I've worked hard to make a logo and website for my college's cultural festival. The site's not really complete yet, I've created a skeleton kind of thing, but it has bugs. I'm uploading the source itself. Could you please check and tell me what's wrong ?

I'm attaching the published files here so that you can view the glitch if you want to do so before checking the code, and the source file on another site.

 

PS :

1 The problem is, when you keep clicking on links and close the pages that slide in, in a few secs the flash file crashes for some reason I have no clue about.

 

2 Also, I'm not used to posting such stuff in forums, so please excuse me if I've been in some way against some forum convention and I'll correct my mistake.

 

Thank you very much for looking,

Elbee.

Attachments:
 
Replies
  • Currently Being Moderated
    Feb 12, 2010 9:02 PM   in reply to _ELBEE_

    Hello,

     

     

    This may be a little late as you mentioned it was due "in a couple of days".  Anyways, after inspecting your Flash file I saw that you used a lot of event listeners and repeated code.  This is what was causing your movie to crash.

     

     

    After tinkering a little with your code and objects, I came up with what I think you were after. This is what I did:

     

     

        * I removed the close button from all the page movieclips as it was better to attach it during runtime using Actionscript.

     

        * Got rid of all the addEventListeners/removeEventListeners and used just one set within a function(buttonListeners).

     

     

    So now, the button links show the rollover/rollout animations. The pages slide in correctly, and the close button removes the page when it's clicked.

     

     

    This is the actionscript code.  It sits on frame one of the timeline but it should really be in it's own class.

     

     

    /* Import statements for Tween Class


    ----------------------------------------------------------*/
    import fl.transitions.Tween;
    import fl.transitions.easing.*;
    import fl.transitions.TweenEvent;

     

     

    /* All main functions
    ----------------------------------------------------------*/

     


    // Takes care of the event listeners for all button links
    function buttonListeners(clip:MovieClip)
    {
        clip.addEventListener(MouseEvent.ROLL_OVER, slideIn);
        clip.addEventListener(MouseEvent.ROLL_OUT, slideOut);
        clip.addEventListener(MouseEvent.CLICK, itemClicked);
        clip.buttonMode = true;
    }

     


    // Plays the rollover animation
    function slideIn(e:MouseEvent):void
    {
        e.currentTarget.gotoAndPlay(20);
    }

     


    // Plays the rollout animation
    function slideOut(e:MouseEvent):void
    {
        // Notice here it's a gotoAndStop() command
        e.currentTarget.gotoAndStop(1);
    }

     


    // When a link is clicked, this function matches the current
    // button to the correct page movieclip and fowards it to the
    // showPage function
    function itemClicked(e:MouseEvent):void
    {
        var clip:MovieClip;
      
        switch(e.currentTarget.name)
        {
            case "blueLink":
                clip = new pageHome();
            break;
          
            case "greenLink":
                clip = new pageEvents();
            break;
          
            case "yellowLink":
                clip = new pageContact();
            break;
          
            case "purpleLink":
                clip = new pageGuestbook();
            break;
          
            case "orangeLink":
                clip = new pageSponsors();
            break;
          
            case "pinkLink":
                clip = new pageCommittee();
            break;
          
            default: break;
        }
      
        showPage(clip);
    }

     


    // Handles the display, position, and tween animation
    // of the currently selected page movieclip and close button
    function showPage(mc:MovieClip):void
    {
        // Add, position, and animate the page movieclip
        mc.x = 1423.3;
        mc.y = 307.3;
        addChild(mc);
        new Tween(mc, "x", Strong.easeOut, mc.x, 455.3, 1, true);
      
        // Create an instance of the close button, and position it
        // dynamically inside the page movieclip
        var close_btn = new closeButton();
        close_btn.buttonMode = true;
        close_btn.x = 430;
        close_btn.y = -270;
      
        // Listen for the click event and close the page
        close_btn.addEventListener(MouseEvent.CLICK, removePage);
      
        mc.addChild(close_btn);
    }

     


    // Removes the current page movieclip
    function removePage(e:MouseEvent):void
    {
        var mc:MovieClip = e.target.parent;
        this.removeChild(mc);  
    }

     

     

    /* Setup movie
    ----------------------------------------------------------*/

     


    // Set up listeners for the link buttons
    buttonListeners(blueLink);
    buttonListeners(greenLink);
    buttonListeners(yellowLink);
    buttonListeners(purpleLink);
    buttonListeners(orangeLink);
    buttonListeners(pinkLink);

     


    You can download the FLA here

     

    Hope that helps?

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points