Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Actionscript 2 LoadMovie

Posted on 2009-05-05
6
Medium Priority
?
1,051 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 39

Accepted Solution

by:
blue-genie earned 2000 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
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.

715 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