-
AS2 Preloader Migrated to AS3???
Hey I am really new to Flash and what little I do know is all AS3. I bought a preloader off of istockphoto.com and unfortunately found that all the code was in AS2, therefor I am unable to implement it into my site because my site is all done in AS3. Is there anyone who could help me migrate this code from AS2 to AS3? I was told I could just copy and paste this into the first frame of my timeline...
var cnt:Number = 0;
_root.onEnterFrame = function() {
if (!_root.ISTOCKDEMO) {
ttl = _root.getBytesTotal();
ldd = _root.getBytesLoaded();
prcnt = Math.round((ldd*100)/ttl);
txt.text = prcnt+"%";
if (prcnt>99) {
_root.play();
delete onEnterFrame;
}
} else {
if (cnt<100) {
txt.text = int(cnt += .3)+"%";
}
}
};
stop();
-
i don't see where ISTOCKDEMO is defined, so i'll leave that out and just see if it's loaded..
PHP Code:
var cnt:Number = 0; function checkLoaded(event:Event):void{ var ttl:Number = loaderInfo.bytesTotal; var ldd:Number = loaderInfo.bytesLoaded; var prcnt:Number = Math.round((ldd*100)/ttl); txt.text = prcnt+"%"; if (prcnt>99) { play(); removeEventListener(event.type, arguments.callee); } else { if (cnt<100) { txt.text = int(cnt += .3)+"%"; } } } addEventListener("enterFrame", checkLoaded); stop();
-
Thanks!
Hey thanks a lot! Everything seemed to work well but there seems to be something going on with the Event class in the checkLoaded function. I am getting this error message...
The class or interface 'Event' could not be loaded. I am not sure why this would be happening.
-
if it's a frame script, you shouldn't need to import... should be fine...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|