• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to run MovieClip symbol only once

Explorer ,
Oct 30, 2020 Oct 30, 2020

Copy link to clipboard

Copied

Hi,
In the animation I prepared, I wrote a code as follows. I created symbols of type MovieClip. What I want to do is briefly as follows:
The Symbol1 symbol I prepared for the value 1 read from the array and the Symbol2 symbol I prepared for the 0 value will work. However, I have a problem like this.
1- Animation works non-stop. I want to run the symbols I add only when the condition is true. However, my animation is repeated infinitely. The for loop doesn't work step by step. As I understand it, the for loop is completed first and then the animation is shown.
How can I solve this problem? I will be grateful if you could help me.
I wish good work.

 

 

import flash.display.MovieClip;
import fl.transitions.Tween;
import fl.transitions.easing.*;

var quest:Array = [1,0,0,0,1,1,1,0,0,0,1,1,1,1,0,0,0,1,0,1];
var len:uint = quest.length;

var bh:Symbol1 = new Symbol1();
var bhs:Symbol2 = new Symbol2();
for(var i:uint = 0; i < len; i++)
{
if(quest[i] == 0)
{
addChild(bh);
bh.x = 415.7;
bh.y = 149.6;
}
else
{
bhs.x = 519.25;
bhs.y = 149.6;
addChild(bhs);
}
}

TOPICS
ActionScript , Code

Views

166

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Oct 31, 2020 Oct 31, 2020

You put it where you want it to stop.

Votes

Translate

Translate
LEGEND ,
Oct 31, 2020 Oct 31, 2020

Copy link to clipboard

Copied

Is there some reason you can't just put a stop() statement in the last frame of the movie clip?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 31, 2020 Oct 31, 2020

Copy link to clipboard

Copied

I'm new to Animate yet. Do I put it exactly below the code block or do I need to add it to the frame on the layer?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 31, 2020 Oct 31, 2020

Copy link to clipboard

Copied

LATEST

You put it where you want it to stop.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines