| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
|
|
#1 (permalink) |
|
mingin dawg baitch
|
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> |
|
|
|
|
|
#2 (permalink) |
|
Registered User
|
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... |
|
![]() |