[flexcoders] Re: Need help dynamically modifying text displayed based on DB return

2012-02-07 Thread hermeszfineart


The solution was actually simple but took a great deal of digging.

I created a protected function as follows:


protected function onLabelCreationComplete():void
{   
if ( imageStatus == 'Available' ){
artPrice.setStyle("color", "0xC39F70");
artPrice.text = imagePrice;
}
else if ( imageStatus == 'Sold' ) {
artPrice.setStyle("color", "0xED1F04");
artPrice.text = imageStatus;
}
else {
artPrice.setStyle("color", "0xC39F70");
artPrice.text = imageStatus;
}
}

Then I called the function from the Label control:



The setStyle operator resolved the issue completely.

I used your states idea but implemented id using conditional statements.

Thanks for the reply this was helpful.

John


--- In flexcoders@yahoogroups.com, Haykel BEN JEMIA  wrote:
>
> I think the best way is to use states. Define the different states for your
> component, e.g.
> 
> 
> 
> 
> 
> 
> 
> You have now to track changes to win.status and set the current state
> accordingly, e.g. by listening to the property change event on win:
> 
> protected function win_propertyChangeHandler(event:PropertyChangeEvent):void
> {
> switch (event.property)
> {
> case "status":
> imageStatus = event.newValue;
> switch (event.newValue)
> {
> case "Available":
> currentState = "available";
> break;
> case "Sold":
> currentState = "sold";
> break;
> default:
> currentState = "other";
> break;
> }
> break;
> }
> }
> 
> and finally set the properties of the artPrice text based on the current
> state:
> 
>  color.sold="#C39F70" fontFamily="Times New Roman" fontSize="18"
> text="{imageStatus}" text.available="{imagePrice}" />
> 
> I hope this helps.
> 
> Haykel Ben Jemia
> 
> Allmas
> Web & Mobile Development
> http://www.allmas-tn.com
> 
> 
> 
> 
> On 30 January 2012 14:55, hermeszfineart  wrote:
> 
> > **
> >
> >
> > Part of the functionality in the gallery app ia am working on for my wife
> > is a popup window that displays information about the specific painting or
> > drawing.
> >
> > I am trying to figure out how to do the following based on the value
> > returned from the DB for the imageStatus field:
> > 1) Change the text displayed for the Price to the {imageStatus)if that
> > value is anything other than "Available".
> > 2) Change the color of the above text to RED if the {imageStatus) == Sold.
> >
> >
> >
> > 
> > 
> > 
> >
> > 
> >
> > 
> >
> > 
> >
> > 
> >
> >  > fontFamily="Times New Roman" fontSize="18" text="{imageStyle}"/>
> >
> >  > fontSize="18" text="{imageMedium}"/>
> >
> > 
> >
> >  
> >
> > 
> >
> > I have tried several things with public functions, getters/setters, but
> > have gotten no where.
> >
> > Could someone kindly point me in the right direction?
> >
> > Thanks,
> >
> > John
> >  
> >
>




RE: [flexcoders] Flex 3 -> 4 migration and s:States

2012-02-07 Thread Sells, Fred
Yes, that works for me too, A little googling indicates that you cannot inherit 
states. So I tried moving the state definitions into the child component which 
still does not work as shown below.  However if I change A.mxml to inherit from 
s:VGroup the state errors go away (although I get a bunch of new ones because 
I’m not inheriting from the base class).  I could change my base class to an 
.as definition; but I don’t know if that would help.  Any suggestions?

 

 

 

---base component 
_section.mxml---

http://ns.adobe.com/mxml/2009"; 

xmlns:s="library://ns.adobe.com/flex/spark" 

xmlns:mx="library://ns.adobe.com/flex/mx"

xmlns:com="components.*" 

…>

…

-- child component A.mxml---



http://ns.adobe.com/mxml/2009"; 

  
xmlns:s="library://ns.adobe.com/flex/spark" 

  
xmlns:mx="library://ns.adobe.com/flex/mx"

  xmlns:com="components.*"

  xmlns:sections="sections.*"

  

  >

  

  







  

…

-- compiler error  points to the  
line-

Description ResourceLocationPath  Type

Could not resolve  to a component implementation. A.mxml  line 12 
 /MdsClientBeta1/src/sections  Flex Problem  

 

