We help IT Professionals succeed at work.

button code inside a movieclip not letting call an external swf

johanwilches
johanwilches asked
on
Medium Priority
290 Views
Last Modified: 2012-06-21
Hello, I have a on realease code that is not letting me call an external swf.  On the main movie...on frame 1 i have the following code:

---------------------------------
_root.currMovie = "welcome";
container.loadMovie(_root.currMovie+".swf");
------------------------------------

then on the stage i have 5 buttons..each one inside a movieclip for some animation rollover.  The code inside the movieclips that I have for each button is:

----------------------------------------
on (rollOver) {
      if(_root.link != 1){
            this.gotoAndPlay("over");
      }
      ;
}
on (releaseOutside, rollOut) {
      if(_root.link != 1){
            this.gotoAndPlay("out");
      }
      ;
}
on (release) {
      
      ;
}
-----------------------------------------------------------

As you can see on realase is empty...I need to call an external swf with the following code:

------------------------------------------
on (release) {
      if (_root.currMovie == undefined) {
            _root.currMovie = "section2";
            container.loadMovie("section2.swf");
      } else if (_root.currMovie != "section2") {
            if (container._currentframe>= container.midframe) {
                  _root.currMovie = "section2";
                  container.play();
            }
      }
}
-----------------------------------------

But it doesnt let me call it...nothing happens..the animation does work...but it doesnt call the swf...i have 2 other codes that can call the swf in another way but I need the realease code above to make work the container feauture *which is letting me call swf's and having each one run a few more frames before it exists.  Here are the 2 other codes i usually use to call external swfs but in this case they work..but doesnt let me tell each swf to run a few more frames before it exists.

1.  _root.createEmptyMovieClip ("mc_loader", _root.getNextHighestDepth ());
        _root.mc_loader.loadMovie ("menu.swf");
            
2.  var tmp:MovieClip = _root.createEmptyMovieClip("clip_instance", getNextHighestDepth());
tmp.loadMovie("musician.swf");
Comment
Watch Question

Commented:
Hi,
since you say buttons are inside movieClips, then you might experience scope problems with calling container from on(release).
Try not to call container.loadMovie but _parent.container.loadMovie or even better _root.container.loadMovie ...
That's what comes to my mind from reading your post. For more detailed help , fla. would be nice :o)

Regards,
ivan_os

Author

Commented:
thanks for the help Ivan..tried to change to _parent.container...and _root.container...and didnt work...ive uploaded the fla's to the server...the main file is: menu...where i have the buttons to call the external swfs...ive placed to externals..*welcome* and *company profile* which will load on by clickin on any of the buttons.


http://www.fordrickhomes.com/test.zip

CERTIFIED EXPERT
Top Expert 2008
Commented:
Here is the updated code:

Code for Welcome Button onRelease
-----------
on (release) {
      if (_root.currMovie != "welcome" && _root.container._currentframe<_root.container._totalframes)
      {
            _root.currMovie = "welcome";
            _root.container.play();
      }
}
----------------

Code for Company Button onRelease
-----------
on (release) {
      if (_root.currMovie != "company" && _root.container._currentframe<_root.container._totalframes)
      {
            _root.currMovie = "company";
            _root.container.play();
      }
}
----------------

Rgds
Aneesh

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Dushan De SilvaTechnology Architect

Commented:
You can simply do with your coding, if you use "levels" , when your using loadMovie and unloadMovie function.

BR Dushan

Author

Commented:
Thanks guys..aneesh the updated code worked perfect...sorry to bother again but im about to post a new question regarding this since i have a main movie where im goin to be calling this menu and is not letting me call the swfs again...it must be again the levels/roots but im having a hard time to figure out how to use levels/roots...thanks again...

cheers,

Johan,
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.