[flexcoders] Help with extending button

2009-07-29 Thread Angela
I am trying to create a toggle button that will show a label and a colored box 
dynamically. I thought extending the button component would be my best option. 
I add a Box component and set it's background color to the color passed to the 
button. 

Everything almost works, except the Box seems to be underneath the button and 
when it is toggled you can no longer see it (alpha is 100%).

I feel like I must be missing something very simple. Any help would be greatly 
appreciated.

Here is my code:

package com.view
{
import flash.display.DisplayObject;
import flash.events.MouseEvent;
import flash.text.TextLineMetrics;

import mx.containers.Box;
import mx.controls.Button;
import mx.core.UITextField;

public class LegendButton extends Button
{
[Bindable] public var legendColor:uint;
private var legendIcon:Box;

public function LegendButton()
{
super();
}

override protected function createChildren():void
{   
if (!legendIcon)
{
legendIcon = new Box;
legendIcon.styleName = this;

legendIcon.setStyle('backgroundColor',legendColor);
legendIcon.width = 10;
legendIcon.height = 10;
addChild(legendIcon);
}

if (!textField)
{
textField = new UITextField();
textField.styleName = this;

addChild(flash.display.DisplayObject(textField));
}

super.createChildren();
}

protected override function 
updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
{   
this.setStyle('paddingLeft',15);
this.setStyle('paddingRight',5);

legendIcon.move(5,5);

super.updateDisplayList(unscaledWidth,unscaledHeight);
}

override protected function measure():void
{
if (!isNaN(explicitWidth))
{
var w:Number = explicitWidth;
w -= getStyle('horizontalGap') + 
getStyle('paddingLeft') + getStyle('paddingRight');
textField.width = w;
}
super.measure();
}

override public function measureText(s:String):TextLineMetrics
{
textField.text = s;
var lineMetrics:TextLineMetrics = 
textField.getLineMetrics(0);
lineMetrics.width = textField.textWidth + 4;
lineMetrics.height = textField.textHeight + 4;
return lineMetrics;
} 

}
}


Angela
http://whatsmytitletoday.blogspot.com/



[flexcoders] Re: AdvancedDataGrid group filtering & openNode

2009-01-26 Thread Angela
I am having the same problem and can't find a solution. Has anyone 
solved this?

Angela

--- In flexcoders@yahoogroups.com, "Eric Jones"  wrote:
>
> Adnan or Nigel,
> 
> Did either of you resolve this? Any change you could post a 
solution?
> 
> jonese
> 
> --- In flexcoders@yahoogroups.com, "nigelrmtaylor"  
> wrote:
> >
> > Adnan
> > 
> > Did you get any further with this? It looks like I'm trying to 
solve 
> > the same problem as you.
> > 
> > 
> > Cheers
> > 
> > Nigel
> > --- In flexcoders@yahoogroups.com, "Adnan Doric"  
> > wrote:
> > >
> > > Hello guys,
> > > 
> > > I'm trying to filter my ADG without success :
> > > 
> > > I created a GroupingCollection from a flat ArrayCollection.
> > > 
> > > ADG's dataProvider is GroupingCollection.
> > > 
> > > First issue : refresh
> > > if I filter the underlaying ArrayCollection, the related
> > > groupingCollection doesn't refresh automatically (bug? feature?)
> > > 
> > > Actually I menaged to force gc.refresh() with some event( it is
> > > impossible to listen on CollectionEventKind.REFRESH because of
> > > infinite loop ac.refresh => gc.refresh )
> > > 
> > > Second issue (more important) : openNodes
> > > Ok now that my gc is refreshed, the Tree in the ADG collapses 
> > itself
> > > (ok let say that is normal), and I need it to expand all nodes 
that
> > > were opened before.
> > > 
> > > I tried to do something like this :
> > > 
> > > var openNodes : Object = IHierarchicalCollectionView(
> > > myADG.dataProvider ).openNodes;
> > > 
> > > gc.refresh();
> > > 
> > > myADG.dataProvider.openNodes = openNodes;
> > > 
> > > and it doesn't works.
> > > 
> > > next I tried this :
> > > var openNodes : Object = IHierarchicalCollectionView(
> > > myADG.dataProvider ).openNodes;
> > > for each( var node : Object in openNodes )
> > > {
> > > IHierarchicalCollectionView( myADG.dataProvider.openNode( node )
> > > }
> > > 
> > > guess what, doesn't work :)
> > > 
> > > I'm calling myADG.invalidateList() each time too.
> > > 
> > > I don't know what to do to achieve this simple task, I'm a bit
> > > disappointed because I expected lot more from the brand new
> > > AdvancedDataGrid and this basic functionality actually seems too 
> > hard
> > > to implement.
> > > 
> > > I still hope I'm wrong and someone can show me the correct 
> > solution :)
> > > 
> > > Thank you all,
> > > Adnan
> > >
> >
>





