You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

viewinz

Intermediate

  • "viewinz" started this thread

Posts: 145

Location: Wellington, New Zealand

Occupation: Trying to build an entire walkthrough of NZ for tourists

  • Send private message

1

Friday, August 14th 2009, 6:24am

Error:1009 simple actionscript problem I think!

Hi,

I'm trying impliment a simple map viewer I've aquired, that has some nice effects over and above the google map plug in.

When I've added it to the flash CS3 example plugin to get it working I'm getting this error which is stopping me get any further.



Source code

1
2
3
4
TypeError: Error #1009: Cannot access a property or method of a null object reference.
	at flashcs3exampleplugin1_fla::OokMapViewer_81/addEventListeners()
	at flashcs3exampleplugin1_fla::OokMapViewer_81/init()
	at flashcs3exampleplugin1_fla::OokMapViewer_81/frame1()


It seems to be something to do with the 'addEventListeners().

It's probably something quite obvious, anyone got any ideas?


Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
stop();

//Stop the main timeline.
var castedRoot:MovieClip = MovieClip(root);//Cast the root to stop the timeline until all assets are loaded
castedRoot.stop();//Stop at the first frame

import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.events.MouseEvent;
import flash.display.MovieClip;
import flash.ui.Keyboard;
import flash.ui.Mouse;
import flash.filters.DropShadowFilter;
import krpano_as3_interface;

// create krpano as3 interface object - krpano
var krpano:krpano_as3_interface = krpano_as3_interface.getInstance();



const KEY_X:uint = 88;
const KEY_Z:uint = 90;

//Keyboard map direction flags
var goingLeft:Boolean = false;
var goingRight:Boolean = false;
var goingUp:Boolean = false;
var goingDown:Boolean = false;

//Keyboard map scrolling speed and home easing speed
var movingSpeed:Number = 15;
var easingSpeed:Number = .2;//Speed of easing to home
var easingToHome:Boolean = false;

//Maximum and minimum zoomable levels
var maxZoom:Number = 2;//Maximum zoom level
var minZoom:Number = .5;//Minimum zoom level
var zoomStep:Number = .02;//Zoom value for each of the mouse wheel scroll
var defaultZoomLevel:Number = 1; //Set startup map scale heres
var zoomingIn:Boolean = false;
var zoomingOut:Boolean = false;

//Store radian
var adjustToPreviousRadian:Number = 0;
var rotateMap:Boolean = false;
var northAngle:Number;

//Home and map Filter
var dropShadowFilter:DropShadowFilter = new DropShadowFilter(4, 45, 0, .2, 8, 8);
var filterArray:Array = [dropShadowFilter];

//Create new map
var map:Map = new Map();
//map.filters = filterArray;//Apply filter to the map (for fast CPU)
var home:Home = new Home();
//home.filters = filterArray;//Apply filter to the home (for fast CPU)
var target:Point;

//Compass
var compass:Compass = new Compass();

//Hide Map viewer frame, set to 1 if you want to display the frame
body.alpha = 1;//Set 0 to hide it, you still can rotate the map

//initiate program
init();

function init():void {
	
	//Add all neccessary event listeners
	addEventListeners();

	//Create mask for compass
	var compassMask = new Mask();
	
	glass.doubleClickEnabled = true;
	
...


There is a lot more here but the error seems to be coming from the init(); function

2

Friday, August 14th 2009, 5:17pm

I'm guessing the problem is because you are using addEventListeners() without an object reference. If I'm not mistaken, you add an event listener to a display object - like a button or text field object, or a display object container - like the stage or a movie clip, or root...

nelk

Intermediate

Posts: 358

Location: Paris

  • Send private message

3

Saturday, August 15th 2009, 4:23pm

viewinz, show us the content of addEventListeners function

michael360, you mix up addEventListeners and addEventListener (without the s). addEventListeners is probably a personnal function.
VideoStitch, a video stitching engine / blog sur les visites virtuelles ( french ).

4

Sunday, August 16th 2009, 12:26am

Oops! *rolleyes*