Skip to main content
April 19, 2009
Answered

Scripting external movies to buttons in main movie, help please?

  • April 19, 2009
  • 1 reply
  • 1369 views

I'm building an entirely flash based website using Flash CS3 and ActionScript 2. I'm using external movies for the various pages, and putting buttons that control these movies in the main movie file. Normally, I'd simply put the script to control the buttons on the main movie file, not the external ones, but because there's more than two different pages and I'm fading each external clip in and out, I'm wondering if possible to put the script, for the buttons on the main movie, on the external movies.

I hope I've explained it right, any help appreciated.

Thanks.

This topic has been closed for replies.
Correct answer kglad

there is only one Empty_movieclip and it's on the main timeline and it's not part of another symbol either.


use the following.

var tl:MovieClip = this;

this._parent.CV_button.onPress = function() {

loadMovie("Creative-Outrage_portfolio_goto_cv.swf", tl);

};

1 reply

kglad
Community Expert
Community Expert
April 19, 2009

sure.  just use the correct path to the buttons.

for example, if the buttons are on the loading movieclips main timeline and the target movieclip into which you load your external swf is on the main timeline, code on the external swf's main timeline would reference the buttons by using:

this._parent.button1;

this._parent.button2; // etc

April 19, 2009

Sorry, I'm still having the same problem. I've already done all the obvious stuff like spell checking and making sure I've got the instance names correct, is it possible it's just a simple script error that the compiler isn't picking up on? Basically, this is what I've got scripted on the external clip so far and the button on the main movie isn't responding at all.

this._parent.CV_button.onPress = function() {

     loadMovie("Creative-Outrage_portfolio_goto_cv.swf", Empty_movieclip);

};

kglad
Community Expert
Community Expert
April 19, 2009

your path is, most likely, incorrect.

to debug, use:

trace(this);

on the timeline that contains your onPress code AND also on the timeline that contains CV_Button.  you can always determine the relative (and absolute) path using that technique.

if you have trouble, post the results of the two trace statements.