I completely understand OO concepts like Classes, Instances, Inheritance and so forth.What I don't understand is AS3 syntax. ie, how to make a simple example of a SimpleButton in AS. Its not a matter of whether I can use a Button instead, I know I can do that, I'm trying to figure out a SimpleButton.
Battershall, Jeff wrote: > > Let's keep it simple. Just importing mx.controls.Button isn't going to > make the statement new SimpleButton() return anything BUT an instance of > SimpleButton. > > My advice: skip SimpleButton. Replace SimpleButton with Button. It will > work. > > What you're having problems with is basic OO stuff, not Flex/Flash. I'd > spend some time getting more facile with OO concepts like Classes, > Instances, Inheritance and so forth. Then you'll have an easier time. > > Jeff > > -----Original Message----- > From: [email protected] <mailto:flexcoders%40yahoogroups.com> > [mailto:[email protected] > <mailto:flexcoders%40yahoogroups.com>] On > Behalf Of [EMAIL PROTECTED] <mailto:info1%40reenie.org> > Sent: Tuesday, October 23, 2007 1:25 PM > To: [email protected] <mailto:flexcoders%40yahoogroups.com> > Subject: Re: [flexcoders] Simple SimpleButton 2nd try > > 1) I don't understand what you mean because the code below says " import > > mx.controls.Button" NOT "OT flash.display.SimpleButton" > > 2) I really really wish I could find something to study, I've got half > dozen books and I look at the language ref all the time but ther seems > to be a rule against simple examples that make any sense. For example, > there is no simple example of a SimpleButton on the SimpleButton page. > Not even close. > > Battershall, Jeff wrote: > > > > Hello?! If the code you're prsenting is what you're doing, you're > > still doing the same thing. You need to import mx.controls.Button and > > add THAT, NOT flash.display.SimpleButton. > > > > new SimpleButton() gives you an instance of SimpleButton not an > > instance of Button. Button will work with addChild, but SimpleButton > > will not. > > > > I think you need to spend a little time studying the inheritance > > heirarchy of Flex vs. Flash. You are trying to unsucessfully co-mingle > > > them. > > > > Jeff > > > > -----Original Message----- > > From: [email protected] > <mailto:flexcoders%40yahoogroups.com> > <mailto:flexcoders%40yahoogroups.com> > > [mailto:[email protected] > <mailto:flexcoders%40yahoogroups.com> > > <mailto:flexcoders%40yahoogroups.com>] On > > Behalf Of [EMAIL PROTECTED] <mailto:info1%40reenie.org> > <mailto:info1%40reenie.org> > > Sent: Tuesday, October 23, 2007 1:10 PM > > To: [email protected] <mailto:flexcoders%40yahoogroups.com> > <mailto:flexcoders%40yahoogroups.com> > > Subject: Re: [flexcoders] Simple SimpleButton 2nd try > > > > Thanks for your reply > > I tried that and I get the same error > > TypeError: Error #1034: Type Coercion failed: cannot convert > > flash.display::[EMAIL PROTECTED] to mx.core.IUIComponent. <?xml > > version="1.0"?> <mx:Application > > xmlns:mx="http://www.adobe.com/2006/mxml > <http://www.adobe.com/2006/mxml> > > <http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml>>" > creationComplete="onComplete()"> > > <mx:Script> > > <![CDATA[ > > > > import mx.controls.Button > > public function onComplete():void > > { > > var newButton:SimpleButton = new SimpleButton(); > > this.addChild(newButton); } > > > > > > ]]> > > </mx:Script> > > </mx:Application> > > Battershall, Jeff wrote: > > > > > > I think you want to add mx.controls.Button which inherits from > > > UIComponent vs. flash.display.SimpleButton, which does not. You're > > > kinda confusing the Flex framework with the Flash Player API. > > > > > > Jeff > > > > > > -----Original Message----- > > > From: [email protected] <mailto:flexcoders%40yahoogroups.com> > > <mailto:flexcoders%40yahoogroups.com> > > <mailto:flexcoders%40yahoogroups.com> > > > [mailto:[email protected] > <mailto:flexcoders%40yahoogroups.com> > > <mailto:flexcoders%40yahoogroups.com> > > > <mailto:flexcoders%40yahoogroups.com>] On > > > Behalf Of [EMAIL PROTECTED] <mailto:info1%40reenie.org> > <mailto:info1%40reenie.org> > > <mailto:info1%40reenie.org> > > > Sent: Tuesday, October 23, 2007 12:45 PM > > > To: [email protected] > <mailto:flexcoders%40yahoogroups.com> > <mailto:flexcoders%40yahoogroups.com> > > <mailto:flexcoders%40yahoogroups.com> > > > Subject: [flexcoders] Simple SimpleButton 2nd try > > > > > > Please ignore the first post, this has a correction > > > > > > How do I add the button to the application? > > > addChild does not seem to be available > > > this->addChild( > > > > > > newButton); and addChild(newButton) both produce > > > TypeError: Error #1034: Type Coercion failed: cannot convert > > > flash.display::[EMAIL PROTECTED] to mx.core.IUIComponent. > > > > > > <?xml version="1.0"?> > > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml > <http://www.adobe.com/2006/mxml> > > <http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml>> > > > <http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> > <http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml>>> > > > <http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> > <http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml>> > > <http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> > <http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml>>>>" > > > creationComplete="onComplete()"> > > > <mx:Script> <
