Share Posted April 1, 2009 Hi there, I have created a Flex project and I want use the transform manager but I have a probleme when I have tried to move object. var manager:TransformManager = new TransformManager(); // instance a new mxml canvas object var cont:IObject = new SimpleCanvas() as IObject; anotherCanvas.addChild(cont as DisplayObject); manager.addItem(cont as DisplayObject); The simpleCanvas (an image in my example) is displayed but when a event occurs : (matrix is null) public static function getDirectionX($m:Matrix):Number { var sx:Number = Math.sqrt($m.a * $m.a + $m.b * $m.; Main Thread (Suspended: TypeError: Error #1009: Cannot access a property or method of a null object reference.) gs.transform.utils::MatrixTools$/getDirectionX gs.transform::TransformManager/renderSelection gs.transform::TransformManager/setOrigin gs.transform::TransformManager/centerOrigin gs.transform::TransformManager/updateSelection gs.transform::TransformManager/onSelectItem flash.events::EventDispatcher/dispatchEventFunction [no source] flash.events::EventDispatcher/dispatchEvent [no source] gs.transform::TransformItem/set selected gs.transform::TransformManager/onMouseDownItem flash.events::EventDispatcher/dispatchEventFunction [no source] flash.events::EventDispatcher/dispatchEvent [no source] gs.transform::TransformItem/onMouseDown Any help will be really appreciate Thanks Link to comment Share on other sites More sharing options...
Share Posted April 1, 2009 It sounds like your SimpleCanvas isn't actually a DisplayObject. All DisplayObjects have a "transform.matrix" property which is necessary for TransformManager to do its work. Link to comment Share on other sites More sharing options...
Author Share Posted April 1, 2009 Hum, but my SimpleCanvas is a mxml canvas : and when I read the canvas documentation, the Inheritance tree show me that DisplayObject is present. http://livedocs.adobe.com/flex/3/langre ... anvas.html To be sure, I make the previous test without any cast (IObject) var manager:TransformManager = new TransformManager(); // instance a new mxml canvas object var cont:DisplayObject = new SimpleCanvas(); anotherCanvas.addChild(cont); manager.addItem(cont); The problem persists. Thanks Link to comment Share on other sites More sharing options...
Share Posted April 1, 2009 I wonder if it's another bug in the Flex framework. There are tons of them (acknowledged by Adobe). Have you tried tracing cont.transform.matrix? Is it null? If so, I'm almost positive that's a Flex bug. Link to comment Share on other sites More sharing options...
Author Share Posted April 3, 2009 cont.transform.matrix is always null. But matrix3D is set ! If the matrix property is set to a value (not null), the matrix3D property is null. And if the matrix3D property is set to a value (not null), the matrix property is null. For all three-dimensional objects, a Matrix3D object is created automatically when you assign a z value to a display object. I have removed a property on my mxml and now it's works !! Thanks for your help Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now