• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 200
  • Last Modified:

Buttons in loaded movie don't work.

I have a simple flash site consisting of the main SWF and three button that load external swf's into targets. The loaded movies contain buttons to navigate its own content. When I load the movies into the main swf, none of my buttons work. The button work when I export the movies independently. I have never experienced this problem. The swf's load but the buttons have no functionality. Can someone please help me solve this problem. Thank You
0
Chocko
Asked:
Chocko
1 Solution
 
henrywwCommented:
the object reference is different when the external movie is loaded into the another movie.

if a swf is intented to be used in another swf, avoid absolute path for object reference use relative reference like _parent, ../ etc

for exmaple:


//in the original movie - button.swf
// a button to goto a frame
// it works perfectly in a stand alone swf

// button ****
on (release) {
   _root.animation.gotoAndPlay(28);
}



// main movie - load the above movie
loadMovie ("button.swf","btn",1);

//for the same  button ****
// not going to work, cos the object it is refering to
// it is now - _root.btn.animation <- !!!
on (release) {
   _root.animation.gotoAndPlay(28);
}


that's could be the most obvious reason why your buttons are not working. so instead of absolute ("_root.etc") try in "_parent.etc" or "_parent._parent.etc", then it should work

cheers
0
 
elhyCommented:
You can oso use _level if you are loading that swf into a new level. actually _root should have work if you are loading your movie to a empty mc that is on the maintimeline.

maybe u should post the codes in your button so that we can debug for you, instead of giving suggestions that may or may not help u. :)

0
 
gromitboyCommented:
Hi

I had this problem a couple of months ago and I can tell you 100% for sure that the problem lies with your use of "_root"....

The buttons that you have in the loaded movie work when you run it seperately because they are referencing that particular movie's root level.

However when you load it into another movie (using loadmovie() or whatever), if you have used "_root" it will try and find whatever its looking for on the root of the main movie.

The simple way to get around this is to use relative paths rather than absolute paths.  To do this, click on the button thats giving you grief and open the actionscript panel. Make sure that you are in "normal" mode and not "expert" mode.  Click on the line that references what happens when the button is clicked.  You will see that the little "target" symbol lights up - click this and then click the "relative" radio button rather than the "absolute" button.

Hope that helps.  If you understand actionscript levels already, the simple answer to your problem is "stop using _root"!!  

Let us know if your problem goes away.  If you are still having problems with it, post the fla file and I'll have a look for you.

Stu
0
 
ChockoAuthor Commented:
Thank you very much, couldn't have been clearer.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now