A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: [Help]: VERY simple game help needed.

  1. #1
    Junior Member
    Join Date
    Jul 2010
    Posts
    4

    [Help]: VERY simple game help needed.

    Hey, there, first post. Found this place whe looking for help with my issue.

    I've used Flash before, years ago, for doing dynamic menus for sites. My problem here, though, is with an absurdly simple game (If you can call it that).

    The idea is to click on an audio cable, and have it change into a position. I've made it into a button, but when I click the button, it changes back on release. I've looked for ages, now, trying to find a solution in I don't know how many PDFs, tutorials and textfiles, but I either can't find it, or make heads nor tails of what it's saying.

    What the "Game" would hopefully do is get the player to click on two audio cables so they're plugged into an effect pedal and a mixer and YAY! Game completed. Sounds dumb, yeah, but it has its purpose !

    Any help at all would be much appreciated. I'm using Flash Pro 8. Thanks!

  2. #2
    Senior Member bluemagica's Avatar
    Join Date
    Jun 2008
    Posts
    766
    Make it into a movieclip.
    Put one image in frame one inside this mc, and another one on the second frame.
    On the first frame put a "stop();" command.
    after that do something like
    Code:
    this.addEventListener(MouseEvent.CLICK,evt_click,false,0,true);
    function evt_click(e:MouseEvent)
    {
      this.gotoAndStop(2);
    }
    If you like me, add me to your friends list .

    PS: looking for spriters and graphics artists for a RPG and an Arcade fighting project. If you can help out, please pm me!

    My Arcade My Blog

    Add me on twitter:

  3. #3
    Junior Member
    Join Date
    Jul 2010
    Posts
    4
    Thanks for the quick reply ! That looks to have solved some issues, now I gotta figure out

    Code:
    The class or interface 'MouseEvent' could not be loaded.
         function evt_click(e:MouseEvent)
    This thing. I tried onClick, onRelease and looking about the help files and haven't a clue. Or am I putting the AS in the wrong place? Should it be underneath the stop script, or in frame two? I put it in frame one, with the stop script.

    I shoulda paid more attention in media class...........

  4. #4
    Senior Member Ray Beez's Avatar
    Join Date
    Jun 2000
    Posts
    2,793
    this is why i hate AS3

  5. #5
    Senior Member bluemagica's Avatar
    Join Date
    Jun 2008
    Posts
    766
    OOPS! I forgot flash8 was still as2 only, oh well, I have kinda forgotten as2, but as far as I remember there was no onClick built in, you better use onRelease

    Frame1:
    Code:
    stop();
    
    this.onRelease = function(){
       this.gotoAndStop(2);
    }
    If you like me, add me to your friends list .

    PS: looking for spriters and graphics artists for a RPG and an Arcade fighting project. If you can help out, please pm me!

    My Arcade My Blog

    Add me on twitter:

  6. #6
    Junior Member
    Join Date
    Jul 2010
    Posts
    4
    Hello, again. Yet another dumb question.

    OK, so the movie has two clickable bits on it, and the idea is that once the two buttons are clicked, in any order, it moves to the next keyframe. I clicked, typed, read and banged my head against the desk for some time trying to get it to do this one, seemingly ridiculously simple thing. None of the above worked. Banging my head about didn't do the trick, so I tried pleading, then shouting, the bargaining, then pleading again. So, I finally said "Screw this", and here I am! Any help on this would again be very appreciated.

    Thanks, all, for the help! That little bit of AS there did the trick spot on.

  7. #7
    An FKer
    Join Date
    Sep 2005
    Location
    Ontario
    Posts
    1,167
    You can assign two separate variables to it, and each time one of the buttons are clicked, will set the corresponding variable to true. After clicking one of the buttons and setting it's variable, the button will then check if both variables are true, and if so, move to the next frame.

    For example, on your timeline frame where your movieclip is:

    PHP Code:
    bt1Clickedfalse;
    bt2Clickedfalse;


    /* This assumes your movieclip has an INSTANCE name 'myMovieClip', change this code
         to match your instance name.

         Also change the myButton1/2 to the instance names of your two buttons inside the 
         movieclip*/

    myMovieClip.myButton1.onRelease = function(){
         
    bt1Clicked true;
         
         if (
    bt2Clicked == true){
              
    _root.gotoAndStop(X);  // X is the frame number you want to jump to!
         
    }
    }


    myMovieClip.myButton2.onRelease = function(){
         
    bt2Clicked true;
         
         if (
    bt1Clicked == true){
              
    _root.gotoAndStop(X);  // X is the frame number you want to jump to!
         
    }


    Now this might not be the best solution but since you're only dealing with two buttons then it should work for your needs. If you're looking to add more buttons, or have a dynamic number of buttons, then we'll have to approach it differently.

  8. #8
    Junior Member
    Join Date
    Jul 2010
    Posts
    4
    OK, I'm gonna try and describe this right now, so bare with me!

    One of the MovieClip clickables has an Instance Name of "Input_mc", and next to it says "Instance of: Input_mc" The other one is the same, only "Output_mc". Inside each one is a wee timeline, the unclicked one is called "Input_GN", the clicked graphic is called "Input_GC" in the same bit where it says "Instance of:". Same for the other clicky MovieClip guy, only "Output" instead again. So, I would put it like this:

    Code:
    bt1Clicked= false;
    bt2Clicked= false;
    
    
    /* This assumes your movieclip has an INSTANCE name 'myMovieClip', change this code
         to match your instance name.
    
         Also change the myButton1/2 to the instance names of your two buttons inside the 
         movieclip*/
    
    Input_mc.Input_GN.onRelease = function(){
         bt1Clicked = true;
         
         if (bt2Clicked == true){
              _root.gotoAndStop(3);  // X is the frame number you want to jump to!
         }
    }
    
    
    Output_mc.Output_GN.onRelease = function(){
         bt2Clicked = true;
         
         if (bt1Clicked == true){
              _root.gotoAndStop(3);  // X is the frame number you want to jump to!
         }
    }
    Or something like this? Instead of Button-buttons, I have MovieClip-buttons, but the names and stuff should work, right?

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