AS3 Event.COMPLETE Bug

Hi

I have an AS3 preloader script but it fails in IE (both local and live), it looks like it fails to fire the Event.COMPLETE function.

Works fine on FF Safari on a mac, the only other thing is flash player version, my ie installs are currently running 10.0.45.2 and all the other browsers are running 10.1.x.x +

Could this be a bug in the Flash Player and if so is there are work around for users with 10.0 installed??

You thoughts would be much appreciated??

S
// Import Classes
//import com.greensock.*;
//import com.greensock.easing.*;
import caurina.transitions.*;
	
// Vars
var origLogoHeight:Number = preLogo.height;
var origLogoWidth:Number = preLogo.width;
var l:Loader;

// Loader

function preResizeHandler(e:Event):void
{
	positionLoader();
}

function positionLoader():void {
	preLogo.x = (stage.stageWidth / 2) - (preLogo.width / 2);
	preLogo.y = (stage.stageHeight / 2) - (preLogo.width / 2);
}



function preInit():void {
	
	this.stage.frameRate = 30;
	this.stage.showDefaultContextMenu = false;
	this.stage.scaleMode = StageScaleMode.NO_SCALE;
	this.stage.align = StageAlign.TOP_LEFT;
	this.stage.addEventListener(Event.RESIZE, preResizeHandler);
	
	
	//preLogo.strapGradient.mask = preLogo.strap;
	
	
	preLogo.strapGradient.alpha = 0;
	preLogo.strapGradient.mask = preLogo.strapMask;
	
	preLogo.letters.alpha = 0;
	
	preLogo.brackets.left.alpha = 0;
	preLogo.brackets.right.alpha = 0;
	
	preLogo.brackets.left.x = (preLogo.brackets.width / 4) - preLogo.brackets.left.width ;
	preLogo.brackets.right.x = (preLogo.brackets.width / 4);

	preLogo.percent.alpha = 0;
	preLogo.percentGradient.mask = preLogo.percent;

	preLogo.width = 100;
	preLogo.scaleY = preLogo.scaleX;
	
	preLogo.x = (stage.stageWidth / 2) - (preLogo.width / 2);
	preLogo.y = (stage.stageHeight / 2) - (preLogo.height / 2);
	
	Tweener.addTween(preLogo.brackets.left, {delay: 1.5, time:1.5, transition:"easeInOutElastic", alpha: 1, x: 0});
	Tweener.addTween(preLogo.brackets.right, {delay: 1.5, time:1.5, transition:"easeInOutElastic", alpha: 1, x: ((preLogo.brackets.width/2) - preLogo.brackets.right.width)});
	Tweener.addTween(preLogo.percent, {delay: 1, time:1.5, transition:"easeOutCirc", alpha: 1, onComplete: preInitLoad});
	
	/*
	
	// Using TweenLite

	var bracketTimeline:TimelineLite = new TimelineLite({onComplete:preInitLoad});
	bracketTimeline.insertMultiple([
		TweenLite.to(preLogo.brackets.left, 0.5, {delay: 2, alpha: 1, x: 0, ease:Circ.easeOut}),
		TweenLite.to(preLogo.brackets.right, 0.5, {delay: 2, alpha: 1, x: ((preLogo.brackets.width/2) - preLogo.brackets.right.width), ease:Circ.easeOut }),
		TweenLite.to(preLogo.percent, 1.5, {delay: 2.5, alpha: 1, ease:Circ.easeOut})
	]);
	*/
}




function preInitLoad():void {
	l = new Loader();
	//this.addChild(l);
	l.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, preLoadProgress);
	l.contentLoaderInfo.addEventListener(Event.INIT, preLoadComplete);
	l.contentLoaderInfo.addEventListener(Event.COMPLETE, preLoadComplete);
	l.load(new URLRequest("FileToLoad.swf"));
}

function preLoadProgress(e:ProgressEvent):void
{
	
	
	var perc:Number = e.bytesLoaded / e.bytesTotal;
	trace(perc*100);
	preLogo.percent.text = Math.ceil(perc*100).toString();
	
	/*
	if(e.bytesLoaded == e.bytesTotal)
		preLoadComplete();
	else
	{
	}
	*/
}


