Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Action script 2 help

Options
  • 07-05-2009 9:58pm
    #1
    Registered Users Posts: 2,026 ✭✭✭


    hey all, if you need the actual script I'll post up if requested but...


    In as2 I need to create a game, in this I can only use the left mouse button. I already have one onMouseDown used. I was just wondering is there away to change the function of the onMouseDown after the first use to another use...

    eg. the first click and drag will create a shape, (the creating shape with col.boxes is done) but once the shape is created I want a ball to be imported and that can be thrown with onMouseDown... can this be done with a boolean or what happens?

    P.S yes i'm a complete noobie at this and I stupidly left it until last min to do :):(

    Thanks in advance


Comments

  • Registered Users Posts: 32,417 ✭✭✭✭watty


    What tools programs are you using?

    I have lots of flash games that work fine on my Archos 605 and downloaded Flex SDK2, Flex SDK3, FlashDevelop and FlexBuilder3.

    Flex while producing nice GUI for webpage, doesn't seem well suited for game development though it uses ActionScript. My projects work fine in Firefox or Flashplayer on PC, but put up a blank screen on the Archos.

    One way to do what you want is a global variable (not a boolean) that has a value according to what state or context the mouse button should be in.

    Then your Mouse event has a set of nested If else s to select appropriate function.

    Or a case. If I knew how to do a case in mxml files for Flexbuilder. But I can do the set if ifs..
    If the action or creation means the mouse "next time" should do something different you change the value of your variable.

    A Boolean only allows you two possibilities of mouse action, which isn't enough, so I'd use an integer and a final else clause to set it back to a default if it gets messed up.


Advertisement