Solved

Actionscript 2 LoadMovie

Posted on 2009-05-05
6
1,024 Views
Last Modified: 2013-11-11
I'm not sure what I'm doing wrong with this code.  It seems to skip over the preloader and continue on.  I can put a bad file name into the my_mcl.loadClip(swfName, mc_holder); and i don't get an error, it just plays the next line.

I have a movie that loads some buttons.  After the user clicks a button, a variable is loaded with the name of the appropriate .swf  - after the buttons fade away, I do the loadClip code...

I've tried several different ways to do this, testing it on my computer - i can't get the external swf to load.  Here's the code i'm using:

stop();
if (swfName == ""){
      gotoAndPlay(3)
} else {
      trace("here");
      trace(swfName);
      var mclListener:Object = new Object();
      mclListener.onLoadError = function(target_mc:MovieClip, errorCode:String, status:Number) {
    trace("Error loading image: " + errorCode + " [" + status + "]");
      };
      
      mclListener.onLoadStart = function(target_mc:MovieClip):Void {
    trace("onLoadStart: " + target_mc);
      };
      
      mclListener.onLoadProgress = function(target_mc:MovieClip, numBytesLoaded:Number, numBytesTotal:Number):Void {
    var numPercentLoaded:Number = numBytesLoaded / numBytesTotal * 100;
    trace("onLoadProgress: " + target_mc + " is " + numPercentLoaded + "% loaded");
      };
      
      mclListener.onLoadComplete = function(target_mc:MovieClip, status:Number):Void {
    trace("onLoadComplete: " + target_mc);
      };
      
      my_mcl.addListener(mclListener);
      my_mcl.loadClip(swfName, mc_holder);
      gotoAndPlay(288);
}

I am not sure what's up.  This is code i found on the Adobe site...  any insight would be appreciated!!!
0
Comment
Question by:steverguy
  • 3
  • 2
6 Comments
 
LVL 39

Accepted Solution

by:
blue-genie earned 500 total points
ID: 24312086
i'm not sure what your setup is but if i copy and paste your code into a file and provide a swfName that doesn't exist I get error messages as expected.
where are you specifying your my_mcl.
you have a mc_holder on the stage?
where are you specifying the swfName variable?
0
 
LVL 1

Author Closing Comment

by:steverguy
ID: 31578305
Thank you!
0
 
LVL 1

Author Comment

by:steverguy
ID: 24315727
It was a combination of things - but the main thing was I didn't have my_mcl specified.
Working great now. Thanks!
0
ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

 
LVL 22

Expert Comment

by:rascalpants
ID: 24316025
just a question, but why do you have...  gotoAndPlay(288);  in the spot it is in?

normally if you have the project wait until the thing gives you an error or it loads successfully, before you move on to another frame.


did you actually want this to be here...

mclListener.onLoadComplete = function(target_mc:MovieClip, status:Number):Void {
    trace("onLoadComplete: " + target_mc);
    gotoAndPlay(288);
};


and actually you should use onLoadInit instead of onLoadComplete, before you take any action.


rp / ZA
0
 
LVL 1

Author Comment

by:steverguy
ID: 24317318
Thanks for the input.  I guess I was just thinking it would run gotoAndPlay(288) after the external .swf was loaded... but putting it in the "onLoadComplete:" makes more sense.  

But are you suggesting i put it inside of onLoadInit?
0
 
LVL 22

Expert Comment

by:rascalpants
ID: 24317550

yes...   onLoadComplete is the event that gets fired when the loading is completed...

onLoadInit is the event that gets fired when the loaded items is ready to interact with code.... this is when you set properties and such.


rp / ZA
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question