A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Start animation by play button

  1. #1
    Registered User
    Join Date
    Oct 2013

    Start animation by play button

    In macrodedia flash 8, i created an animation and two buttons for stop and play. IN preview, the animation starts automatically, then by stop button it stops and by play again, start playing again.
    However I want the animation to start by "play" button only but can't do so.

    I need some help.

  2. #2
    Junior Member
    Join Date
    Nov 2014
    However I want the animation to start by "play" button only but can't do so.

  3. #3
    . fruitbeard's Avatar
    Join Date
    Oct 2011

    try using stop(); on the first frame of the animation timeline.

  4. #4
    Registered User
    Join Date
    Aug 2017
    Create a new c# script and paste this code. add the script to the object that own the animation

    //Script Made By StrupsGames// using UnityEngine; using UnityEngine.UI; using System.Collections;

    public class play_anim_on_ui_button : MonoBehaviour {

    public Button Text;
    public AudioClip sound;
    public Animator ani;
    public Canvas yourcanvas;

    void Start ()
    Text = Text.GetComponent<Button> ();
    ani.enabled = false;
    yourcanvas.enabled = true;

    public void Press()

    Text.enabled = true;
    AudioSource.PlayClipAtPoint(sound, transform.position);
    ani.enabled = true;



    then select the object on the hierachy, go to the inspector, you are going to see this link the maze

    fill it

    then go to your UI button and in the inspector, on click() , add to list, and http://imgur.com/V4M3lSR

    this function will enable our animator, so the fist time we click out button, the object is gonna be animated but the second time we click it, it wont, to make this happen, "add to list" other function and alt text

    once you did that, in the function choose : alt text

    now every time you click the button this function will play the animation

    if you want to add sound to your running animation you just need to create an audio source and in the inspector add the audio clip http://imgur.com/xOtHf5V

    then go to the button inspector and add a new function, "add to list" drag the object audio source you created and you will have to choose the audio clip again http://imgur.com/j4DkHnR

    now just select audio source function, playoneshot(Audioclip)


    This way every time you click it will reproduce the animation and the sound at the same time

    I hope beeing helpful

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