Solved

Flash - How to determine if mc is loaded??

Posted on 2004-09-23
9
305 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Stop Ads in Browser Google Chrome 3 542
How to emebed .XML into  flash to make a self contained .SWF 1 185
free photo watermark software 5 86
flash professional 3 11
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…
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 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 select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

832 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