A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: start/stop

  1. #1
    Junior Member
    Join Date
    Oct 2003
    Posts
    6

    start/stop

    I'm trying to make a .swf file so when you click on it, it'll play. like a start button of sort. I've tryed everything but I can't seem to get it to work. If someone could help please do.

  2. #2
    Senior Member
    Join Date
    Nov 2003
    Location
    N. Virginia
    Posts
    225
    you need to be a little more specific...post your .fla code

    The easiest way is to put a stop action in frame 1 and then have a button to tell it to play.

    in frame 1 put "stop();" minus parenths.
    then name the movie clip to whatever you want.
    then use the (+) target to assign a gotoAndPlay(2); action or just a play();.... hope this helps.

  3. #3
    Registered User Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488
    You mean anywhere on it? First, the stop(); needs to be at the top of any other actionscript in an actions layer. Then make a layer for an invisible button. Insert a new button symbol and set a keyframe in frame 4 only, of the button timeline. Draw a red fill rectangle, with no line. Position it at 0, 0 and make it 100x100 pixels. Then, back on the main stage, click the first frame where you want the button to show up in it's layer, and drag an instance to the stage. Position in at the top left corner, 0, 0 and then use the properties panel to set the height and width to the size of the stage.

    Then the code on the button:

    on(release);
    _root.play();
    }

    Or if this swf is loaded to another movie:

    on(release);
    _root.targetclipInstanceName.play();
    }

  4. #4
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    Hi,

    in frame 1 of your movie add the actions,

    code:

    stop(); // have the movie stopped to begin with
    this.onMouseDown = function() { // detect the mouse being pressed
    play(); // when the mouse is pressed play the movie
    delete this.onMouseDown; // and since the onMouseDown function has done all it needed to do we can remove it
    };


  5. #5
    Registered User Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488
    Hey Catbert, just an aside, I got the Moock Definitive Guide the other day. Finally....

    Going to the next level now.

  6. #6
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    I don't think you'll regret it, its fantastic book, especially the actionscript reference section

    *sits and waits impatiently for "ActionScript for Flash MX2004: The Definitive Guide"*

  7. #7
    Registered User Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488
    I'm starting from the front, doing every example. Would have been nice if it came with a CD, but I'm thinking this is a better way to learn. At least the typesetters didn't mess up the printing job. Another book, the Bible is so full of mistakes you need the CD to find the real working code.

    While it starts out with simple stuff, I don't think this is a beginners AS book.

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