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 Ortega
Sent: Tuesday, 12 September 2006 12:09
AM
To: [EMAIL PROTECTED]ups.com
Subject: 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 var
receiving
> the reference?
>
> Thanks,
> Tom2
>