Thanks very much for responding Gordon, I appreciate your's and Matt's time.
Why AS3? Comfort zone I guess. I'm coming from a Java background. I'm investigating the feasibility of creating an Eclipse like plug-in framework for adding new screens and functionality that extend a solid framework core. The aim? Having our P/S people being able to added customer-specific screens and functionality and so on into a standardized production framework without having to jump through Struts/JSP/EJB/deployment hoops. I'm pretty familiar with Eclipse having some plug in work there and I guess that model is my starting point. I'll look further into the XMXL side while I investigate. Thanks. Greg. PS. If such an architecture already exists for Flex, then do tell! Greg McCreath Chief Technical Officer TAFMO Limited ABN: 94 109 766 592 Level 8, 342 Flinders Street Melbourne Victoria, 3000 Australia http://www.tafmo.com Ph <http://www.tafmo.comPh> : +61 (0) 3 9018 6824 Fax : +61 (0) 3 9018 6899 Mobile : +61 (0) 401 988 957 _____ From: Gordon Smith [mailto:[EMAIL PROTECTED] Sent: Friday, 17 November 2006 3:24 PM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] Newbie: Why can't I add a button! Sorry, although we've made it easy to write components in either MXML or AS3, we haven't done the same with Application. If you are a newbie you should start out with <mx:Application> in MXML. You can then use AS3 for all your components if you really want to. I hope we can make this better in a future release. What's going on is that when the MXML compiler compiles an <mx:Application> it autogenerates code to set up a lot of stuff such as the default CSS type selectors that various components like Button depend on. These aren't getting set up when you simply extend Application as an AS3 class. When Button calls getStyle() to find out what it's skin class should be, it's getting a null Clas reference. Once you are no longer a newbie, you can use mxmlc's -keep-generated-actionscript option to see all the generated code, and set this stuff up yourself it you insist. But I really don't understand why some developers like AS3 so much better tham MXML. Would you write a web app all in JS and no HTML? - Gordon _____ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of bookymcnuggett Sent: Thursday, November 16, 2006 5:49 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Newbie: Why can't I add a button! Hi All, This is my first posting to this forum. I have taken my first newbie steps to creating a stand-alone AS3 Application and have come across something I cannot understand. I have an Application, and add an Image to it and it is fine. I add a Button to it and it blows up with the AS3 equivalent of a null pointer exception. The code is below. The error is below that. If I comment out the line that does the "addChild(button)" it correctly adds and displays the Image. What am I doing wrong? What is wrong with how I am adding a button? Both Button and Image descend from UIComponent. package { import mx.core.*; import mx.events.*; import mx.skins.halo.*; import mx.styles.*; import mx.controls.*; import flash.display.*; public class FirstApp extends Application { [Embed(source="connected_multiple_big.jpg")] private var ImageClass:Class; public function FirstApp() { super(); this.layout = "vertical"; this.setStyle("borderSkin",mx.skins.halo.HaloBorder); this.addEventListener(FlexEvent.APPLICATION_COMPLETE, doInit); } private function doInit(e:FlexEvent):void { var img:Image = new Image(); img.setStyle("verticalAlign","top"); img.source = ImageClass; addChild(img); // the troublesome test button. addChild() here causes a null object reference exception var button:Button = new Button(); button.label = "label"; addChild(button); } } } /// **************************** TypeError: Error #1009: Cannot access a property or method of a null object reference. at mx.core::UIComponent/getStyle() at mx.controls::Button/http://www.adobe.com/2006/flex/mx/internal::viewS <http://www.adobe.com/2006/flex/mx/internal::viewS> kinForPhase() at mx.controls::Button/http://www.adobe.com/2006/flex/mx/internal::viewS <http://www.adobe.com/2006/flex/mx/internal::viewS> kin() at mx.controls::Button/mx.controls:Button::commitProperties() at mx.core::UIComponent/validateProperties() at mx.managers::LayoutManager/::validateProperties() at mx.managers::LayoutManager/::doPhasedInstantiation() at Function/http://adobe.com/AS3/2006/builtin::apply <http://adobe.com/AS3/2006/builtin::apply> () at mx.core::UIComponent/::callLaterDispatcher2() at mx.core::UIComponent/::callLaterDispatcher() at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchE ventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.managers::SystemManager/::preloader_preloaderDoneHandler() at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchE ventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.preloaders::Preloader/::displayClassCompleteHandler() at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchE ventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.preloaders::DownloadProgressBar/::timerHandler() at mx.preloaders::DownloadProgressBar/::initCompleteHandler() at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchE ventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.preloaders::Preloader/::dispatchAppEndEvent() at mx.preloaders::Preloader/::appCreationCompleteHandler() at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchE ventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.core::UIComponent/set initialized() at mx.managers::LayoutManager/::doPhasedInstantiation() at Function/http://adobe.com/AS3/2006/builtin::apply <http://adobe.com/AS3/2006/builtin::apply> () at mx.core::UIComponent/::callLaterDispatcher2() at mx.core::UIComponent/::callLaterDispatcher() This email and any files transmitted with it may be confidential and are intended solely for the use of the individual or entity to whom they are addressed. This email may contain personal information of individuals, and be subject to Commonwealth and/or State privacy laws in Australia. This email is also subject to copyright. If you are not the intended recipient, you must not read, print, store, copy, forward or use this email for any reason, in accordance with privacy and copyright laws. If you have received this email in error, please notify the sender by return email, and delete this email from your inbox.