From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf 
Of Tandon, Rishi
Sent: Tuesday, February 07, 2012 4:35 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Flex 3 -> 4 migration and s:States

 

  

Well I tried your code in flex sdk 4.6 and could not include  as it 
is deprecated.

But replacing  with  works like a butter.

Please refer to the code below:

 



http://ns.adobe.com/mxml/2009"; 

  
xmlns:s="library://ns.adobe.com/flex/spark" 

  xmlns:mx="library://ns.adobe.com/flex/mx">

























 

Flex 3 states can be used with spark component

Please refer to the attach blog: http://blog.benstucki.net/?p=56

 

Regards,

Rishi Tandon

 

 

 



From: bu4fred 
To: flexcoders@yahoogroups.com 
Sent: Tuesday, February 7, 2012 12:39 AM
Subject: [flexcoders] Flex 3 -> 4 migration and s:States

 

  

I'm migrating a flex 3.0 application to 4.0 (or 4.5, doesn't matter much) and I 
want to use the new state features of includeIn and excludeFrom. I have a user 
defined base class in mxml and i inherit from that for my 'working' classes. I 
have this code in my baseclass

http://ns.adobe.com/mxml/2009"; 
xmlns:s="library://ns.adobe.com/flex/spark" 
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:com="components.*" 
currentState="Oct2010">






. . .

- working class contains -

... 

 and the error is 

State 'Apr2012' was referenced without being declared. A.mxml line 66 
/MdsClientBeta1/src/sections Flex Problem

--- comments 
I tried s:states rather than mx:states but it could not resolve name
Must s:states be used only in s: components or can they be used in mx 
components?

 





Re: [flexcoders] Flex 3 -> 4 migration and s:States

2012-02-07 Thread The Real Napster
In that example he has mentioned like bellow.







WORKS

*but not this one*





mx inside s ok but s inside mx is not ok. Is it ok!!

Thanks. And I don't know why are you so desperate to use spark inside mx,
using spark is better that mx. What you say?
**

On Tue, Feb 7, 2012 at 3:04 PM, Tandon, Rishi wrote:

> **
>
>
> Well I tried your code in flex sdk 4.6 and could not include 
> as it is deprecated.
> But replacing  with  works like a butter.
> Please refer to the code below:
>
> 
> http://ns.adobe.com/mxml/2009";
>xmlns:s="library://ns.adobe.com/flex/spark"
>xmlns:mx="library://ns.adobe.com/flex/mx">
> 
> 
> 
>  
> 
> 
> 
>  
> 
> 
>
> Flex 3 states can be used with spark component
> Please refer to the attach blog: http://blog.benstucki.net/?p=56
>
> Regards,
> Rishi Tandon
>
>
>
>   --
> *From:* bu4fred 
> *To:* flexcoders@yahoogroups.com
> *Sent:* Tuesday, February 7, 2012 12:39 AM
> *Subject:* [flexcoders] Flex 3 -> 4 migration and s:States
>
>
> I'm migrating a flex 3.0 application to 4.0 (or 4.5, doesn't matter much)
> and I want to use the new state features of includeIn and excludeFrom. I
> have a user defined base class in mxml and i inherit from that for my
> 'working' classes. I have this code in my baseclass
>
> http://ns.adobe.com/mxml/2009";
> xmlns:s="library://ns.adobe.com/flex/spark"
> xmlns:mx="library://ns.adobe.com/flex/mx"
> xmlns:com="components.*"
> currentState="Oct2010">
>
> 
> 
> 
> 
> 
> . . .
>
> - working class contains -
> 
> ...
> 
>  and the error is 
>
> State 'Apr2012' was referenced without being declared. A.mxml line 66
> /MdsClientBeta1/src/sections Flex Problem
>
> --- comments 
> I tried s:states rather than mx:states but it could not resolve name
> Must s:states be used only in s: components or can they be used in mx
> components?
>
>
>
>   
>


Re: [flexcoders] Flex 3 -> 4 migration and s:States

2012-02-07 Thread The Real Napster
Set/assign the state( currentState="Oct2010" ) inside creationComplete
handling method.

Ex.
protected function
application1_creationCompleteHandler(event:FlexEvent):void
{
// TODO Auto-generated method stub
this.currentState = " Oct2010";
}
May be all the states might have not laid-out while executing  

Its my guess. Do reply with your results.

Thanks

On Tue, Feb 7, 2012 at 12:39 AM, bu4fred wrote:

