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
Solved

Flash - How to determine if mc is loaded??

Posted on 2004-09-23
9
306 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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.

809 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