A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: help! how to activate a certain event..

  1. #1
    Registered User
    Join Date
    Aug 2011

    Unhappy help! how to activate a certain event..

    I'm trying to make a couple's dress-up game with lots of characters. I wanted to make it so that when you click a certain character and pair it with a certain character, something special appears or happens. How do i make it so that this 'special' thing only appears when the certain two characters are both chosen.
    I can't figure out how to code this.. I really need help..

    I'm using Adobe CS3 AS2..

    I want to make it a little like this
    The characters have different reactions depending on who they're paired with.

    I'd be really grateful if anyone can help me with this..

  2. #2
    Senior Member Steven FN's Avatar
    Join Date
    Mar 2010
    CA, USA
    I would just make either just a variable like "male" and "female" and store which character is selected. Then do an IF statement like
    Actionscript Code:
    if(male == "naruto" && female == "sakura"){
    Assuming your characters are in seperate MovieClips.

  3. #3
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    or you could use the same method, but check the current frame. Let's say the Men are in their own movieclip with the instance name of men, and Women, also in their own movieclip, given the instance name of women. Then, outside both of those movieclips, on a Frame, assign a loop which always checks if, for instance, the user is on the frame Sasuke is on, and at the same time, is on the women's movieclip's frame, where Sakura is. In this example, let's say, in the men's movieclip, Sasuke is on Frame 3, and in the women's movieclip, Sakura is on Frame 5. Then, outside both of those movieclips, I'd write something like this on a Frame:

    Actionscript Code:
    onEnterFrame = function(){
        if(men._currentframe == 3 && women._currentframe == 5){
        } else {

    in this code, I am assuming that, inside for example the women's movieclip, there are several movieclips. One for each part of the body, for example, one movieclip for the facial expressions, one for the hair, another for the body, and so on. And for instance, the facial expression movieclip containing all the possible expressions, inside the women's movieclip, is given the instance name face. And gotoAndStop("some_name"); - that means the name of a Frame, aka the Frame Label. To assign one, just click on a Frame, open Properties Panel, and type something in the Frame Label field. This way, you can avoid checking the frame number each time. But _currentframe code only works with frame number, not frame label!

    If you need further help, just ask and I'll make a quick FLA file
    I am back, guys ... and finally 18 :P


  4. #4
    Registered User
    Join Date
    Aug 2011
    Steven and Nig thank you thank you so much!.. that totally helped.. I'll post the link to my game here when it's finished.. incase you want to see my finished product.. ^-^ thank you thank you again!!^-^

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