function preLoadComplete(e:Event):void
{
	
	var preLogoX:Number = (stage.stageWidth / 2) - (origLogoWidth / 2);
	var preLogoY:Number = (stage.stageHeight / 2) - (origLogoHeight / 2);
	
	Tweener.addTween(preLogo.percentGradient, {delay: 0, time:0.2, transition:"linear", alpha: 0});
	Tweener.addTween(preLogo, {x:preLogoX, y:preLogoY, width:origLogoWidth, height:origLogoHeight, delay: 0.3, time:1.5, transition:"easeInOutBack", onComplete: function() {
		Tweener.addTween(preLogo.letters, {delay: 0, time:0.7, transition:"linear", alpha: 1, onComplete: function() {
			preLogo.strapMask.x = preLogo.strapMask.x - preLogo.strapMask.width - 5;
			preLogo.strapGradient.alpha = 1;
			Tweener.addTween(preLogo.strapMask, {delay: 0.5, time:1.5, transition:"easeInOutQuad", x:-1, width:(preLogo.strapMask.width + 40)});																			
			Tweener.addTween(preLogo, {delay:2, time:3.5, transition:"easeInOutCubic", alpha: 0, onStart: preInitSite, onComplete: preLoadCleanUp});																			
		}});																			
	}});
	
	/*
	
	// Using TweenLite
	
	var preLogoTimeline:TimelineLite = new TimelineLite({onComplete:preInitSite});
	
	preLogoTimeline.append(TweenLite.to(preLogo.percent, 0.2, {alpha: 0}));
	preLogoTimeline.append(TweenLite.to(preLogo, 1.5, {x:preLogoX, y:preLogoY, width:origLogoWidth, height:origLogoHeight, ease:Back.easeInOut}));
	preLogoTimeline.append(TweenLite.to(preLogo.letters, 0.7, {alpha:1, onComplete: function() {
		preLogo.strapMask.x = preLogo.strapMask.x - preLogo.strapMask.width - 5;
		preLogo.strap.alpha = 1;
	}}));
	preLogoTimeline.append(TweenLite.to(preLogo.strapMask, 1.5, {x:-1}));
	preLogoTimeline.append(TweenLite.to(preLogo, 2, {alpha:1, ease:Back.easeInOut}));
	*/

}

function preLoadCleanUp():void {
	removeChild(preLogo);
}

function preInitSite():void {
	stage.removeEventListener(Event.RESIZE, preResizeHandler);
	addChildAt(l, 0);
}

preInit();

Open in new window

LVL 1
socrossAsked:
Who is Participating?
 
socrossConnect With a Mentor Author Commented:
Thanks for all you input guys, turns out it was entirely my fault, I had left the code from a memory profiler in the main swf file that it was loading in, it was this that was conflicting with the swfaddress / flash player combination. Got that removed and works a dream.

Thanks

S
0
 
asaivanCommented:
What are you targeting as your Flash Player version?
0
 
ChristoferDutzCommented:
I could see that you are not registering for the Error event in your loader. Therefore you will not recieve any notification upon error. As you said it work on safai/mac. Try listening for the ioError:IOErrorEvent or securityError events.

At the bottom of this page is some sample code:
http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/display/Loader.html

0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

 
socrossAuthor Commented:
Thanks for your replys.

asaivan - I am targeting version 9.0.0

ChristopherDutz - I will look into that now

s
0
 
socrossAuthor Commented:
ChristopherDutz - i dont get any IO Errors, but thats only testing through flash player, how would i test this in the browser environment?

Thanks

s
0
 
ChristoferDutzCommented:
Try the IE Developer Toolbar and have a look at what's actually loaded. Another thing I'd give a try is to load it in the Safari on the Windows machine. Perhaps you are having trouble with the security sandbox. Another option would be to install a debug version of the flash-player on the IE because that player is a real PITA when it comes to complaining about problems :-)
0
 
socrossAuthor Commented:
I get fairly lost there, is there any chance you might be able to take a look at the site:

http://tinyurl.com/32m85lp

Thanks

s
0
 
ChristoferDutzCommented:
Well I tried the url you sent me with Chrome and IE 8 and it worked like a charm ... and I would really like to spend my holidays in the carribean on that boat! ;-)
0
 
socrossAuthor Commented:
Ha, yes me too!

It does work perfectly well in most browser combinations. But it fails when on flash version 10.0.45.2, which according to stats is used by 22% of users.

What do think I should do seeing as it's the flash player that is the issue? Or is it something in my code that I need to update?

Thanks

S
0
 
ChristoferDutzCommented:
Well I doubt its a real application issue. Have you tried this combination on other systems? Perhaps only your one plugin version is broken? Unfortunately I don't have that particular version, so I can't try it :-(
0
 
socrossAuthor Commented:
Problem solved
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.