Simple Flash Event?

Discussion in 'HTML & Website Design' started by calisonder, Oct 28, 2008.

  1. #1
    Hello,

    this will probably be easy for anyone that's not a coding idiot like me.

    Im using FLASH CS3 AND ACTIONSCRIPT 3
    I have a 3 movie clips that are also buttons. You can view all 3 of them on the main page at www. 5twelvedesign dot com. First You see pictures of different rooms, then the words services, portfolio, and contact fade in, those are the three different movie clips. When clicked, they go to a different page (like they are supposed to do). Problem is, when you hover over the link, it doesn't turn into a hand cursor, but stays the arrow cursor (which makes it difficult for users to know that can click on it).

    So I did some research and found out that if I add something like mouseOver to my code somewhere, flash will know to change to the hand cursor when you hover over the movie clip. But I am dumb so please help.


    Here is the code I use to make the movie clip work as a button (which works fine):

    [b]
    this.ServicesPicCover.addEventListener(MouseEvent.CLICK,clickListener99);
    function clickListener99(event:MouseEvent):void {
    	gotoAndPlay("contactZoom");
    }[/b]
    
    Code (markup):
    And here is the code I put right after that to try and do the mouse over thing:

    [b]
    this.ServicesPicCover.addEventListener(MouseEvent.mouseOver,clickListener68);
    function clickListener68(event:MouseEvent): void{
    	gotoAndPlay("over");
    }
    [/b]
    
    Code (markup):
    THE FRAME LABEL "OVER", IS LOCATED INSIDE THE MOVIE CLIP "SERVICES PIC COVER".


    i get this error: 1119: Access of possibly undefined property mouseOver through a reference with static type Class.


    Can Anyone Help?
    Thanks in advance.
     
    calisonder, Oct 28, 2008 IP
  2. calisonder

    calisonder Peon

    Messages:
    93
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    nevermind i got it, in case anybody cares here is what i did:

    I just added this to the code
    this.ServicesPicCover.buttonMode = true;
    this.ServicesPicCover.useHandCursor = true;
     
    calisonder, Oct 28, 2008 IP
  3. higreg7

    higreg7 Peon

    Messages:
    469
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hi,

    Most properties of the mouseEvent constructor are capitalised, so the first mistake is how you write MOUSE_OVER:

    this.ServicesPicCover.addEventListener(MouseEvent.mouseOver,clickListener68);


    should be:

    this.ServicesPicCover.addEventListener(MouseEvent.MOUSE_OVER,clickListener68);

    Secondly, and I'm not so sure about that since all I do is AS2, but in AS2, you would need to say:

    this.ServicesPicCover.addEventListener(MouseEvent.mouseOver,clickListener68);
    function clickListener68(event:MouseEvent): void{
    this.gotoAndPlay("over");
    }

    Otherwise, it is the main timeline that goes to and play to frame labeled "over". So you need to specify that you want the button (inside the buttton), to go and play that frame, not on the main timeline.

    Also, I would suggest you make use of the internal Flash help first before starting to google around for hours.

    Once you understand the principles of Classes, Object, Methods/functions and properties, you will be able to learn a lot just by browsing the help library.

    In your case, if you went into "Actionscript 3.0 language and components ref...", then "All classes", then "MouseEvent" class, you can browse all the methods and properties available to that class, and you would have realised you spelt MOUSE_OVER wrong.

    ;-)
     
    higreg7, Oct 28, 2008 IP
  4. higreg7

    higreg7 Peon

    Messages:
    469
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Cool, I'll note that. I just got very confortable with AS2...can't be bothered to start AS3 yet.

    ;-)
     
    higreg7, Oct 28, 2008 IP
  5. calisonder

    calisonder Peon

    Messages:
    93
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    supposedly AS3 is way more logical then AS2
     
    calisonder, Oct 28, 2008 IP