Solved

Flash - How to determine if mc is loaded??

Posted on 2004-09-23
9
308 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
Technology Partners: 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!

 
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
 
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

Technology Partners: 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

Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
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 live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.

733 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