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

x
?
Solved

Flash - How to determine if mc is loaded??

Posted on 2004-09-23
9
Medium Priority
?
325 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
[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
  • 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 1200 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
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!

 
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

There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
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…

688 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