Reply LinkBack Thread Tools Search this Thread
Old 17-12-2004, 09:14   #1 (permalink)
paulanthony
mingin dawg baitch
 
paulanthony's Avatar
 
Join Date: Apr 2004
Location: Belfast
Posts: 1,041
Send a message via MSN to paulanthony
OnClipEvent sucks it. yes I am crap.

Anyone know how to execute a function once and only once when called from within this code? the function would be on the timeline, and would take the form of an actionscript tween..this would enable the clip to bounce in when its fully loaded.


<code>
onClipEvent (enterFrame) {
var t = this.getBytesTotal ();
var l = this.getBytesLoaded ();
if(IsNan(Math.round ((l / t) * 100))){
percent = "";
}else{
percent = "loading " + Math.round ((l / t) * 100) + "%";
}
clipname = String(this);
clipnameNew = clipname.substring(0,clipname.lastIndexOf(".empty" ));
//mypercent = eval(clipnameNew + ".percentage");
// returns _level0.pattern.clip2.empty
indexClip = clipname.substring(20,21);
if(percent >=1){
set(clipnameNew + ".percentage", percent);
}else{
set(clipnameNew + ".percentage", "");
}
if(Math.round ((l / t) * 100) == 100){
set("_global.enlargeIt" + indexClip, "true");
set(clipnameNew + ".percentage", "");
}
}
</code>
__________________
  Reply With Quote
Old 17-12-2004, 20:46   #2 (permalink)
fly
Registered User
 
fly's Avatar
 
Join Date: Mar 2004
Location: London, England
Posts: 7
Send a message via AIM to fly Send a message via MSN to fly
Easiest thing is to set a variable to true the first time the function is called, and the function checks to see if it's true before running any code within itself.

Ideally, you'd use a slightly newer way of coding actionscript, using a MovieClipLoader object and its init callback to run the bounce code when it's fully loaded...
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8