Jump to content
Search Community

Export to Frame 2 - preload / tweening problems

carlosfandang test
Moderator Tag

Recommended Posts

Hi,

 

Forgive my stupidity, but I'm having problems with running my tweens in frame 2 after a preload. I'm using AS3 so PreloadAssetManager is not really for me.

 

I have a number of fairly complex tweens running in separate swf's that I want to load into a parent swf. I want to make sure they have completed loading before the animation starts (which is instant) and therefore, wanted to do a preload inside the external swf's in frame1 and then goto frame2 and start the animations.

 

Frame1 action script in each file would be:

 

stop();
//Listener
addEventListener(Event.ENTER_FRAME,loading) ;
Mouse.hide(); // Mouse Hide
preloading.startDrag(true); //Drag Start
function loading(e:Event){
var loaded = Math.round(stage.loaderInfo.bytesLoaded); //Download File Size
var total = Math.round(stage.loaderInfo.bytesTotal);   //Total File Size
var getPercent = loaded/total;
preloading.txt.text = Math.round(getPercent*100);      

if (loaded == total) {  //File Download Finished Site or Project Open 2. frame
removeEventListener(Event.ENTER_FRAME,loading);
preloading.stopDrag();
Mouse.show();
gotoAndPlay(2);
}
}

 

I have the import greensock classes and all the assets on frame2, and it just won't work. I'm new at this, so just not been able to work it out, get an error #1009. Am I putting the import classes and assets in the wrong place?

 

Thanks for any help.

Link to comment
Share on other sites

Well, first of all, I'll let you in on a little secret...I'm working on an AS3 preloading system that you might find very useful. I hope to release it for beta testing very soon to Club GreenSock members. Ping me if you're interested. The system has auto integration of loaders inside subloaded swfs - you can link any loader with a swf's root so that when you subload it into another Flash application, the parent loader automatically and factors its loaders into its overall progress! With most other systems, if you subload a swf, the loader will only concern itself with the actual swf file's bytes, but what if that swf must subload other content like XML, images, and/or other swf files before it should be considered fully loaded? This system will elegantly handle the sub-subloads as deep as they go.

 

Anyway...

 

I noticed that your code is looking at the stage's loaderInfo but don't do that - the stage would refer to the parent (main swf) stage. In other words, all subloaded swfs' "stage" property would point to the same place. I think you need to use "root" instead of "stage". Aside from that, it's a bit difficult to troubleshoot without seeing the problem and poking around your files, but hopefully changing stage to root will help.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...