Re: [flexcoders] Re: Passing Const to custom component error
I found the error. Trying to make the code more legible for the group, I stripped some tags from around the custom tag. In my orginal post, I had this: mx:Spacer height=30/ components:FreedTextLabel id=nameTextLabel ls={ ScreenLabelConstants.NAMEINFO_LABEL} /When in reality, I have this: mx:Spacer height=30/ components:FreedHBox components:FreedTextLabel id=nameTextLabel ls={ ScreenLabelConstants.NAMEINFO_LABEL} / /components:FreedHBoxThe FreedHBox code looks like:?xml version=1.0 encoding=utf-8?mx:HBox xmlns:mx= http://www.adobe.com/2006/mxml width=100% horizontalAlign=center /mx:HBoxThat HBox implementation is wrong, because it works just fine if I replace it with HBox. I replaced that mxml component with a custom as class that extends HBox and it works just fine.StrangeThanks for all your help Bjorn.-Tom2 On 9/11/06, Bjorn Schultheiss [EMAIL PROTECTED] wrote: I like the idea of using constants and i'm impressed the way adobe has used them in the mx framework. I would be suprised if you cannot use them in setting values in mxml. Try an even simpler test. I'd help more but i'm at work now. Will be another 10h hours until i get home and back into Flex :P Regards, Bjorn Schultheiss Senior Flash Developer QDC Technologies From: [EMAIL PROTECTED] ups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Tom OrtegaSent: Tuesday, 12 September 2006 10:12 AMTo: [EMAIL PROTECTED]ups.comSubject: Re: [flexcoders] Re: Passing Const to custom component error Thanks for your help on this. It's frustrating when good practices don't work so good. LOL -Tom2 On 9/11/06, Bjorn Schultheiss [EMAIL PROTECTED] wrote: I doubt it, try debug it in here mx:VBox xmlns:mx=http://www.adobe.com/2006/mxml width=100% height=100% label=Name xmlns:components=apps.common.components.* mx:Script ![CDATA[ import apps.common.asFiles.ScreenLabelConstants; trace('test: '+ScreenLabelConstants.NAMEINFO_LABEL'); nameTextLabel.ls=ScreenLabelConstants.NAMEINFO_LABEL; ]] /mx:Script mx:Spacer height=30/ components:FreedTextLabel id=nameTextLabel ls={ ScreenLabelConstants.NAMEINFO_LABEL} / /mx:VBox I'll run another test when i get home and get it working. Regards, Bjorn Schultheiss Senior Flash Developer QDC Technologies From: [EMAIL PROTECTED]ups.com [mailto: flexcoders@yahoogroups.com] On Behalf Of Tom OrtegaSent: Tuesday, 12 September 2006 12:09 AMTo: [EMAIL PROTECTED]ups.comSubject: Re: [flexcoders] Re: Passing Const to custom component error I wish badly that you were correct, but alas, I fear not.I replaced components with freedCom for both the namespace and directory names. Compiled and passing a const into the FreedTextLabel still results in a null value, while passing in a plain string value of Name works. Even passing a binding to a variable such as ls={someVar} where someVar is set to the const will result in a null value being displayed. I did a bit of debugging though and discovered this. If I pass it a simple string value, the setter gets fired. If I pass it a reference to a var or const, the setter doesn't fire. Maybe the var reference doesn't register as a true value assignment and thus doesn't fire/trigger the setter? -Tom2 On 9/11/06, bjorn.schultheiss [EMAIL PROTECTED] wrote: It's te components namespace you set in the component.The compiler doesn't like xmlns:components=apps.common.components.*not sure why, perhaps components is a reserved word?!?Using getters and setters is good practice for use within components.Overall the code is fine. --- In flexcoders@yahoogroups.com, Tom Ortega [EMAIL PROTECTED] wrote: I have this class: package apps.common.asFiles { public class ScreenLabelConstants { public static const NAMEINFO_LABEL:String = Name; } } I have this code in my app: mx:VBox xmlns:mx=http://www.adobe.com/2006/mxml width=100% height=100% label=Name xmlns:components=apps.common.components.* mx:Script ![CDATA[ import apps.common.asFiles.ScreenLabelConstants; ]] /mx:Script mx:Spacer height=30/ components:FreedTextLabel id=nameTextLabel ls={ ScreenLabelConstants.NAMEINFO_LABEL} / /mx:VBox The FreedTextLabel has this: ?xml version=1.0 encoding=utf-8? mx:Panel xmlns:mx=http://www.adobe.com/2006/mxml creationComplete=initFunc() borderThickness=1 cornerRadius=0 shadowDistance=0 width=80% mx:Script ![CDATA[ import apps.common.asFiles.ScreenLabelConstants; [Bindable] private var _ls:String; [Bindable] public var mainLabelText:String; public function get ls():String { return _ls; } public function set ls(newValue:String):void { _ls = newValue; mainLabelText = _ls + :; } public function initFunc():void
Re: [flexcoders] Re: Passing Const to custom component error
I wish badly that you were correct, but alas, I fear not.I replaced components with freedCom for both the namespace and directory names. Compiled and passing a const into the FreedTextLabel still results in a null value, while passing in a plain string value of Name works. Even passing a binding to a variable such as ls={someVar} where someVar is set to the const will result in a null value being displayed. I did a bit of debugging though and discovered this. If I pass it a simple string value, the setter gets fired. If I pass it a reference to a var or const, the setter doesn't fire. Maybe the var reference doesn't register as a true value assignment and thus doesn't fire/trigger the setter? -Tom2On 9/11/06, bjorn.schultheiss [EMAIL PROTECTED] wrote: It's te components namespace you set in the component. The compiler doesn't like xmlns:components=apps.common.components.* not sure why, perhaps components is a reserved word?!? Using getters and setters is good practice for use within components. Overall the code is fine. --- In flexcoders@yahoogroups.com, Tom Ortega [EMAIL PROTECTED] wrote: I have this class: package apps.common.asFiles { public class ScreenLabelConstants { public static const NAMEINFO_LABEL:String = Name; } } I have this code in my app: mx:VBox xmlns:mx=http://www.adobe.com/2006/mxml width=100% height=100% label=Name xmlns:components=apps.common.components.* mx:Script ![CDATA[ import apps.common.asFiles.ScreenLabelConstants; ]] /mx:Script mx:Spacer height=30/ components:FreedTextLabel id=nameTextLabel ls={ ScreenLabelConstants.NAMEINFO_LABEL} / /mx:VBox The FreedTextLabel has this: ?xml version=1.0 encoding=utf-8? mx:Panel xmlns:mx=http://www.adobe.com/2006/mxml creationComplete=initFunc() borderThickness=1 cornerRadius=0 shadowDistance=0 width=80% mx:Script ![CDATA[ import apps.common.asFiles.ScreenLabelConstants; [Bindable] private var _ls:String; [Bindable] public var mainLabelText:String; public function get ls():String { return _ls; } public function set ls(newValue:String):void { _ls = newValue; mainLabelText = _ls + :; } public function initFunc():void { mainLabelText = ls + :; } ]] /mx:Script mx:Label id=mainLabel text={mainLabelText}/ /mx:Panel The problem is that it won't work. No data gets passed to my custom component. Why is that? Is it because my app is binding the var to constant value? Or because I'm using a setter/getter on the var receiving the reference? Thanks, Tom2 __._,_.___ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Software development tool Software development Software development services Home design software Software development company Your email settings: Individual Email|Traditional Change settings via the Web (Yahoo! ID required) Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe __,_._,___
RE: [flexcoders] Re: Passing Const to custom component error
I doubt it, try debug it in here mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%" label="Name" xmlns:components="apps.common.components.*" mx:Script ![CDATA[ import apps.common.asFiles.ScreenLabelConstants; trace('test: '+ScreenLabelConstants.NAMEINFO_LABEL'); nameTextLabel.ls=ScreenLabelConstants.NAMEINFO_LABEL; ]] /mx:Script mx:Spacer height="30"/ components:FreedTextLabel id="nameTextLabel" ls="{ ScreenLabelConstants.NAMEINFO_LABEL}" / /mx:VBox I'll run another test when i get home and get it working. Regards, Bjorn Schultheiss Senior Flash Developer QDC Technologies From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Tom OrtegaSent: Tuesday, 12 September 2006 12:09 AMTo: flexcoders@yahoogroups.comSubject: Re: [flexcoders] Re: Passing Const to custom component error I wish badly that you were correct, but alas, I fear not.I replaced components with freedCom for both the namespace and directory names. Compiled and passing a const into the FreedTextLabel still results in a null value, while passing in a plain string value of "Name" works. Even passing a binding to a variable such as ls="{someVar}" where someVar is set to the const will result in a null value being displayed. I did a bit of debugging though and discovered this. If I pass it a simple string value, the setter gets fired. If I pass it a reference to a var or const, the setter doesn't fire. Maybe the var reference doesn't register as a true value assignment and thus doesn't fire/trigger the setter? -Tom2 On 9/11/06, bjorn.schultheiss bjorn.schultheiss@qdc.net.au wrote: It's te components namespace you set in the component.The compiler doesn't like xmlns:components="apps.common.components.*"not sure why, perhaps components is a reserved word?!?Using getters and setters is good practice for use within components.Overall the code is fine. --- In [EMAIL PROTECTED]ups.com, "Tom Ortega" [EMAIL PROTECTED].. wrote: I have this class: package apps.common.asFiles { public class ScreenLabelConstants { public static const NAMEINFO_LABEL:String = "Name"; } } I have this code in my app: mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%" label="Name" xmlns:components="apps.common.components.*" mx:Script ![CDATA[ import apps.common.asFiles.ScreenLabelConstants; ]] /mx:Script mx:Spacer height="30"/ components:FreedTextLabel id="nameTextLabel" ls="{ ScreenLabelConstants.NAMEINFO_LABEL}" / /mx:VBox The FreedTextLabel has this: ?xml version="1.0" encoding="utf-8"? mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="initFunc()" borderThickness="1" cornerRadius="0" shadowDistance="0" width="80%" mx:Script ![CDATA[ import apps.common.asFiles.ScreenLabelConstants; [Bindable] private var _ls:String; [Bindable] public var mainLabelText:String; public function get ls():String { return _ls; } public function set ls(newValue:String):void { _ls = newValue; mainLabelText = _ls + ":"; } public function initFunc():void { mainLabelText = ls + ":"; } ]] /mx:Script mx:Label id="mainLabel" text="{mainLabelText}"/ /mx:Panel The problem is that it won't work. No data gets passed to my custom component. Why is that? Is it because my app is binding the var to constant value? Or because I'm using a setter/getter on the varreceiving the reference? Thanks, Tom2 __._,_.___ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Software development tool Software development Software development services Home design software Software development company Your email settings: Individual Email|Traditional Change settings via the Web (Yahoo! ID required) Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe __,_._,___
Re: [flexcoders] Re: Passing Const to custom component error
Thanks for your help on this. It's frustrating when good practices don't work so good. LOL -Tom2On 9/11/06, Bjorn Schultheiss [EMAIL PROTECTED] wrote: I doubt it, try debug it in here mx:VBox xmlns:mx=http://www.adobe.com/2006/mxml width=100% height=100% label=Name xmlns:components=apps.common.components.* mx:Script ![CDATA[ import apps.common.asFiles.ScreenLabelConstants; trace('test: '+ScreenLabelConstants.NAMEINFO_LABEL'); nameTextLabel.ls=ScreenLabelConstants.NAMEINFO_LABEL; ]] /mx:Script mx:Spacer height=30/ components:FreedTextLabel id=nameTextLabel ls={ ScreenLabelConstants.NAMEINFO_LABEL} / /mx:VBox I'll run another test when i get home and get it working. Regards, Bjorn Schultheiss Senior Flash Developer QDC Technologies From: [EMAIL PROTECTED]ups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Tom OrtegaSent: Tuesday, 12 September 2006 12:09 AMTo: [EMAIL PROTECTED]ups.comSubject: Re: [flexcoders] Re: Passing Const to custom component error I wish badly that you were correct, but alas, I fear not.I replaced components with freedCom for both the namespace and directory names. Compiled and passing a const into the FreedTextLabel still results in a null value, while passing in a plain string value of Name works. Even passing a binding to a variable such as ls={someVar} where someVar is set to the const will result in a null value being displayed. I did a bit of debugging though and discovered this. If I pass it a simple string value, the setter gets fired. If I pass it a reference to a var or const, the setter doesn't fire. Maybe the var reference doesn't register as a true value assignment and thus doesn't fire/trigger the setter? -Tom2 On 9/11/06, bjorn.schultheiss [EMAIL PROTECTED] wrote: It's te components namespace you set in the component.The compiler doesn't like xmlns:components=apps.common.components.*not sure why, perhaps components is a reserved word?!?Using getters and setters is good practice for use within components.Overall the code is fine. --- In flexcoders@yahoogroups.com, Tom Ortega [EMAIL PROTECTED] wrote: I have this class: package apps.common.asFiles { public class ScreenLabelConstants { public static const NAMEINFO_LABEL:String = Name; } } I have this code in my app: mx:VBox xmlns:mx=http://www.adobe.com/2006/mxml width=100% height=100% label=Name xmlns:components=apps.common.components.* mx:Script ![CDATA[ import apps.common.asFiles.ScreenLabelConstants; ]] /mx:Script mx:Spacer height=30/ components:FreedTextLabel id=nameTextLabel ls={ ScreenLabelConstants.NAMEINFO_LABEL} / /mx:VBox The FreedTextLabel has this: ?xml version=1.0 encoding=utf-8? mx:Panel xmlns:mx=http://www.adobe.com/2006/mxml creationComplete=initFunc() borderThickness=1 cornerRadius=0 shadowDistance=0 width=80% mx:Script ![CDATA[ import apps.common.asFiles.ScreenLabelConstants; [Bindable] private var _ls:String; [Bindable] public var mainLabelText:String; public function get ls():String { return _ls; } public function set ls(newValue:String):void { _ls = newValue; mainLabelText = _ls + :; } public function initFunc():void { mainLabelText = ls + :; } ]] /mx:Script mx:Label id=mainLabel text={mainLabelText}/ /mx:Panel The problem is that it won't work. No data gets passed to my custom component. Why is that? Is it because my app is binding the var to constant value? Or because I'm using a setter/getter on the varreceiving the reference? Thanks, Tom2 __._,_.___ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Software development tool Software development Software development services Home design software Software development company Your email settings: Individual Email|Traditional Change settings via the Web (Yahoo! ID required) Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe __,_._,___
RE: [flexcoders] Re: Passing Const to custom component error
I like the idea of using constants and i'm impressed the way adobe has used them in the mx framework. I would be suprised if you cannot use them in setting values in mxml. Try an even simpler test. I'd help more but i'm at work now. Will be another 10h hours until i get home and back into Flex :P Regards, Bjorn Schultheiss Senior Flash Developer QDC Technologies From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Tom OrtegaSent: Tuesday, 12 September 2006 10:12 AMTo: flexcoders@yahoogroups.comSubject: Re: [flexcoders] Re: Passing Const to custom component error Thanks for your help on this. It's frustrating when "good practices" don't work so good. LOL -Tom2 On 9/11/06, Bjorn Schultheiss bjorn.schultheiss@qdc.net.au wrote: I doubt it, try debug it in here mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%" label="Name" xmlns:components="apps.common.components.*" mx:Script ![CDATA[ import apps.common.asFiles.ScreenLabelConstants; trace('test: '+ScreenLabelConstants.NAMEINFO_LABEL'); nameTextLabel.ls=ScreenLabelConstants.NAMEINFO_LABEL; ]] /mx:Script mx:Spacer height="30"/ components:FreedTextLabel id="nameTextLabel" ls="{ ScreenLabelConstants.NAMEINFO_LABEL}" / /mx:VBox I'll run another test when i get home and get it working. Regards, Bjorn Schultheiss Senior Flash Developer QDC Technologies From: [EMAIL PROTECTED]ups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Tom OrtegaSent: Tuesday, 12 September 2006 12:09 AMTo: [EMAIL PROTECTED]ups.comSubject: Re: [flexcoders] Re: Passing Const to custom component error I wish badly that you were correct, but alas, I fear not.I replaced components with freedCom for both the namespace and directory names. Compiled and passing a const into the FreedTextLabel still results in a null value, while passing in a plain string value of "Name" works. Even passing a binding to a variable such as ls="{someVar}" where someVar is set to the const will result in a null value being displayed. I did a bit of debugging though and discovered this. If I pass it a simple string value, the setter gets fired. If I pass it a reference to a var or const, the setter doesn't fire. Maybe the var reference doesn't register as a true value assignment and thus doesn't fire/trigger the setter? -Tom2 On 9/11/06, bjorn.schultheiss bjorn.schultheiss@qdc.net.au wrote: It's te components namespace you set in the component.The compiler doesn't like xmlns:components="apps.common.components.*"not sure why, perhaps components is a reserved word?!?Using getters and setters is good practice for use within components.Overall the code is fine. --- In [EMAIL PROTECTED]ups.com, "Tom Ortega" [EMAIL PROTECTED].. wrote: I have this class: package apps.common.asFiles { public class ScreenLabelConstants { public static const NAMEINFO_LABEL:String = "Name"; } } I have this code in my app: mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%" label="Name" xmlns:components="apps.common.components.*" mx:Script ![CDATA[ import apps.common.asFiles.ScreenLabelConstants; ]] /mx:Script mx:Spacer height="30"/ components:FreedTextLabel id="nameTextLabel" ls="{ ScreenLabelConstants.NAMEINFO_LABEL}" / /mx:VBox The FreedTextLabel has this: ?xml version="1.0" encoding="utf-8"? mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml " creationComplete="initFunc()" borderThickness="1" cornerRadius="0" shadowDistance="0" width="80%" mx:Script ![CDATA[ import apps.common.asFiles.ScreenLabelConstants; [Bindable] private var _ls:String; [Bindable] public var mainLabelText:String; public function get ls():String { return _ls; } public function set ls(newValue:String):void { _ls = newValue; mainLabelText = _ls + ":"; } public function initFunc():void { mainLabelText = ls + ":"; } ]] /mx:Script mx:Label id="mainLabel" text="{mainLabelText}"/ /mx:Panel The problem is that it won't work. No data gets passed to my custom component. Why is that? Is it because my app is binding the var to constant value? Or because I'm using a setter/getter on the varreceiving the reference? Thanks, Tom2 __._,_.___ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexco