Jump to content
GreenSock

timaging

self loader not working in my project?

Recommended Posts

Hi,

 

I just tried putting this on frame 1 of my project:

import com.greensock.loading.*;
import com.greensock.events.LoaderEvent;
import com.greensock.loading.display.*;


stop();
var loader:SelfLoader = new SelfLoader(this, {onProgress:progressHandler, onComplete:completeHandler});
function progressHandler(event:LoaderEvent):void {
   progressBar.scaleX = event.target.progress;
}
function progressHandler(event:LoaderEvent):void {
   myTextField.text = int( loader.progress * 100 ) + "%";
}
function completeHandler(event:LoaderEvent):void {
 this.gotoAndPlay(2)
}

 

but when it goes to frame 2, which also has stop();, it goes nutty.

http://www.taylorimaging.com/clientArea/10-PER-049/10-PER-049_LoG.html

 

any ideas would be greatly appreciated. I appear to have everything named correctly, and I've even tried gotoAndStop for the second function, but that doesn't hold it.

Link to comment
Share on other sites

I should also mention that if I remove the loader altogether, the project works fine, but I definitely need the loader.

 

thanks!

Dave

Link to comment
Share on other sites

Hi there-

 

I did try that.

 

I also found that if I removed the text percentage information that it started to work, although I'd like to have that.

 

thanks,

Dave

Link to comment
Share on other sites

I don't see any obvious errors - there must be something else going on in your file. I'd need to see it and be able to publish it myself to effectively troubleshoot. It sure looks like it's getting caught in a loop between frame 1 and 2, but gotoAndStop(2) should have fixed that unless you have some other action on frame 2 that is subsequently making it play().

Link to comment
Share on other sites

Hi There-

 

I opened this file in a different version of Flash and got an error on this line saying it was a Duplicate Function Definition:

 

function progressHandler(event:LoaderEvent):void {
   myTextField.text = int( loader.progress * 100 ) + "%";
}

 

Taking this out worked, but I kinda wanted to try and use it.

Link to comment
Share on other sites

You must of declared a progressHandler() function multiple times on your timeline (could be on frame 1 and then on frame 2). Just make sure you name them differently and you'll be fine.

Link to comment
Share on other sites

definitely no progressHandler there either:

 

import com.greensock.*;
import com.greensock.easing.*;
import com.greensock.plugins.*;
TweenPlugin.activate([blurFilterPlugin, MotionBlurPlugin]);
import com.greensock.text.SplitTextField;


OverwriteManager.init()

var allClips:Array = [text01, text02, bar, woody_700color_01, woody_700color_02, FordColor700w, modelA_Aged, woody_Aged, woody_Color, challengerLG01, challengerLG02, challengerLG03];
TweenMax.allTo(allClips, 0, {alpha:0, blurFilter:{blurX:20, blurY:20}});

var yourtimeline:TimelineMax = new
TimelineMax({repeat:0,onComplete:myFunction});

yourtimeline.insert(new TweenLite(modelA_Aged, 8, {x:-310, y:-260, alpha:1, ease:Quad.easeInOut, blurFilter:{blurX:0, blurY:0}}));
yourtimeline.insert(new TweenLite(FordColor700w, 3, {alpha:1, ease:Quad.easeInOut, blurFilter:{blurX:0, blurY:0}, delay:7}));

yourtimeline.insert(new TweenLite(woody_Aged, 0.1, {alpha:1, ease:Quad.easeInOut, blurFilter:{blurX:0, blurY:0}, delay:11}));
yourtimeline.insert(new TweenLite(woody_Aged, 1, {x:"-20", y:"0", alpha:0, ease:Quad.easeInOut, blurFilter:{blurX:10, blurY:10}, delay:11.1}));

yourtimeline.insert(new TweenLite(woody_Aged, 0.1, {alpha:1, ease:Quad.easeInOut, blurFilter:{blurX:0, blurY:0}, delay:11.5}));
yourtimeline.insert(new TweenLite(woody_Aged, 1, {x:"-20", y:"-20", alpha:0, ease:Quad.easeInOut, blurFilter:{blurX:10, blurY:10}, delay:11.6}));

yourtimeline.insert(new TweenLite(woody_Aged, 0.1, {alpha:1, ease:Quad.easeInOut, blurFilter:{blurX:0, blurY:0}, delay:12}));
yourtimeline.insert(new TweenLite(woody_Aged, 1, {x:"-20", y:"0", alpha:0, ease:Quad.easeInOut, blurFilter:{blurX:10, blurY:10}, delay:12.1}));

yourtimeline.insert(new TweenLite(woody_Aged, 0.1, {alpha:1, ease:Quad.easeInOut, blurFilter:{blurX:0, blurY:0}, delay:12.5}));
yourtimeline.insert(new TweenLite(woody_Aged, 6, {x:"-400", y:"-400", alpha:1, ease:Quad.easeInOut, blurFilter:{blurX:10, blurY:10}, delay:13.1}));

yourtimeline.insert(new TweenLite(woody_700color_02, 2, {alpha:1, ease:Quad.easeInOut, blurFilter:{blurX:0, blurY:0}, delay:14}));
yourtimeline.insert(new TweenLite(woody_700color_01, 2, {alpha:1, ease:Quad.easeInOut, blurFilter:{blurX:0, blurY:0}, delay:15.5}));

yourtimeline.insert(new TweenLite(challenger, 1, {ease:Quad.easeInOut, blurFilter:{blurX:50, blurY:50}, delay:18}));

yourtimeline.insert(new TweenLite(challengerLG01, 4, {x:-8, ease:Quad.easeInOut, blurFilter:{blurX:0, blurY:0}, delay:19}));
yourtimeline.insert(new TweenLite(challengerLG01, 2, {alpha:1, delay:19}));
yourtimeline.insert(new TweenLite(challengerLG01, 2, {alpha:0, delay:21}));

yourtimeline.insert(new TweenLite(challengerLG02, 4, {y:-330, ease:Quad.easeInOut, blurFilter:{blurX:0, blurY:0}, delay:22}));
yourtimeline.insert(new TweenLite(challengerLG02, 2, {alpha:1, delay:22}));
yourtimeline.insert(new TweenLite(challengerLG02, 2, {alpha:0, delay:24}));

yourtimeline.insert(new TweenLite(challengerLG03, 4, {x:-350, ease:Quad.easeInOut, blurFilter:{blurX:0, blurY:0}, delay:25}));
yourtimeline.insert(new TweenLite(challengerLG03, 2, {alpha:1, delay:25}));
yourtimeline.insert(new TweenLite(challengerLG03, 2, {alpha:0, delay:27}));

yourtimeline.insert(new TweenLite(bar, 2, {alpha:1, y:"-20", ease:Quad.easeInOut, blurFilter:{blurX:0, blurY:0}, delay:29}));
yourtimeline.insert(new TweenLite(text01, 1, {alpha:1, ease:Quad.easeInOut, blurFilter:{blurX:0, blurY:0}, delay:30}));
yourtimeline.insert(new TweenLite(text02, 1, {alpha:1, ease:Quad.easeInOut, blurFilter:{blurX:0, blurY:0}, delay:31}));


function myFunction():void {
      yourtimeline.stop();
}


stop();

Link to comment
Share on other sites

Hey ya mate,

 

Based on your first post, why do you have 2 progressHandlers in there?

 

function progressHandler(event:LoaderEvent):void {
   progressBar.scaleX = event.target.progress;
}
function progressHandler(event:LoaderEvent):void {
   myTextField.text = int( loader.progress * 100 ) + "%";
}

 

You can put the myTextField.text change in the first progressHandler and ditch the second all together.

Link to comment
Share on other sites

thanks! this appears to have done the trick-

 

Dave

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.
×