Results 1 to 3 of 3

Thread: track the number of clicks/finite clicks/change event

  1. #1
    Join Date
    Jan 2008
    Location
    Near Chicago
    Posts
    247
    Thanks
    105
    Thanked 2 Times in 2 Posts

    Default track the number of clicks/finite clicks/change event

    I can assign an event to a button or mc, what about making the event happen a finite amount of times?

    or

    making a different event happen the second time an event is clicked.

    I can fudge that by using the timeline to keep advancing frames -but I would like to do it programatically.
    UPDATE:

    //first time clicked display hello 3rd time clicked display movie clip, pretty simple
    //see essential actionscript 3.0 1.7 pg 14
    var blah:Number= 1;
    happy_btn.addEventListener(MouseEvent.CLICK,hello);
    function hello(e:MouseEvent):void{
    status.text= "hello";
    blah++;
    if (blah == 3){ var clip:MovieClip = new Clip ();
    addChild (clip);
    clip.x=200;
    clip.y=200;}
    }
    Last edited by evan; 07-01-2008 at 10:30 PM. Reason: found the answer I think unless there is more

  2. #2
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    You have the right idea...

    Just use a variable to calculate how many times you've clicked on a button (i.e. how many times a particular function is called). And then evaluate that variable against it's constraints in a conditional to do whatever it is that you need to happen on the 2nd click or whatever...

  3. The Following User Says Thank You to Medyman For This Useful Post:

    evan (07-03-2008)

  4. #3
    Join Date
    Jan 2008
    Location
    Near Chicago
    Posts
    247
    Thanks
    105
    Thanked 2 Times in 2 Posts

    Default

    yeah me getting smart

Bookmarks

Posting Permissions

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