Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

variable 1

Status
Not open for further replies.

blues007

Technical User
Oct 25, 2005
59
PT
is there a way to attribute a variable name to a movieclip?
say something like

my_clip=x

or something like this. thank you.
 
What I really want is this:

when I load a clip like this:

empty_clip.loadMovie("some_movie.swf")

how can my AS code tell if I allready loaded it, so I can load another one in another position of the page, regardless of the order I load my movies.(I have 5 positions, loadingMovies in empty_clip1 to 5). This is a tough one.
 
Here's an example (right from the AS dictionary in Flash):

Code:
this.createEmptyMovieClip("tester_mc", 1);
tester_mc.loadMovie("[URL unfurl="true"]http://www.yourserver.com/your_movie.swf");[/URL]
function checkLoaded(target_mc:MovieClip) {
  var pctLoaded:Number = target_mc.getBytesLoaded()/target_mc.getBytesTotal()*100;
  if (!isNaN(pctLoaded) && (pctLoaded>0)) {
    target_mc.onLoad = doOnLoad;
    trace("clearing interval");
    clearInterval(myInterval);
  }
}
var myInterval:Number = setInterval(checkLoaded, 100, tester_mc);
function doOnLoad() {
  trace("movie loaded");
}

Hope it helps.

Wow JT that almost looked like you knew what you were doing!
 
Your function checkLoaded is great. Thank you very much. I adapted your code and it works great.
 
Not my code :) It's available in the Flash Help file. Glad it helped though.

Wow JT that almost looked like you knew what you were doing!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top