[flexcoders] Re: string to date, no support for european dates ?

2007-11-27 Thread Angela
Hi,

I use DateField.selectedDate.valueOf() to get the epoch time and use
that for all my date comparisons.

Hope that helps,
cheers, Angela
 
--- In flexcoders@yahoogroups.com, "johantrax" <[EMAIL PROTECTED]>
wrote:

> I'm writing a custom DateValidator (subclassing it in AS) which adds 2
> properties to the existing one: minDate:Date and maxDate:Date
> 
> What I'd like to do is compare the dates to see if the inputted date
> is within the correct range. However, I can't tell which inputFormat
> f.e. a DateField will have, since it is configurable through it's
> formatString-property.
> I have some problems with parsing this value (of the DateField) back
> to a date, since Date.parse() doesn't support the format "DD/MM/"
> 
> I'd like to know if there is a parse-method in which we can provide
> the format of the string as a parameter, sth like
> Date.parse(value:String, format:String = null)
> would be wonderful
> 
> This validator is to be used in form where a user can input a start-
> and enddate, and to check if startdate= method to do this, please share..
> 
> Thanks,
> --Johan
>




[flexcoders] move selectedIndex based on user tabbing

2007-08-29 Thread Angela
I have a datagrid with 4 cols. Each DataGridColumn has an 
itemRenderer. What I need to happen is when one of those renderers 
has focus (i.e. you tab to the renderer) the row in the datagrid that 
it's in is selected. I thought itemFocusIn was the answer, but it 
doesn't seem to be getting called.

Here is a snip of code:

















I am thinking that itemFocusIn may not work because the renderer (say 
a button) is wrapped in a Box, unfortunately this needs to be the 
case as some renderers have more than one item inside.

Here is a code snip of a renderer:

http://www.adobe.com/2006/mxml";
width="100%"
horizontalAlign="center">









The focusIn of the button method gets called when the user tabs to 
the button, unfortunately it doesn't know where it is inside the 
datagrid so it's not much help when trying to select the datagrid 
index.

Any help with this would be greatly appreciated. I feel like I must 
just be missing some simple piece of information because this seems 
pretty straightforward.



[flexcoders] Re: Accepting MXML attribute's width in percentage on a custom component

2006-06-23 Thread Angela
I am actually having the same problem - 

I have a canvas with the width set to 100%. If I try and get the 
width in pixels through AS it returns 0.

If I try the same thing through mxml it works fine.

So this in AS:
public function getMiddle():Number {
 var x:Number;  
 x = mainCanvas.width*.5;
 return x;
}

--returns 0

in MXML:


--returns the amount in pixels.

Anyone out there know how to get the pixel value though AS?

Angela.


--- In flexcoders@yahoogroups.com, "leo4beer" <[EMAIL PROTECTED]> wrote:
>
> Accepting MXML attribute's width in percentage in a custom component
> 
> Hi, I have a component I've created by inheriting UIObject class
> 
> In my mxml I have the following lines used for initiating my 
component:
> 
>  
> In my AS code I can trace the value of __width, in this case the
> result will be "400".
> 
> My problem is that when I set the value as percentage:
> 
>  
> In this case the value of __width is "undefined"
> 
> What should I do in order to get the correct value when setting the
> width in percentage and not in pixels??
> 
> Thanks
>







 Yahoo! Groups Sponsor ~--> 
