Hi guys,
So I have a class in my sidescroller that scrolls the background whilst keeping the character in the center of the screen.
If I run the swf in Chrome or test it in Flash Pro CS6 (with my project settings set to Flash 9) the class runs fine.
However if I set my project settings to anything above Flash 9, it does not work properly in ‘test movie’ in Flash Pro CS6.
I put some traces in my WorldScroller class and anything outside of the enterFrameHandler traces perfectly no matter the version of flash. But in Flash 9 it’s as though the enterFrameHandler doesn’t exist.
The thing is, there are no error messages either at runtime or compile!
Here’s my code:
Instantiating the class and assigning objects to scroll in my DocumentMain
public function Scrolling() {
var Scroll0b:ScrollWorld2_c = new ScrollWorld2_c(Testa1, char, 0.5);
var Scrollneg1:ScrollWorld2_c = new ScrollWorld2_c(FanSteam1, char);
var Scroll0:ScrollWorld_c = new ScrollWorld_c(Static0, char);
}
My ScrollWorld class:
package classes.worldinteract {
import flash.display.MovieClip;
import flash.events.Event;
public class ScrollWorld_c extends MovieClip{
//
public var ScrollObj:MovieClip;
public var StillObj:MovieClip;
public var ScrollModY:Number
public var ScrollModX:Number
//
public function ScrollWorld_c($ScrollObj:MovieClip, $StillObj:MovieClip, $ScrollModX:Number = 1, $ScrollModY:Number = 1)
{
this.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
ScrollObj = $ScrollObj;
StillObj = $StillObj;
ScrollModX = $ScrollModX;
ScrollModY = $ScrollModY;
trace("outsideEventHandler");
}
public function enterFrameHandler(e:Event):void
{
trace("insideEventHandler);
ScrollObj.x += (550 * 0.5) - (StillObj.x);
StillObj.x = 550 * 0.5;
}
}
}
What do you guys think?