Need Help Adobe Air
publish TypeError: Error #1009: Cannot access a property or method of a null object reference.
at whatupdogversionknn_fla::MainTimeline/fl_SwipeHandler_2()[whatupdogversionknn_fla.MainTimeline::frame2:57]
at runtime::ContentPlayer/simulationSendGestureEvent()
at runtime::SimulatedContentPlayer/clientSocketDataHandler() pop out
i don't know where goes wrong my code are here
<frame 1>
stop();
NativeApplication.nativeApplication.addEventListener(KeyboardEvent.KEY_DOWN, checkKeypress);
//array for nav tracking
var navArray:Array = [];
function checkKeypress(event: KeyboardEvent): void {
switch (event.keyCode) {
case Keyboard.BACK:
event.preventDefault();
trace("Back key is pressed.");
//trace(navArray.pop());
if(navArray.length > 0){
gotoAndStop(navArray.pop());
}
break;
}
trace("navArray = " + navArray);
}
var page:int = 0;
var upperLimit:int = 4;
var lowerLimit:int = 0;
Multitouch.inputMode = MultitouchInputMode.GESTURE;
stage.addEventListener (TransformGestureEvent.GESTURE_SWIPE, fl_SwipeHandler_2);
function fl_SwipeHandler_2(event:TransformGestureEvent):void
{
switch(event.offsetX)
{
// swiped right
case 1:
{
// Start your custom code
// This example code moves the selected object 20 pixels to the right.
// go to previous page
if (page > lowerLimit) { // 1, 2, 3, 4, 5
page--; // page -= 1;
dog_mc.addEventListener(Event.ENTER_FRAME, right);
}
// End your custom code
break;
}
// swiped left
case -1:
{
// Start your custom code
// This example code moves the selected object 20 pixels to the left.
// go to next page
if (page < upperLimit) { // 4, 3, 2, 1
page++; // page += 1;
dog_mc.addEventListener(Event.ENTER_FRAME, left);
}
// End your custom code
break;
}
} // end switch
//trace(page);
//whiteDot_mc.x = (page * 14) + 205;
} // end function
function left(e:Event):void {
dog_mc.x -= 65;
trace(dog_mc.x);
if (dog_mc.x < -610 * page) {
trace("done");
dog_mc.x = -610* page;
trace(dog_mc.x);
dog_mc.removeEventListener(Event.ENTER_FRAME, left);
}
}
function right(e:Event):void {
dog_mc.x += 65;
trace(dog_mc.x);
if (dog_mc.x > -610 * page) {
trace("done");
dog_mc.x = -610 * page;
trace(dog_mc.x);
dog_mc.removeEventListener(Event.ENTER_FRAME, right);
}
}
dog_mc.gershep_mc.addEventListener(MouseEvent.CLICK, gotoGerman);
function gotoGerman(e:MouseEvent):void
{
navArray.push(currentFrame);
gotoAndStop('germanfact');
}
<frame 11>
/* Swipe Event
Swiping the stage executes a function containing your custom code. You can use this event to scroll text in a TextField or change states in your application.
Instructions:
1. Add your custom code on a new line after the lines that say "// Start your custom code" below.
*/
stop();
var pg:int = 0;
var lastPg:int = 3;
var firstPg:int = 0
var swipeSpeed:int = 50;
Multitouch.inputMode = MultitouchInputMode.GESTURE;
stage.addEventListener (TransformGestureEvent.GESTURE_SWIPE, fl_SwipeHandler);
function fl_SwipeHandler(event:TransformGestureEvent):void {
switch(event.offsetX) {
// swiped right
case 1: {
// Start your custom code
if (pg > firstPg) {
pg--;
germanfact_mc.addEventListener(Event.ENTER_FRAME, germanRight);
}
// End your custom code
break;
}
// swiped left
case -1: {
// Start your custom code
if (pg < lastPg) {
pg++;
germanfact_mc.addEventListener(Event.ENTER_FRAME, germanLeft);
}
// End your custom code
break;
}
}
dot_mc.x = (pg * 6) + 270;
trace(pg);
}
function germanLeft(e:Event):void {
germanfact_mc.x -= swipeSpeed;
if (germanfact_mc.x < pg * -610) {
germanfact_mc.x = pg * -610;
germanfact_mc.removeEventListener(Event.ENTER_FRAME, germanLeft);
}
}
function germanRight(e:Event):void {
germanfact_mc.x += swipeSpeed;
if (germanfact_mc.x > pg * -610) {
navArray.push(currentFrame);
germanfact_mc.x = pg * -610;
germanfact_mc.removeEventListener(Event.ENTER_FRAME, germanRight);
}
}
