As a note, I'm also getting a #1009 Null Object Reference error when I run this application as it is above.
Here is the complete error message:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at AwayAS/initEngine()[C:\Users\root\Adobe Flash Builder 4.6\AwayMXML\src\AwayAS.as:27]
at AwayAS()[C:\Users\root\Adobe Flash Builder 4.6\AwayMXML\src\AwayAS.as:17]
at SphereDemo()[C:\Users\root\Adobe Flash Builder 4.6\AwayMXML\src\SphereDemo.as:8]
at AwayMXML()[C:\Users\root\Adobe Flash Builder 4.6\AwayMXML\src\AwayMXML.mxml:12]
at mx.managers.systemClasses::ChildManager/initializeTopLevelWindow()[E:\dev\4.y\frameworks\ projects\framework\src\mx\managers\systemClasses\ChildManager.as:311]
at mx.managers::SystemManager/initializeTopLevelWindow()[E:\dev\4.y\frameworks\projects\fram ework\src\mx\managers\SystemManager.as:3057]
at mx.preloaders::Preloader/timerHandler()[E:\dev\4.y\frameworks\projects\framework\src\mx\p reloaders\Preloader.as:542]
and here is the new mxml code:
<?xml version="1.0" encoding="utf-8"?>
<!-- Place non-visual elements (e.g., services, value objects) here -->
public var mySphere:SphereDemo = new SphereDemo();
public function runMe():void
addChild(mySphere as DisplayObject);
it appears by the error 1009 that the mxml problem is with line 12 "public var mySphere:SphereDemo = new SphereDemo();"
This tutorial is several years old but it's still relevant as Adobe has just released Away Builder as part of its Gaming SDK using AwayBuilder-dot-com's toolset.
It appears by the error 1009 that the mxml problem is with line 12 "public var mySphere:SphereDemo = new SphereDemo();"
No, the error is at C:\Users\root\Adobe Flash Builder 4.6\AwayMXML\src\AwayAS.as line 27.
There is a problem in the AwayAS.as code.
Thanks for replying. You're right I am by no means experienced in Flex/Flash Builder but it should seem strange that the same exact code can compile and run as an ActionScript Project but not as a Flex Project using mxml. Don't you find that puzzling?
1 person found this helpful
It's surprising, but there can be any number of reasons.
I was surprised that you weren't able to interpret the stack trace to see where the error was.
The debugger is your friend.
I've used the debugger in previous scenarios with varying degrees of success, sometimes great success. However this time I wasn't quite sure where to begin since I thought my code for mxml was all screwed up. And the debugger as I just ran it actually did tell me that I couldn't use addChild and I had to use addElement instead. But that fix of code didn't solve other bugs that popped up at which I am stumped at the moment. Perhaps I will find a solution online to the problem after using addElement(mySphere as IVisualElement). I also imported all of the classes that were in the original as document with the exception of the Sphere class. I thought I wouldn't have to import that since code-completion popped up when trying to add and type (type as in kind, not type with the keyboard) the Sphere variable.
I think this is a bad way to try and understand how MXML works.
Get used to working with MXML, then look at this project once you understand what is going on.
Just getting it to compile is no guarantee of success - as you have found.