A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Click throughs

  1. #1
    Senior Member
    Join Date
    May 2001
    Posts
    121

    Click throughs

    Hi,
    I am trying to create a simple click through. I have one button. On release, I want it to play to one frame, and stop. Then, the part I don't understand, I want a second release that plays to a third keyframe.

    Here is my code:

    stop();
    _global.mrt = this;

    threeinone.hitArea = hitArea_mc;

    threeinone.onRelease = function(){
    trace("onRelease has been called.")
    this.gotoAndPlay("begin");
    };


    and the .fla is attached.

    Can anyone please help me?

    Thanks!
    Attached Files Attached Files

  2. #2
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    hi,

    The logic for something like this, is the one of a switch, which you can turn on or of:
    code:

    threeinone.hitArea = hitArea_mc;
    var clicked = false;
    threeinone.onRelease = function()
    {
    if (!clicked)
    {
    this.gotoAndPlay("begin");
    }
    else
    {
    this.gotoAndPlay("open");
    }
    clicked = !clicked;
    };


    In case you've got more than two possibilities, you can use a number (although here, it's illustrated with two possibilities as well):
    code:

    threeinone.hitArea = hitArea_mc;
    var i = 1;
    threeinone.onRelease = function()
    {
    trace("onRelease has been called.");
    if (i == 1)
    {
    this.gotoAndPlay("begin");
    i = 0;
    }
    else
    {
    this.gotoAndPlay("open");
    i = 1;
    }
    };


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