Solved

Flash - How to determine if mc is loaded??

Posted on 2004-09-23
9
303 Views
Last Modified: 2012-05-05
Trying to figure out syntax for mc if it has loaded or not.

loadMovie("http://www.myWebsite.com/uploads/images/"+_global.projectCode_array[imageNo]+"TH.jpg", "broadcastImage"+container+"_mc");
      
if ("broadcastImage"+container+"_mc".loadMovie == true) {
            trace("THE MOVIE HAS LOADED"); }

if ("broadcastImage"+container+"_mc".loadMovie == false) {
            trace("THE MOVIE HAS NOT LOADED"); }

Is there a property that will determine if mc has loaded?  Pulling info from xml and image may not exist yet.  Flash will crash if it does not find image.  I want it to gracefully post message.

Thanks,

Terry
0
Comment
Question by:splendorx
  • 4
  • 4
9 Comments
 
LVL 10

Expert Comment

by:muso120999
ID: 12138648
Simplest way might be to check the _width / __height of it!  But check getBytesTotal() against getBytesLoaded() to check load progress.

There is an tutorial here of how to test for a files existence too:
http://www.flashguru.co.uk/000310.php
0
 
LVL 16

Accepted Solution

by:
vickerleung earned 300 total points
ID: 12139798
Actually you can use the MovieClipLoader class

var movie_clip_loader = new MovieClipLoader();

movie_clip_loader.loadClip ("url", target);

movie_clip_loader.onLoadComplete ()
{
      ... blah blah blah
}
0
 
LVL 1

Author Comment

by:splendorx
ID: 12144976
Thanks for the replies...  I have attempted to use the code from the above url:

http://www.flashguru.co.uk/000310.php

I am still having difficulty with the proper display...  When the image file is not found, the local Flash player displays swf correctly by showing a generic image.  However, when I publish swf file on the web all generic thumbnails are being displayed as opposed to one generic which was intentionally misspelled.  Each button is calling the below function to display thumbnail images.  Any ideas why it would work locally when testing, then when publishing it displays all generic thumbnails?  Any ideas for a simple solution?


// THUMBNAIL IMAGE FUNCTION
_global.showImage = function(imageNo, container) {
      if (_global.thumbnailImages_array[imageNo] != undefined) {
            fileExists = new LoadVars();
            fileExists._parent = this;
            fileExists.onLoad = function(success) {
                  //success is true if the file exists, false if it doesnt
                  if (success) {
                        loadMovie("http://www.myWebSite.com/uploads/images/"+_global.thumbnailImages_array[imageNo], "broadcastImage"+container+"_mc");
                  } else if (success == false) {
                        loadMovie("http://www.myWebSite.com/uploads/images/genericTH.jpg", "broadcastImage"+container+"_mc");
                  }
            };
            fileExists.load("http://www.myWebSite.com/uploads/images/"+_global.thumbnailImages_array[imageNo], "broadcastImage"+container+"_mc");
      }
};

Thank you!!
0
 
LVL 10

Expert Comment

by:muso120999
ID: 12212991
> Any ideas why it would work locally when testing, then when publishing it displays all generic thumbnails?

Is the URL (i.e. the www.myWebSite.com bit) for the images the same as where your Flash file is located?  Because I think there are cross-browser restrictions in Flash that would prevent this from working.
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 1

Author Comment

by:splendorx
ID: 12217576
Yes, that is correct my swf and images are in two seperate domains!!  I am loading images from a seperate domain...  Is there a work around?
0
 
LVL 10

Expert Comment

by:muso120999
ID: 12217619
I think there is a setting somewhere to specify allowable domains somewhere - I'll check into it for you...
0
 
LVL 10

Expert Comment

by:muso120999
ID: 12217673
0
 
LVL 1

Author Comment

by:splendorx
ID: 12217857
hhhmmm.. the thumbnails are loading into the swf ok.  So, I am not sure that may be the problem.  And I am loading images from a seperate domain.  

Reference: http://www.or-live.com/flash/index.cfm

Terry
0
 
LVL 1

Author Comment

by:splendorx
ID: 13095425
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
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 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.

707 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now