Skip to main content
Participant
October 21, 2013
Question

Addind one unique script to 3 separate movie clips

  • October 21, 2013
  • 1 reply
  • 479 views

Hi,

Where do you insert your script when your animation is composed of three separate movie clips? In a simple animation, I believe it would be on the first frame but in the case of threee movie  clips, I tried on scene 1, frame 1 but it didn't work, neither did it work on frame 1 of each animation. Is there a script (in scene 1 frame 1) that would include all three movie clips? My script is about replaying the animation every time a page of my digital brochure is reloaded.

Here is the sript I' m trying to apply:

function onPageOffView():void{

    this.stop();

}

function onPageViewed():void{

    gotoAndPlay(1);

}

Thank you!

This topic has been closed for replies.

1 reply

robdillon
Participating Frequently
October 21, 2013

That error in your first screen image is trying to tell you that you can't attach Actionscript directly to an object on the stage. You could do that with AS2 but not with AS3.

You could place the actionscript in its own layer in a keyframe. What event are you using to tell these functions onPageOffView() and onPageViewed()?

veromAuthor
Participant
October 21, 2013

Thanks Rob.

I tried to place it, like you said, on a different layer in a keyframe but it didn't do much. It worked with another (very simple one) animation (please see pic). On frame 1, there is my script, on the last frame, there is a stop.

Also, I tried placing the actionscript on different layers (just like on the attached ex.) for each animation but, still, no results.

robdillon
Participating Frequently
October 21, 2013

You have actionscript attached to frames 1 and 15. Do you have the same code in both frames? Is it the code that is in that actions window?

Do you have some action that is calling these functions? If you do, is it a frame event or a mouse event or something else?