The forums have permanently moved to forum.kirupa.com. This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.


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