Hi,
I keep getting this message and can not figure out why. The greensock folder is in the com directory and there is no issue there. Here is the error msg:
-----------------------------------------------------------------
Error: Cannot tween a null object.
at com.greensock::TweenLite()[C]
at com.greensock::TweenMax()[C]
at com.greensock::TweenMax$/to()[C]
at ShapefileExample/mapOver()[C]
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at com.greensock::TweenLite/init()[C]
at com.greensock::TweenMax/init()[C]
at com.greensock::TweenMax/renderTime()[C]
at com.greensock.core::SimpleTimeline/renderTime()[C]
at com.greensock::TweenLite$/updateAll()[C]
---------------------------------------------------------------------------------
Here is my code:
package {
import com.greensock.*;
import com.cartogrammar.shp.ShpMap;
import com.cartogrammar.shp.ShpFeature;
import flash.events.Event;
import flash.display.Sprite;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.geom.ColorTransform;
[sWF(width='800', height='800', backgroundColor='#ffffff', frameRate='30')]
/**
* An example of drawing a simple map from a shapefile using my ShpMap class and Edwin van Rijkom's library.
*
* @author Andy Woodruff (cartogrammar.com/blog)
*
*/
public class ShapefileExample extends Sprite
{
private var map : ShpMap;
public function ShapefileExample()
{
map = new ShpMap("data/Zones.shp","data/Zones.dbf");//Original
map.buttonMode=true;
map.addEventListener(MouseEvent.MOUSE_OVER, mapOver);
map.addEventListener(MouseEvent.MOUSE_OUT, mapOut);
//addChild(road);
addChild(map);
map.addEventListener("map loaded",onMapLoaded);
}
// Need to wait for the map to finish loading/drawing before it can be resized correctly.
private function onMapLoaded(event:Event):void
{
map.scaleX = map.scaleY = map.width > map.height ? stage.stageWidth/map.width : stage.stageHeight/map.height;
// just for fun, add a marker to somewhere around my house!
//addMarkerAt( 9,38 );
}
function mapOver(e:MouseEvent):void{
var mapItem:MovieClip = e.target as MovieClip;
TweenMax.to(mapItem, .5, {tint:0xFF9900});
}
function mapOut(e:MouseEvent):void{
var mapItem:MovieClip = e.target as MovieClip;
trace(mapItem);
TweenMax.to(mapItem, .5, {removeTint:true});
}
}