A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: conditional statement

  1. #1
    Member
    Join Date
    Sep 2007
    Posts
    60

    conditional statement

    i setup this conditional statement.

    my intention was that if the object

    foot_mc was on point0_mc then it will go to frame 5



    OR



    if foot_mc was on point1_mc it will go to frame 10....



    function Oncheck(evt:MouseEvent):void
    {
    if(foot_mc == point0_mc) return;
    {
    gotoAndStop(5);
    }
    if(foot_mc == point1_mc) return;
    {
    gotoAndStop(10);
    }
    if(foot_mc == point2_mc) return;
    {
    gotoAndStop(15);
    }
    }


    i get no errors but it will always go to frame 15.... instead i want it to go to the selective frames depending on where foot_mc is...



    Thank you

  2. #2
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    What are all those objects?
    - The right of the People to create Flash movies shall not be infringed. -

  3. #3
    Member
    Join Date
    Sep 2007
    Posts
    60
    here is more of my code...
    i managed to place foot-mc on the objects,... but unable to successfully verify its location before pressing the button_mc

    stop();
    import flash.display.SimpleButton


    var checking:Boolean = false;
    point0_mc.addChild(foot_mc);

    this.addEventListener(MouseEvent.MOUSE_DOWN, Onpress );
    button_mc.addEventListener(MouseEvent.CLICK, Oncheck );

    function Onpress(evt:MouseEvent):void {
    if (evt.target == foot_mc) return;
    evt.target.addChild(foot_mc);
    }

    function Oncheck(evt:MouseEvent):void
    {
    if(foot_mc == point0_mc) return;
    {
    gotoAndStop(5);
    }
    if(foot_mc == point1_mc) return;
    {
    gotoAndStop(10);
    }
    if(foot_mc == point2_mc) return;
    {
    gotoAndStop(15);
    }
    if(!checking) return;
    {
    gotoAndStop(5);
    }
    }

    button_mc.buttonMode = true;

  4. #4
    Member
    Join Date
    Sep 2007
    Posts
    60
    hello cancerinform

    the objects are mc i use.

    foot_mc is object that will display depending on which pointer(mc) i click on.. so foot_mc will display on top of it...

    when i press the mc button it will go to that frame depending on where the foor_mc is

  5. #5
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    You are not testing where foot_mc is. You are testing what foot_mc is. If you want to test whether it is on a particular display parent check whether foot_mc.parent == point0_mc etc.

  6. #6
    Member
    Join Date
    Sep 2007
    Posts
    60
    in it is a code which i poorly wrote and tried to control and verify where foot_mc is

    so if foot _mc is at point1_mc ..then when press the button it will go to frame 10...

    but i run into several issues...
    1. it always goes by default to frame 15...
    2. for some reason the foot_mc hovers the button too...
    Attached Files Attached Files

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