I really have no clue what’s wrong with this =( I’m sure it worked a few weeks ago, and I don’t even remember changing the code after it worked, but now it keeps popping up a 1009 error: Cannot access a property or method of a null object reference. This is driving me nuts >< Please help.
import gs.TweenLite;
import gs.easing.*;
var section:Loader = new Loader();
section.load(new URLRequest("Ripple Actions.swf"));
section.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loadingContent);
section.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
function loadingContent(event:ProgressEvent):void {
var loaded:Number = event.bytesLoaded / event.bytesTotal;
var bytesLoad:String = event.bytesLoaded.toString();
var bytesT:String = event.bytesTotal.toString();
//preloader.SetProgress(loaded);
}
function loadComplete(event:Event):void {
content_mc.addChild(section);
}
The code for the swf being called is pretty simple, not sure why it won’t work.
var mouseXPos:uint = 0;
var mouseYPos:uint = 0;
Main();
function Main():void {
stage.addEventListener(MouseEvent.CLICK, mousePos);
stage.addEventListener(MouseEvent.CLICK, scaleCircle);
stage.addEventListener(MouseEvent.CLICK, ripple);
}
function mousePos (event:MouseEvent):void {
mouseXPos = mouseX;
mouseYPos = mouseY;
trace (mouseXPos);
trace (mouseYPos);
}
function ripple (event:MouseEvent):void {
var rippleDelay:Timer = new Timer(450, 6);
rippleDelay.addEventListener(TimerEvent.TIMER, scaleCircle);
rippleDelay.start();
}
function scaleCircle (event:Event):void {
var newCircle:Ripple = new Ripple();
this.addChild(newCircle);
newCircle.x = mouseXPos;
newCircle.y = mouseYPos;
newCircle.scaleX = 0.01;
newCircle.scaleY = 0.01;
newCircle.alpha = .8;
newCircle.addEventListener(Event.ENTER_FRAME,ZoomCircle);
}
function ZoomCircle(event:Event):void {
var circleMc:MovieClip = MovieClip(event.target);
circleMc.scaleX += .05;
circleMc.scaleY += .05;
if (circleMc.scaleX <= 0.5) {
circleMc.alpha += .03;
}
else {
circleMc.alpha -= .01;
}
if (circleMc.alpha <= 0) {
circleMc.removeEventListener(Event.ENTER_FRAME, ZoomCircle);
}
}