Re: [flexcoders] Simple SimpleButton 2nd try
Navigator children are Containers (only) No other is allowed. Container children are IUIComponents (only) These then may hold anything On 10/23/07, Alex Harui [EMAIL PROTECTED] wrote: We'll have to make sure the rules are more clearly documented. The rules for Flex are: Navigator children must be Containers Container children must be IUIComponents UIComponent children can be anything including Flash display objects. I swear I type those three lines once every two weeks. Anyone want to help me turn it into a haiku?
[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 creationComplete=onComplete() mx:Script ![CDATA[ import flash.display.SimpleButton public function onComplete():void { var newButton:SimpleButton = new SimpleButton(); // add child here . }
RE: [flexcoders] Simple SimpleButton 2nd try
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: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Tuesday, October 23, 2007 12:45 PM To: flexcoders@yahoogroups.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 creationComplete=onComplete() mx:Script ![CDATA[ import flash.display.SimpleButton public function onComplete():void { var newButton:SimpleButton = new SimpleButton(); // add child here . } -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links
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; 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: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com] On Behalf Of [EMAIL PROTECTED] mailto:info1%40reenie.org Sent: Tuesday, October 23, 2007 12:45 PM To: flexcoders@yahoogroups.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 creationComplete=onComplete() mx:Script ![CDATA[ import flash.display.SimpleButton public function onComplete():void { var newButton:SimpleButton = new SimpleButton(); // add child here . } -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links
RE: [flexcoders] Simple SimpleButton 2nd try
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: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Tuesday, October 23, 2007 1:10 PM To: flexcoders@yahoogroups.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; 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: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com] On Behalf Of [EMAIL PROTECTED] mailto:info1%40reenie.org Sent: Tuesday, October 23, 2007 12:45 PM To: flexcoders@yahoogroups.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 creationComplete=onComplete() mx:Script ![CDATA[ import flash.display.SimpleButton public function onComplete():void { var newButton:SimpleButton = new SimpleButton(); // add child here . } -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links
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: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com] On Behalf Of [EMAIL PROTECTED] mailto:info1%40reenie.org Sent: Tuesday, October 23, 2007 1:10 PM To: flexcoders@yahoogroups.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 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: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com 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 12:45 PM To: flexcoders@yahoogroups.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 creationComplete=onComplete() mx:Script ![CDATA[ import flash.display.SimpleButton public function onComplete():void { var newButton:SimpleButton = new SimpleButton(); // add child here . } -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com http://www.mail-archive.com/flexcoders%40yahoogroups.com http://www.mail-archive.com/flexcoders%40yahoogroups.com http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links
RE: [flexcoders] Simple SimpleButton 2nd try
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: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Tuesday, October 23, 2007 1:25 PM To: flexcoders@yahoogroups.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: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com] On Behalf Of [EMAIL PROTECTED] mailto:info1%40reenie.org Sent: Tuesday, October 23, 2007 1:10 PM To: flexcoders@yahoogroups.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 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: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com 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 12:45 PM To: flexcoders@yahoogroups.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 creationComplete=onComplete() mx:Script ![CDATA[ import flash.display.SimpleButton public function onComplete():void { var newButton:SimpleButton = new SimpleButton(); // add child here . } -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com http://www.mail-archive.com/flexcoders%40yahoogroups.com http://www.mail-archive.com/flexcoders%40yahoogroups.com http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com
Re: [flexcoders] Simple SimpleButton 2nd try
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: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com] On Behalf Of [EMAIL PROTECTED] mailto:info1%40reenie.org Sent: Tuesday, October 23, 2007 1:25 PM To: flexcoders@yahoogroups.com 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: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com 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: flexcoders@yahoogroups.com 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: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com 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: flexcoders@yahoogroups.com 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
Re: [flexcoders] Simple SimpleButton 2nd try
From what you have posted it looks like some of the flex framework code assumes that your child is an IUIComponent even though the API is addChild(child:DisplayObject)... since SimpleButton IS a DisplayObject and IS NOT an IUIComponent you are getting hosed. Looks to me like you have found a framework bug... or at least a lack of documentation. As others have suggested, using Button will work (because Button is a UIComponent which implements IUIComponent) hth Scott Scott Melby Founder, Fast Lane Software LLC http://www.fastlanesw.com [EMAIL PROTECTED] wrote: 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: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com 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:25 PM To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com 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: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com 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 1:10 PM To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com 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 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: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com] On Behalf Of [EMAIL PROTECTED] mailto:info1
Re: [flexcoders] Simple SimpleButton 2nd try
Yes that helps, thanks. I can accept that maybe it is not working right, that's not a big deal. Its a big deal if its working right and I still can't get it to work. Scott - FastLane wrote: From what you have posted it looks like some of the flex framework code assumes that your child is an IUIComponent even though the API is addChild(child:DisplayObject)... since SimpleButton IS a DisplayObject and IS NOT an IUIComponent you are getting hosed. Looks to me like you have found a framework bug... or at least a lack of documentation. As others have suggested, using Button will work (because Button is a UIComponent which implements IUIComponent) hth Scott Scott Melby Founder, Fast Lane Software LLC http://www.fastlanesw.com [EMAIL PROTECTED] wrote: 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: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com 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:25 PM To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com 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: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com 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 1:10 PM To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com 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 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: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com
Re: [flexcoders] Simple SimpleButton 2nd try
Are you possibly saying that I can't add a SimpleButton directly to an Application ? ?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 flash.display.SimpleButton public function onComplete():void { var newButton:SimpleButton = new SimpleButton(); // add child here or whatever it is you have to do to make the Simple Button show up in the application . } Alex Harui wrote: We’ll have to make sure the rules are more clearly documented. There is no function overloading in AS so we can’t restrict what you pass into addChild. But frameworks do have rules for performance reasons so we can assume that all other pieces are all part of the same framework. Sprite, SImpleButton, Shape and MovieClip are Flash entities (note the flash package) and mx.* packages are Flex entities. The rules for Flex are: Navigator children must be Containers Container children must be IUIComponents UIComponent children can be anything including Flash display objects. I swear I type those three lines once every two weeks. Anyone want to help me turn it into a haiku? *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of [EMAIL PROTECTED] *Sent:* Tuesday, October 23, 2007 11:24 AM *To:* flexcoders@yahoogroups.com *Subject:* Re: [flexcoders] Simple SimpleButton 2nd try Yes that helps, thanks. I can accept that maybe it is not working right, that's not a big deal. Its a big deal if its working right and I still can't get it to work. Scott - FastLane wrote: From what you have posted it looks like some of the flex framework code assumes that your child is an IUIComponent even though the API is addChild(child:DisplayObject)... since SimpleButton IS a DisplayObject and IS NOT an IUIComponent you are getting hosed. Looks to me like you have found a framework bug... or at least a lack of documentation. As others have suggested, using Button will work (because Button is a UIComponent which implements IUIComponent) hth Scott Scott Melby Founder, Fast Lane Software LLC http://www.fastlanesw.com http://www.fastlanesw.com [EMAIL PROTECTED] mailto:info1%40reenie.org wrote: 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: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com 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 1:25 PM To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com 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
Re: [flexcoders] Simple SimpleButton 2nd try
I think that you can add a SimpleButton to a UIComponent and then add that UIComponent to the Application. But you should know that a SimpleButton has no skin and unless you define it's states it will not appear on the stage. [EMAIL PROTECTED] wrote: Are you possibly saying that I can't add a SimpleButton directly to an Application ? ?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 flash.display.SimpleButton public function onComplete():void { var newButton:SimpleButton = new SimpleButton(); // add child here or whatever it is you have to do to make the Simple Button show up in the application . } -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * Your email settings: Individual Email | Traditional * To change settings online go to: http://groups.yahoo.com/group/flexcoders/join (Yahoo! ID required) * To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
Re: [flexcoders] Simple SimpleButton 2nd try
Those layers were a big stumbling block for me, but once I understood it I don't have any problems with it. I also agree that better examples would be useful/helpful and if Adobe were to want to hire an experienced developer to write some Do you know if there are any plans in the future of the language to add overloading? What about meta-data, could there be a tag you could add to those calls that would instruct the compiler to do a type check other than what the function signature says? Alex Harui wrote: Better examples will always be useful. However, I think another stumbling block for you and others is that there are different layers out there. The flash.* packages represent a layer, and the mx.* packages represent a layer on top of that. The flash.* layer doesn’t really know about the mx.* layer and thus does not reference it in its examples. The mx.* layer expects you to use mx.* entities and therefore doesn’t point out that there are rules for mixing in-between layers. And the language doesn’t support overloading so the APIs can’t help you out at compile time. I’m old enough that I’ve seen this layering in Windows file APIs so maybe I’m more willing to roll with it. There are different file API layers in Windows/DOS and you can’t mix those most of the time either. -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * Your email settings: Individual Email | Traditional * To change settings online go to: http://groups.yahoo.com/group/flexcoders/join (Yahoo! ID required) * To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
Re: [flexcoders] Simple SimpleButton 2nd try
__,Is it because they think its too simple to explain ? I don't think that's the problem either. I personally think 99% of the documentation in Adobe products is horrid, but it's because it's being written by the wrong people. It's written by employees who use this stuff day in and day out and are way overqualified to think like a beginner. So they tend to skip over the basic stuff and just say do this and half the audience is screaming how? I know the documentation is available through the beta process, but how many of us file bugs on suggestions for better explaining it? I have filed a few bugs on docs, but it was for mistakes . .not a critique on the content. At the very least, I think there should be technical editors made up of people like us. Nancy