Check out the new improvements in Yahoo! Groups email.
http://us.click.yahoo.com/6pRQfA/fOaOAA/yQLSAA/nhFolB/TM
~-> 

--
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/

<*> 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/
 




[flexcoders] Re: Applying a theme in Flex 2.0

2006-06-13 Thread Angela
Well at least I know now and can stop banging my head against the 
monitor looking for an answer.

If/when you do come up with something I'd love to try it out!

In the meantime I guess it's create, compile, change, compile... etc 
etc.

--- In flexcoders@yahoogroups.com, "Jason Hawryluk" <[EMAIL PROTECTED]> wrote:
>
> Myself and a couple of other flex coders are actually working on a 
solution
> for runtime themes and css style sets. The Flex 2.0 product release 
will not
> include this support so some of us are working on a solution. It 
will
> include the things you mention plus a couple of other goodies that I
> recently discovered.
> 
> 
> 
> Jason
> 
> 
> 
> 
>   -Message d'origine-
>   De : flexcoders@yahoogroups.com 
[mailto:[EMAIL PROTECTED] la
> part de Angela
>   Envoyé : lundi 12 juin 2006 22:03
>   À : flexcoders@yahoogroups.com
>   Objet : [flexcoders] Applying a theme in Flex 2.0
> 
> 
>   I've been searching through 100s of messages on here trying to 
find
>   if there is an answer in this forum to applying a theme (swc) to 
an
>   mxml file in Flex 2.0. If this is a repeat question please 
forgive me.
> 
>   I have been able to apply a theme successfully through the 
compiler
>   mxmlc -theme command. This creates a swf. I was wondering if 
there is
>   another way to apply a theme to an mxml application, otherwise, 
every
>   time I make a change to the mxml I have to recompile to a swf to 
see
>   what the changes will look like with the specified theme.
> 
>   I want to be able to easily reskin applications if necessary, 
which
>   is why I chose this approach, however I'd also like to see the
>   application with the specified skin while developing it.
> 
>   My swc includes a swf with symbols for each component state and a
>   css. I used the included AeonGraphical example as my guide.
> 
>   I know in Flex 1.5 there was actually a theme property in the
>   application tag. That no longer exists. So I guess I'm basically
>   looking for the equivalent in 2.0, if there even is one.
> 
>   Any help would be greatly appreciated!
>






 Yahoo! Groups Sponsor ~--> 
Home is just a click away.  Make Yahoo! your home page now.
http://us.click.yahoo.com/DHchtC/3FxNAA/yQLSAA/nhFolB/TM
~-> 

--
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/

<*> 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/
 




[flexcoders] Applying a theme in Flex 2.0

2006-06-12 Thread Angela
I've been searching through 100s of messages on here trying to find 
if there is an answer in this forum to applying a theme (swc) to an 
mxml file in Flex 2.0. If this is a repeat question please forgive me.

I have been able to apply a theme successfully through the compiler 
mxmlc -theme command. This creates a swf. I was wondering if there is 
another way to apply a theme to an mxml application, otherwise, every 
time I make a change to the mxml I have to recompile to a swf to see 
what the changes will look like with the specified theme.

I want to be able to easily reskin applications if necessary, which 
is why I chose this approach, however I'd also like to see the 
application with the specified skin while developing it.

My swc includes a swf with symbols for each component state and a 
css. I used the included AeonGraphical example as my guide.

I know in Flex 1.5 there was actually a theme property in the 
application tag. That no longer exists. So I guess I'm basically 
looking for the equivalent in 2.0, if there even is one.

Any help would be greatly appreciated!






 Yahoo! Groups Sponsor ~--> 
Everything you need is one click away.  Make Yahoo! your home page now.
http://us.click.yahoo.com/AHchtC/4FxNAA/yQLSAA/nhFolB/TM
~-> 

--
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/

<*> 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/