Skip navigation
Currently Being Moderated

Need help

Dec 25, 2011 8:19 AM

Hello

 

I noticed that Ned Murphy is not around. I hope he is OK.

 

Now, my new project:

 

I want to have a textfield in which I want to put numbers that I can decrease or increase by moving my mousein the left or in the right. Like in the properties panel of flash when you want to change the positions or sizes. Any help will be appreciated.

 
Replies
  • kglad
    62,035 posts
    Jul 21, 2002
    Currently Being Moderated
    Dec 25, 2011 8:55 AM   in reply to Samsimms

    (it's christmas.  he's probably spending time with his family.)

     

    var tf:TextField=new TextField();

    addChild(tf);

     

    this.addEventListener(MouseEvent.MOUSE_MOVE,f):

     

    function f(e:MouseEvent):void{

    tf.text=String(mouseX);

    }

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 25, 2011 9:14 AM   in reply to Samsimms

    on the third line:

    this.addEventListener(MouseEvent.MOUSE_MOVE,f);

     

    the ending is a semicolon not a colon lol

     
    |
    Mark as:
  • kglad
    62,035 posts
    Jul 21, 2002
    Currently Being Moderated
    Dec 25, 2011 9:48 AM   in reply to Samsimms

    you want your numbers to be integers between 0 and 12 when the mouse is between 0 and stage.stageWidth?  if yes:

     

    var tf:TextField=new TextField();

    addChild(tf);

     

    this.addEventListener(MouseEvent.MOUSE_MOVE,f);

     

    function f(e:MouseEvent):void{

    tf.text=String(Math.round(12*mouseX/stage.stageWidth));

    }

     
    |
    Mark as:
  • kglad
    62,035 posts
    Jul 21, 2002
    Currently Being Moderated
    Dec 25, 2011 10:14 AM   in reply to Samsimms

    you're welcome.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 25, 2011 11:00 AM   in reply to Samsimms

    you are welcome

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points