> **
>
>
> I'm migrating a flex 3.0 application to 4.0 (or 4.5, doesn't matter much)
> and I want to use the new state features of includeIn and excludeFrom. I
> have a user defined base class in mxml and i inherit from that for my
> 'working' classes. I have this code in my baseclass
>
> http://ns.adobe.com/mxml/2009";
> xmlns:s="library://ns.adobe.com/flex/spark"
> xmlns:mx="library://ns.adobe.com/flex/mx"
> xmlns:com="components.*"
> currentState="Oct2010">
>
> 
> 
> 
> 
> 
> . . .
>
> - working class contains -
> 
> ...
> 
>  and the error is 
>
> State 'Apr2012' was referenced without being declared. A.mxml line 66
> /MdsClientBeta1/src/sections Flex Problem
>
> --- comments 
> I tried s:states rather than mx:states but it could not resolve name
> Must s:states be used only in s: components or can they be used in mx
> components?
>
>  
>


[flexcoders] Divider line for s:splitViewNavigator

2012-02-07 Thread markflex2007
 Hi,
 
 I have the following questions for s:splitViewNavigator.
 
 How to change color,width for Divider line for s:splitViewNavigator?
 How to hide the Divider line?
 
 Thanks
 
 Mark



Re: [flexcoders] Re: "s:Image" and "s:BitmapImage"?

2012-02-07 Thread Haykel BEN JEMIA
Use Image if you want to display loading states of images, generally when
loading external images based on user interaction. Use BitmapImage for
skinning purposes.

Haykel Ben Jemia

Allmas
Web & Mobile Development
http://www.allmas-tn.com




On 7 February 2012 15:38, markflex2007  wrote:

> **
>
>
> Which one ("s:Image" or "s:BitmapImage") I should use in mobile
> application for a jpeg image.Thanks
>
> Mark
> >
> > Hi,
> >
> > what is the different between "s:Image" and "s:BitmapImage"? I am a
> little confuse.Thanks
> >
> > Mark
> >
> >
> >
> >
> >
> >
> > --
> > Alex Harui
> > Flex SDK Team
> > Adobe Systems, Inc.
> > http://blogs.adobe.com/aharui
> >
>
>  
>


[flexcoders] Re: "s:Image" and "s:BitmapImage"?

2012-02-07 Thread markflex2007
Which one ("s:Image" or "s:BitmapImage") I should use in mobile application for 
a jpeg image.Thanks

Mark 
> 
> Hi,
> 
> what is the different between "s:Image" and "s:BitmapImage"?  I am a little 
> confuse.Thanks
> 
> Mark
> 
> 
> 
> 
> 
> 
> --
> Alex Harui
> Flex SDK Team
> Adobe Systems, Inc.
> http://blogs.adobe.com/aharui
>




Re: [flexcoders] Flex 3 -> 4 migration and s:States

2012-02-07 Thread Tandon, Rishi
Well I tried your code in flex sdk 4.6 and could not include  as it 
is deprecated.
But replacing  with  works like a butter.
Please refer to the code below:


http://ns.adobe.com/mxml/2009" 
   xmlns:s="library://ns.adobe.com/flex/spark" 
   xmlns:mx="library://ns.adobe.com/flex/mx">











Flex 3 states can be used with spark component
Please refer to the attach blog: http://blog.benstucki.net/?p=56

Regards,
Rishi Tandon





 From: bu4fred 
To: flexcoders@yahoogroups.com 
Sent: Tuesday, February 7, 2012 12:39 AM
Subject: [flexcoders] Flex 3 -> 4 migration and s:States
 

  
I'm migrating a flex 3.0 application to 4.0 (or 4.5, doesn't matter much) and I 
want to use the new state features of includeIn and excludeFrom.  I have a user 
defined base class in mxml and i inherit from that for my 'working' classes.  I 
have this code in my baseclass

http://ns.adobe.com/mxml/2009"; 
xmlns:s="library://ns.adobe.com/flex/spark" 
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:com="components.*" 
currentState="Oct2010">






. . .

- working class contains -

... 

 and the error is 

State 'Apr2012' was referenced without being declared.  A.mxml  line 66 
/MdsClientBeta1/src/sectionsFlex Problem

--- comments 
I tried s:states rather than mx:states but it could not resolve name
Must s:states be used only in s: components or can they be used in mx 
components?