Everybody! This is important. In a few days, these forums will be moving over to using the totally sweet Discourse platform. To ensure this migration happens smoothly with no loss of content, these forums are currently in a read-only mode. I do apologize for the inconvenience.

There is never a good time to turn the forums off for an extended period of time, but I promise the new forums will be a billion times better. I'm pretty sure of it.

See you all on the other side in a few days, and if you have any (non-technical) questions, please e-mail me at kirupa@kirupa.com. For technical questions, try to find a tutorial that corresponds to what you are looking for and post in the comments section of that page.

Cheers,
Kirupa

Results 1 to 1 of 1

Thread: about movieclip and condition

  1. #1

    Fla Script about movieclip and condition

    here it is :

    I have 1 MC called "fruitmc" it contains 4 frames : orangeA(1st frame) ,orangeB(2nd frame) ,appleA(3rd) and appleB(4th).

    Now what I want to do is :

    User swipe down the orange,the orange will be in lower position (in my case y = 326,25)
    when in lower position,user has a choice whether to put out the orange like in the first position (y = 216,25) or to make the ORANGE sing(play sfx),and change it appearance to frame(2) /orangeB.

    if user chose the ORANGE to sing,then the ORANGE can still be put out.

    When the ORANGE is out,user can click the ORANGE to change to APPLE,and the APPLE can sing too similar to ORANGE.

    so user can choose ORANGE or APPLE.

    But I'm really confused with my code after days of coding,
    here is my code :


    Code:
    var fruit:String="orange";
    var fruitposition:String="out";
    
    Multitouch.inputMode = MultitouchInputMode.GESTURE;
    fruitmc.addEventListener(TransformGestureEvent.GESTURE_SWIPE , orangeinbasket);
    function orangeinbasket (e:TransformGestureEvent):void{
        
        if (e.offsetY == 1 && fruitposition=="out" ) {
        //User swiped towards bottom
        fruitmc.gotoAndStop(1);
        fruitmc.y = 326,25;
        fruitposition="in";
        trace("ORANGE is in!");
        fruitmc.removeEventListener(TransformGestureEvent.GESTURE_SWIPE,orangeinbasket);
        fruitmc.addEventListener(MouseEvent.CLICK,orangesfx);
            function orangesfx(event:MouseEvent):void
            {    fruitmc.gotoAndStop(2);
                trace ("ORANGE sing!");
                fruitmc.removeEventListener(MouseEvent.CLICK,clickfruitmc);}
                }
            
    fruitmc.addEventListener(TransformGestureEvent.GESTURE_SWIPE , orangeoutbasket);
    function orangeoutbasket (e:TransformGestureEvent):void{
            
        if (e.offsetY == -1 && fruitposition=="in") {
        //User swiped towards top
        fruitmc.gotoAndStop(1);
        fruitmc.y = 216,25;
        fruitposition="out";
        trace("ORANGE is out!");
        fruitmc.removeEventListener(MouseEvent.CLICK,orangesfx);
        fruitmc.removeEventListener(TransformGestureEvent.GESTURE_SWIPE , orangeoutbasket);
        }
        }}
    in this code I've not added sounds yet,so don't bother on that,just making sure for what I want to make.

    anyone can help me?
    Thank you.
    Last edited by eggblade; May 7th, 2012 at 11:37 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012