A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: equality, inequality (confused)...

Threaded View

  1. #1
    Junior Member
    Join Date
    Sep 2010
    Posts
    15

    Smile equality, inequality (confused)...

    Good day to all of you experts out there,

    I am quiet new to as3 and I am trying to write my code as efficient as possible and I have a scenario where I am not familiar with all the operators and need advice.

    Here is the scenario:


    Actionscript Code:
    import fl.transitions.Tween;
    import fl.transitions.easing.*;
    import flash.events.Event;



    //functions
    function animate():void {
        var squareTweenX:Tween = new Tween(square_mc,"x",Elastic.easeOut,square_mc.x,mouseX,1,true);
        var squareTweenY:Tween = new Tween(square_mc,"y",Elastic.easeOut,square_mc.y,mouseY,1,true);
    }

    function anim(evt:Event):void {
        if (   (mouseX > 0) && (mouseX < 550)  ,   (mouseY > 0) && (mouseY < 400)   )
        {
            animate();
            trace("whitin boundary");
        }
        else
        {
            var reset:Tween = new Tween(square_mc,"x",Elastic.easeOut,square_mc.x,256.5,2,true);
        }


    }

    //listeners
    stage_mc.addEventListener(MouseEvent.MOUSE_MOVE, anim);


    Now this piece of code never reaches the else condition. I want it to go to "else" condition as soon as either one of those initial 4 values returns false.

    Which operator would do the job or am I missing something else entirely?

    Thanks in advance to anyone who replies.

    Aeson
    Last edited by aeson; 11-23-2010 at 09:19 AM.

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