[flexcoders] Re: Semi-collapsible AdvancedDataGrid

2009-09-15 Thread fumeng5
I just perused the AdvancedDataGrid class in the hopes of overriding the 
itemOpen and itemClose handlers but I don't see anything in there that'll help 
me in preventing the entire thing from collapsing. It's the same thing with 
HierarchicalCollectionView openNode() and closeNode() methods. I don't seem to 
have any access to the rowHeight or contents.

Is there some kind of closed state or default rowHeight that I'm not seeing?




[flexcoders] Semi-collapsible AdvancedDataGrid

2009-09-14 Thread fumeng5
Hi,

I have an AdvancedDataGrid. When you expand a row, a horizontal list of charts 
displays. The row is about 200px tall. 

When you collapse the row, I don't want it to collapse all the way. Instead, 
I'd like to collapse it to about 50px tall and render a much smaller version of 
the chart ( a thumbnail ). 

Is this possible? Do I have to override the displayItemsExpanded() method? Or, 
can I have some rows not be groups?

Any tips are very much appreciated. 

Thank you. 



[flexcoders] SOLVED: Building Multidimensional array for AdvancedDataGrid

2009-09-11 Thread fumeng5
This is how you create a multidimensional array for an AdvancedDataGrid:

masterArray = [{category: 
categoryDTOColl[0].name,chartData:[{caption:gaugeCaptionDTOColl,gauge:gaugeDTOColl}]},
{category: 
categoryDTOColl[1].name,chartData:[{caption:trendCaptionDTOColl,gauge:trendDTOColl}]}];

I was doing it completely wrong before. Hope this helps somebody. 

The odd thing with using  instead of converting flat data 
with a Grouping Collection is that you can't style the grouped row. 

With a grouping collection you can extend the AdvancedDataGridGroupItemRenderer 
and re-position the disclosureIcon, etc..but when using hierchical data, you 
can't...or at least I haven't figured it out. It's because you can't extend 
AdvancedDataGridItemRenderer with any styling. 

Matt
--- In flexcoders@yahoogroups.com, "fumeng5"  wrote:
>
> Hi,
> 
> I'm trying to create a hierarchical collection for my AdvancedDataGrid. My 
> array will be made up of DTOs. As of right now there are only two groups and 
> I try to build the array like this:
> 
> var masterArray:Array = new Array([],[]);
> masterArray[0] = categoryDTOColl[0];
> masterArray[0][0] = gaugeDTOColl;
>   
> masterArray[1] = categoryDTOColl[1];
> masterArray[1][0] = trendDTOColl;
> 
> The groups will be the 'name' property in the categoryDTOColl. The 
> renderProviders will display the gaugeDTOColl and trendDTOColl info.
> 
> So, when I run the code above, I get the error message: 'Cannot create 
> property 0 on CategoryDTO'. Obviously, I'm creating the array incorrectly but 
> am unsure how. I've searched online but haven't found much luck. 
> 
> Thanks in advance, 
> 
> Matt
>




[flexcoders] Building Multidimensional array for AdvancedDataGrid

2009-09-11 Thread fumeng5
Hi,

I'm trying to create a hierarchical collection for my AdvancedDataGrid. My 
array will be made up of DTOs. As of right now there are only two groups and I 
try to build the array like this:

var masterArray:Array = new Array([],[]);
masterArray[0] = categoryDTOColl[0];
masterArray[0][0] = gaugeDTOColl;

masterArray[1] = categoryDTOColl[1];
masterArray[1][0] = trendDTOColl;

The groups will be the 'name' property in the categoryDTOColl. The 
renderProviders will display the gaugeDTOColl and trendDTOColl info.

So, when I run the code above, I get the error message: 'Cannot create property 
0 on CategoryDTO'. Obviously, I'm creating the array incorrectly but am unsure 
how. I've searched online but haven't found much luck. 

Thanks in advance, 

Matt 



[flexcoders] Re: AdvancedDataGrid: expandItem()

2009-09-10 Thread fumeng5
I believe the answer is to use callLater before acting on the AdvancedDataGrid. 
However, the kink is that my dataProvider isn't set until XML is loaded. 

Here is the setter for the dataProvider (source of my GroupingCollection):
public function set applications( arr:Array ):void{
_applications = arr;
appColl.source = applications;
callLater( expandRow );
}

..And then here is the expandRow() method:
private function expandRow():void{
// Expand the first row of the ADG
var obj:Object = gc.getRoot(); 
var temp:Object = 
ListCollectionView(obj).getItemAt(0); 
grid.expandItem(temp,true);
}







 

The error I get when I run this code is this:

Index '0' specified is out of bounds.

I'm just not sure why this might be happening. I mean, I'm using callLater..Any 
ideas? 
--- In flexcoders@yahoogroups.com, "fumeng5"  wrote:
>
> Hi,
> 
> I'm trying to expand the first row of my AdvancedDataGrid column when it is 
> loaded with my XML data. I've found plenty of examples online that show how 
> to do it from a click event, but nothing on init of the grid. I've tried the 
> initialize method, the setter of my dataProvider method but they all give me 
> a range out of bounds error. 
> 
> Here's my function:
> 
> private function expandRow():void{
>   // Expand the first row of the ADG
>   var obj:Object = gc.getRoot(); 
>   var temp:Object = 
> ListCollectionView(obj).getItemAt(0); 
>   grid.expandItem(temp,true);
>   grid.validateNow();
>   }
> 
> Anyone know the proper event to trigger this? 
> 
> Thank you,
> 
> Matt
>




[flexcoders] AdvancedDataGrid: expandItem()

2009-09-10 Thread fumeng5
Hi,

I'm trying to expand the first row of my AdvancedDataGrid column when it is 
loaded with my XML data. I've found plenty of examples online that show how to 
do it from a click event, but nothing on init of the grid. I've tried the 
initialize method, the setter of my dataProvider method but they all give me a 
range out of bounds error. 

Here's my function:

private function expandRow():void{
// Expand the first row of the ADG
var obj:Object = gc.getRoot(); 
var temp:Object = 
ListCollectionView(obj).getItemAt(0); 
grid.expandItem(temp,true);
grid.validateNow();
}

Anyone know the proper event to trigger this? 

Thank you,

Matt



[flexcoders] Re: Using more than one Render Provider

2009-09-09 Thread fumeng5
Hi,

Sorry to cycle this post thru again but I was hoping someone might have an idea 
as to whether this was possible. I have an AdvancedDataGrid with two rows. I 
want the render provider to show pie charts in the first row with comboboxes 
underneath and line charts in the second row with labels next to them. 

Is that possible? I know that renderProviders accepts an array of renderers, 
but I don't see how it's possible to assign to a specific row, only a column. 

Thank you,

Matt
--- In flexcoders@yahoogroups.com, "fumeng5"  wrote:
>
> Hi,
> 
> If I have an AdvancedDataGrid, can I use more than one render provider? 
> 
> For example, my first group will have a render provider that displays a row 
> of charts with a row of dropdown menus underneath. 
> 
> My second group will have a render provider that displays two rows of charts. 
> 
> Can I do that? 
> 
> Thanks,
> 
> Matt
>




[flexcoders] Re: Accessing DataProvider from GroupingCollection

2009-09-08 Thread fumeng5
I can do it this way but it seems totally wonky to me:

i override set data():
var appListData:AdvancedDataGridListData = AdvancedDataGridListData(listData);
(appListData.owner as AdvancedDataGrid).dataProvider.source.source
--- In flexcoders@yahoogroups.com, "fumeng5"  wrote:
>
> Hi,
> 
> I have an AdvancedDataGrid with a Grouping Collection to make my flat data 
> into a hierarchy. 
> 
> I also have another column of data next to (on the same level) as the group. 
> I need to access the column data there but I can't and I'm guessing it's 
> because the dataProvider is now restructured and I can't get the data using 
> the dataField anymore. 
> 
> Is there another way to access it? 
> 
> Thanks for any helpful tips,
> 
> Matt
>




[flexcoders] Accessing DataProvider from GroupingCollection

2009-09-08 Thread fumeng5
Hi,

I have an AdvancedDataGrid with a Grouping Collection to make my flat data into 
a hierarchy. 

I also have another column of data next to (on the same level) as the group. I 
need to access the column data there but I can't and I'm guessing it's because 
the dataProvider is now restructured and I can't get the data using the 
dataField anymore. 

Is there another way to access it? 

Thanks for any helpful tips,

Matt



[flexcoders] Using more than one Render Provider

2009-09-07 Thread fumeng5
Hi,

If I have an AdvancedDataGrid, can I use more than one render provider? 

For example, my first group will have a render provider that displays a row of 
charts with a row of dropdown menus underneath. 

My second group will have a render provider that displays two rows of charts. 

Can I do that? 

Thanks,

Matt



[flexcoders] SOLVED: Can't style AdvancedDataGrid GroupingField

2009-09-05 Thread fumeng5
The solution is to extend the AdvancedGroupItemRenderer class. I've pasted mine 
below in the case that it helps someone. 

package com.renderer
{
import mx.charts.styles.HaloDefaults;
import 
mx.controls.advancedDataGridClasses.AdvancedDataGridGroupItemRenderer;
import mx.styles.CSSStyleDeclaration;

[Style(name="rowColor", type="uint", format="Color", inherit="yes")] 

public class ApplicationGroupItemRenderer extends 
AdvancedDataGridGroupItemRenderer
{

private var borderColor:uint  = 0xbcdbcd9;
private var borderSize:uint   = 0;

override protected function 
updateDisplayList(unscaledWidth:Number,unscaledHeight:Number):void{
super.updateDisplayList(unscaledWidth, unscaledHeight);

graphics.clear();

graphics.lineStyle(borderSize, borderColor);
graphics.beginFill(0xeaeaf4, 1);
graphics.drawRect(0,0,unscaledWidth, unscaledHeight);
}
    }
} 

--- In flexcoders@yahoogroups.com, "fumeng5"  wrote:
>
> Hi, 
> 
> I set a styleFunction for my AdvancedDataGrid:
> 
> private function styleRows(data:Object, column:AdvancedDataGridColumn):Object{
> return {
>   verticalAlign:'middle',
>   backgroundColor:"0xeaeaf4",
>   borderColor:"0xbcdbcd9",
>   borderStyle:"solid",
>   borderThickness:"1"
> }
>   }
> 
> It styles all my columns correctly except the first one (which is my 
> GroupingField) doesn't get its backgroundColor or borders set. Why might this 
> happen? Here's my AdvancedDataGrid dataProvider and columns set below:
> 
> 
> 
> 
> 
> 
> 
> 
> 
>  
> 
> 
>dataField="label"
>   width="175"/>
>width="300"
>   itemRenderer="com.renderer.ApplicationIndicatorRenderer"/>
>width="300"
>   itemRenderer="com.renderer.ApplicationIndicatorRenderer"/>
>width="300"
>   itemRenderer="com.renderer.ApplicationIndicatorRenderer"/>
> 
>




[flexcoders] Can't style AdvancedDataGrid GroupingField

2009-09-04 Thread fumeng5
Hi, 

I set a styleFunction for my AdvancedDataGrid:

private function styleRows(data:Object, column:AdvancedDataGridColumn):Object{
return {
verticalAlign:'middle',
backgroundColor:"0xeaeaf4",
borderColor:"0xbcdbcd9",
borderStyle:"solid",
borderThickness:"1"
}
}

It styles all my columns correctly except the first one (which is my 
GroupingField) doesn't get its backgroundColor or borders set. Why might this 
happen? Here's my AdvancedDataGrid dataProvider and columns set below:









 










[flexcoders] Re: Pass data into renderer

2009-08-25 Thread fumeng5
I pass in the column headers DTOs for both datagrids (the AdvancedDataGrid in 
the parent component and the datagrid that is part of my Renderer class) to the 
parent component. 

So, the column headers DTOs for my datagrid in the Renderer are actually passed 
into the parent; and as a result I can't get access to them. 

It's appearing that it's poor object design on my part. The reason I have a DTO 
for a simple thing such as a header is because there are other attributes such 
as tooltip, sortable, etc...that I need for the column. 

I do pass in a DTO to the Renderer that I use to populate the columns but the 
headers are passed in separately. I guess I should have put them together. Is 
there a way to accomplish what I want without rewriting my object model? 

Thanks for your help,

Matt

--- In flexcoders@yahoogroups.com, Tom Chiverton  wrote:
>
> On Monday 24 Aug 2009, fumeng5 wrote:
> > I'm trying to pass custom data into an AdvancedDataGridRendererProvider
> > instance.
> 
> Normally, the renderer would only be using data from the data grid's 
> dataProvider.
> What are you trying to do ?
> 
> 
> -- 
> Helping to elementarily develop web-enabled 24/7 ubiquitous extensible 
> e-commerce as part of the IT team of the year, '09 and '08
> 
> 
> 
> This email is sent for and on behalf of Halliwells LLP.
> 
> Halliwells LLP is a limited liability partnership registered in England and 
> Wales under registered number OC307980 whose registered office address is at 
> Halliwells LLP, 3 Hardman Square, Spinningfields, Manchester, M3 3EB.  A list 
> of members is available for inspection at the registered office together with 
> a list of those non members who are referred to as partners.  We use the word 
> ?partner? to refer to a member of the LLP, or an employee or consultant with 
> equivalent standing and qualifications. Regulated by the Solicitors 
> Regulation Authority.
> 
> CONFIDENTIALITY
> 
> This email is intended only for the use of the addressee named above and may 
> be confidential or legally privileged.  If you are not the addressee you must 
> not read it and must not use any information contained in nor copy it nor 
> inform any person other than Halliwells LLP or the addressee of its existence 
> or contents.  If you have received this email in error please delete it and 
> notify Halliwells LLP IT Department on 0870 365 2500.
> 
> For more information about Halliwells LLP visit www.halliwells.com.
>




[flexcoders] Pass data into renderer

2009-08-24 Thread fumeng5
Hi - 

I'm trying to pass custom data into an AdvancedDataGridRendererProvider 
instance. 

>From what I've read this is not possible, but has anyone had any success with 
>it? 

Thanks,

Matt



[flexcoders] Pass data into renderer

2009-08-24 Thread fumeng5
Hi - 

I'm trying to pass custom data into an AdvancedDataGridRendererProvider 
instance. 

>From what I've read this is not possible, but has anyone had any success with 
>it? 

Thanks,

Matt



[flexcoders] Pass data into renderer

2009-08-24 Thread fumeng5
Hi - 

I'm trying to pass custom data into an AdvancedDataGridRendererProvider 
instance. 

>From what I've read this is not possible, but has anyone had any success with 
>it? 

Thanks,

Matt



[flexcoders] Re: Creating multidimensional array for AdvancedDataGrid with DataGrid renderer

2009-08-24 Thread fumeng5
--- In flexcoders@yahoogroups.com, "fumeng5"  wrote:
>
> Hi - 
> 
> I'm using an AdvancedDataGrid with a rendererProvider of another DataGrid; 
> meaning when you expand a row another DataGrid appears. I found documentation 
> online that shows how to create the appropriate multidimensional array to 
> feed both DataGrids. The array looks like this:
> 
>  private var dummyData:Array= [
> { app:"Microsoft Outlook", 
> children:[[
>   
> {type:'Activity',metric:'Outlook Send Mail 
> Latency',value:'70%',deviation:'85%'},
>   
> {type:'Process',metric:'Outlook.EXE CPU Load',value:'80%',deviation:'70%'},
>   
> {type:'Profiler',metric:'UI Utilization by 
> Symantec',value:'45%',deviation:'60%'},
>   
> {type:'WMI',metric:'Connection Stats Failed 
> RPCs',value:'85%',deviation:'85%'} ]]}]}];
> 
> I plug it in and both DataGrids can point to a dataField and get the data no 
> problem. The issue now is that I have to create this type of multidimensional 
> array on the fly, using an array I pass back from XML that is not 
> multidimensional, i.e. the Array looks like this:
> 
> Array [0] myDTO
> _property
> _property
> _property
> 
> Array [1] myDTO
> _property
> _property
> _property
> 
> Some of the properties populate the first grid and some populate the inner 
> grid. Do I have it wrong here? Should I be passing back a multidimensional 
> array instead or can I make it work like this? 
> 
> Any tips are greatly appreciated. 
> 
> Thanks,
> 
> Matt
>
I figured out how to do it, by group my flat data. Below is an example. 









Hope this helps somebody. 



[flexcoders] Creating multidimensional array for AdvancedDataGrid with DataGrid renderer

2009-08-24 Thread fumeng5
Hi - 

I'm using an AdvancedDataGrid with a rendererProvider of another DataGrid; 
meaning when you expand a row another DataGrid appears. I found documentation 
online that shows how to create the appropriate multidimensional array to feed 
both DataGrids. The array looks like this:

 private var dummyData:Array= [
{ app:"Microsoft Outlook", 
children:[[

{type:'Activity',metric:'Outlook Send Mail 
Latency',value:'70%',deviation:'85%'},

{type:'Process',metric:'Outlook.EXE CPU Load',value:'80%',deviation:'70%'},

{type:'Profiler',metric:'UI Utilization by 
Symantec',value:'45%',deviation:'60%'},

{type:'WMI',metric:'Connection Stats Failed 
RPCs',value:'85%',deviation:'85%'} ]]}]}];

I plug it in and both DataGrids can point to a dataField and get the data no 
problem. The issue now is that I have to create this type of multidimensional 
array on the fly, using an array I pass back from XML that is not 
multidimensional, i.e. the Array looks like this:

Array [0] myDTO
_property
_property
_property

Array [1] myDTO
_property
_property
_property

Some of the properties populate the first grid and some populate the inner 
grid. Do I have it wrong here? Should I be passing back a multidimensional 
array instead or can I make it work like this? 

Any tips are greatly appreciated. 

Thanks,

Matt



[flexcoders] Create XML for AnyChart component

2009-08-20 Thread fumeng5
Hi, 

I'm writing XML for an AnyChart component and I am having troubles setting the 
value of a node attribute to a dynamic element, i.e. 

// The method accepts a DTO
private function createSemiCircularGaugeXML( gauge:GaugeDTO ):XML

// I can write it here
{gauge.label}

// But not here as an attribute


What's the proper syntax for adding dynamic data as an attribute? Am I doing 
this wrong? Is there some proprietary way of doing it for AnyChart? I couldn't 
figure it out from their documentation.

Any tips would be very helpful. 

Thanks,

Matt



[flexcoders] Paging collections with more than 1 filter

2009-06-27 Thread fumeng5
Hi,

I have an ArrayCollection that I use as a dataProvider for a DataGrid. To 
enable paging, I filter the collection. The problem is that I have another 
filter function for that collection where a user can retrieve rows via string 
search. 

This works fine except when the search returns multiple pages because on the 
first page click, the original (unfiltered) collection is used instead of the 
collection that I just filtered. 

I suppose that I could create a copied collection on string search and then set 
a flag to let my other filter function know which collection to use. However, I 
was hoping there's a more elegant solution. 

Anybody know one? 

Thanks for any helpful tips...



[flexcoders] Re: SuperTabNavigator closeButtonSkin

2009-06-21 Thread fumeng5
SOLVED: If I change where I put the tabCloseButtonStyleName declaration, it 
works. You seem to need to put it in the declaration for the lastTabStyleName. 
--- In flexcoders@yahoogroups.com, "fumeng5"  wrote:
>
> Hi - 
> 
> When I set the styleName for a SuperTabNavigator, the default 'x' close 
> button disappears; rather, it turns into a radioButton looking circle. I 
> searched for a solution and found something posted by Doug McCune with a 
> solution to define a custom tabCloseButtonStyleName. I did this and it still 
> didn't work: 
> 
> .MailStreamTab {
>   tabStyleName: tabNavigatorTab;
>   firstTabStyleName: tabNavigatorFirstTab;
>   selectedTabTextStyleName: tabBarSelectedTabText;
>   lastTabStyleName: tabNavigatorLastTab;
>   tabOffset: 12;
>   horizontalGap: 6;
>   backgroundColor: #44638F;
>   color: #00;
>   borderStyle: solid;
>   borderSides: top;
>   borderColor: #44638F;
> }
> 
> .tabNavigatorFirstTab {
>   borderColor: #44638F;
>   themeColor: #44638F;
>   fillAlphas: 1.0, 1.0, 1.0, 1.0;
>   fillColors: #FF, #DCDDF0, #44638F, #44638F;
>   paddingLeft: 15;
>   paddingRight: 15;
>   paddingTop: 5;
>   paddingBottom: 5;
>   textRollOverColor: #FF;
>   disabledColor: #DD;
>   textSelectedColor: #FF;
>   color: #00;
>   overSkin: 
> Embed(source="../assets/Common/TabBar-tab_MSTabs_overSkin.png");
> }
> 
> .tabBarSelectedTabText {
>   color: #FF;
> }
> 
> .tabNavigatorTab {
>   borderColor: #44638F;
>   themeColor: #44638F;
>   fillAlphas: 1.0, 1.0, 1.0, 1.0;
>   fillColors: #FF, #DCDDF0, #44638F, #44638F;
>   paddingLeft: 15;
>   paddingRight: 15;
>   paddingBottom: 5;
>   paddingTop: 5;
>   textRollOverColor: #FF;
>   textSelectedColor: #FF;
>   disabledColor: #DD;
>   color: #00;
>   overSkin: 
> Embed(source="../assets/Common/TabBar-tab_MSTabs_overSkin.png");
>   cornerRadius: 4;
>   tabCloseButtonStyleName: customCloseButton;
> }
> 
> .customCloseButton {
> upSkin: Embed('../assets/Settings/plusArrow.jpg');
> downSkin: Embed('../assets/Settings/plusArrow.jpg');
> overSkin: Embed('../assets/Settings/plusArrow.jpg');
> 
> }
> 
> Can anyone see where I might be going wrong here? 
> 
> Thank you in advance for any helpful tips. 
> 
> Matt
>




[flexcoders] SuperTabNavigator closeButtonSkin

2009-06-21 Thread fumeng5
Hi - 

When I set the styleName for a SuperTabNavigator, the default 'x' close button 
disappears; rather, it turns into a radioButton looking circle. I searched for 
a solution and found something posted by Doug McCune with a solution to define 
a custom tabCloseButtonStyleName. I did this and it still didn't work: 

.MailStreamTab {
tabStyleName: tabNavigatorTab;
firstTabStyleName: tabNavigatorFirstTab;
selectedTabTextStyleName: tabBarSelectedTabText;
lastTabStyleName: tabNavigatorLastTab;
tabOffset: 12;
horizontalGap: 6;
backgroundColor: #44638F;
color: #00;
borderStyle: solid;
borderSides: top;
borderColor: #44638F;
}

.tabNavigatorFirstTab {
borderColor: #44638F;
themeColor: #44638F;
fillAlphas: 1.0, 1.0, 1.0, 1.0;
fillColors: #FF, #DCDDF0, #44638F, #44638F;
paddingLeft: 15;
paddingRight: 15;
paddingTop: 5;
paddingBottom: 5;
textRollOverColor: #FF;
disabledColor: #DD;
textSelectedColor: #FF;
color: #00;
overSkin: 
Embed(source="../assets/Common/TabBar-tab_MSTabs_overSkin.png");
}

.tabBarSelectedTabText {
color: #FF;
}

.tabNavigatorTab {
borderColor: #44638F;
themeColor: #44638F;
fillAlphas: 1.0, 1.0, 1.0, 1.0;
fillColors: #FF, #DCDDF0, #44638F, #44638F;
paddingLeft: 15;
paddingRight: 15;
paddingBottom: 5;
paddingTop: 5;
textRollOverColor: #FF;
textSelectedColor: #FF;
disabledColor: #DD;
color: #00;
overSkin: 
Embed(source="../assets/Common/TabBar-tab_MSTabs_overSkin.png");
cornerRadius: 4;
tabCloseButtonStyleName: customCloseButton;
}

.customCloseButton {
upSkin: Embed('../assets/Settings/plusArrow.jpg');
downSkin: Embed('../assets/Settings/plusArrow.jpg');
overSkin: Embed('../assets/Settings/plusArrow.jpg');

}

Can anyone see where I might be going wrong here? 

Thank you in advance for any helpful tips. 

Matt 




[flexcoders] Re: Adding a close button to a TabBar

2009-06-20 Thread fumeng5
Just what I was looking for; thank you. 

--- In flexcoders@yahoogroups.com, Tom McNeer  wrote:
>
> Take a look at Doug McCune's SuperTabNavigator. It can have a close box and
> lots of other stuff.
> 
> Here's a blog 
> entryabout
> it.
> 
> And here's the link to the entire flexlib
> (which includes the SuperTabNavigator)
> on Google Code.
> 
> -- 
> Thanks,
> 
> Tom
> 
> Tom McNeer
> MediumCool
> http://www.mediumcool.com
> 1735 Johnson Road NE
> Atlanta, GA 30306
> 404.589.0560
>




[flexcoders] Adding a close button to a TabBar

2009-06-19 Thread fumeng5
Hi --

I'm trying to add a close button to a tab in a TabNavigator component. I 
searched the archives and found a post that is nearly 4 years old and was 
hoping there was something newer. 

My Tab is a VBox and I set its icon property to an image. But that image 
appears to the left; how can I align it to the right? Then, how can I assign it 
a click event? 

Any guidance is very much appreciated. 

Thank you



[flexcoders] Re: Adding Repeater elements to different containers

2009-06-18 Thread fumeng5
Thank you, that's a very good idea. I also just did it by creating a Repeater 
for each row; and each Repeater has a sliced subset of the main dataProvider 
collection. 

--- In flexcoders@yahoogroups.com, "valdhor"  wrote:
>
> Create a custom component with the button in it and then repeat the component.
> 
> 
> --- In flexcoders@yahoogroups.com, "fumeng5"  wrote:
> >
> > Hi,
> > 
> > I am creating a number of buttons with a repeater but I don't want them all 
> > in one container. Basically, I want 3 rows. How do I accomplish this? Every 
> > Repeater example I see has its elements wrapped in a simple VBox or HBox. 
> > 
> > Thanks for any tips...
> >
>




[flexcoders] Adding Repeater elements to different containers

2009-06-18 Thread fumeng5
Hi,

I am creating a number of buttons with a repeater but I don't want them all in 
one container. Basically, I want 3 rows. How do I accomplish this? Every 
Repeater example I see has its elements wrapped in a simple VBox or HBox. 

Thanks for any tips...



[flexcoders] Re: Help with a RegExp

2009-06-09 Thread fumeng5
Yeah, I guess that I thought it would limit the String length. But your 
solution worked so thank you!
--- In flexcoders@yahoogroups.com, "valdhor"  wrote:
>
> The "." matches any single character but does not limit the string length so 
> you would also want to check the length of the string as well.
> 
> if(currentID.length == testID.length + 1 && pattern.exec(currentID))
> 
> 
> --- In flexcoders@yahoogroups.com, "fumeng5"  wrote:
> >
> > Hi,
> > 
> > I have a filter function for an array collection that I'm working with. In 
> > this scenario, I start with an ID such as '1'. Based on that, I want to 
> > return '1_1', '1_2', etc... Basically, an underscore followed by 1 digit. 
> > 
> > Here's the code:
> > 
> > var currentID:String = item.id.toString(); // i.e. 1_1, 1_2, etc..
> > var testID:String = buttonID + '_'; // buttonID would equal 1
> > var pattern:RegExp = new RegExp('^' + testID + "."); 
> > 
> > if( pattern.exec( currentID ))
> > return true;
> > else
> > return false;
> > 
> > The problem is that this filter is also returning other IDs such as 
> > '1_1_2', '1_1_3'. I thought the '.' would limit it 1 character only after 
> > the underscore. 
> > 
> > Can anyone see where I may be going wrong? 
> > 
> > Thank you!
> >
>




[flexcoders] Help with a RegExp

2009-06-09 Thread fumeng5
Hi,

I have a filter function for an array collection that I'm working with. In this 
scenario, I start with an ID such as '1'. Based on that, I want to return 
'1_1', '1_2', etc... Basically, an underscore followed by 1 digit. 

Here's the code:

var currentID:String = item.id.toString(); // i.e. 1_1, 1_2, etc..
var testID:String = buttonID + '_'; // buttonID would equal 1
var pattern:RegExp = new RegExp('^' + testID + "."); 

if( pattern.exec( currentID ))
return true;
else
return false;

The problem is that this filter is also returning other IDs such as '1_1_2', 
'1_1_3'. I thought the '.' would limit it 1 character only after the 
underscore. 

Can anyone see where I may be going wrong? 

Thank you!



[flexcoders] Create a naming convention to define multi-level list

2009-06-08 Thread fumeng5
Hi,

I have to devise an ID naming system that'll support lists that are 4-levels 
deep. At any one time, I need to know at what level an element is. I have it up 
to 3-levels but don't know how to do a 4th. In fact, it's starting to look like 
a mess to me and I think I'm overcomplicating it. 

Here's what I have so far: 

Class ID = 1
Class Name = First Class

Now, all subclasses associated with "First Class" are denoted via an underscore 
character, i.e.

Class ID = 1_1
Class Name = Foo One

Class ID = 1_2
Class Name = Foo Two

Here's the 3rd level. It defines a subclass of "Foo Two"

Class ID = 1_2_1
Class Name = Foo Three

And here would be the 4th level. It defines a subclass of "Foo Three"

Class ID = 1_2_1_1
Class Name = Foo Four. 

Am I approaching this the wrong way? Can anyone show me a better way to do 
this? Any tips are very much appreciated. 

Thank you. 





[flexcoders] Re: Need help writing alorithm

2009-05-29 Thread fumeng5
That is exactly what I was looking for. Thank you very much, Ken.

Matt 
--- In flexcoders@yahoogroups.com, "Kenneth Sutherland" 
 wrote:
>
> Not sure I'm getting 100% what you're doing but hopefully this will help
> you.
> 
> For page X you would do:
> 
> Min index = ( X - 1 ) * number of records per page
> 
> Max index = Min + (number of records per page - 1)
> 
> So page 1 gives you:
> 
> Min index is ->(1 - 1) * 4 = 0;
> 
> Max index is -> 0 + (4 - 1 ) = 3;
> 
>  
> 
> Page 4 gives you:
> 
> Min index is ->(4 - 1) * 4 = 12;
> 
> Max index is -> 12 + (4 - 1 ) = 15;
> 
>  
> 
> To get a page number from an index do this:
> 
> Math.floor(Index / number of index per page) + 1;
> 
> So index 3 gives you Math.floor(3 / 4) + 1 = 1;
> 
>  
> 
> So index 14 gives you Math.floor(14 / 4) + 1 = 4;
> 
>  
> 
> (your example below had 5 records per page not 4 as you had typed)
> 
>  
> 
> HTH Kenneth.
> 
>  
> 
>  
> 
> From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
> Behalf Of fumeng5
> Sent: 29 May 2009 15:59
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] Need help writing alorithm
> 
>  
> 
> 
> 
> 
> 
> 
> Hi,
> 
> I'm looking for help writing an algorithm in a filter function I am
> using. Here's the situation: Based on a page number and a number of
> records per page, I want to return all indexes that fall within a
> certain range. There are 4 records per page. 
> 
> For example;
> 
> - page 1 will return indexes 0-4
> - page 2 will return indexes 5 - 9
> - page 3 will return indexes 10 - 14
> etc, etc...
> 
> So, here are the vars:
> 
> var index:int = myCollection.getItemIndex( item );
> var recordsPerPage:int = 4;
> 
> It's embarrassing, but this is what I have so far
> 
> if( page <= index < (page * page + recordsPerPage) )
> return true
> 
> Can anyone offer some helpful insight, please? 
> 
> Thank you for any help. 
> 
> 
> 
> 
> 
> 
> Disclaimer 
> ---
> This electronic message contains information which may be privileged and 
> confidential. The information is intended to be for the use of the 
> individual(s) or entity named above. If you are not the intended recipient, 
> be aware that any disclosure, copying, distribution or use of the contents of 
> this information is prohibited. If you have received this electronic message 
> in error, please notify us by telephone on 0131 476 6000 and delete the 
> material from your computer. 
> Registered in Scotland number: SC 172507. 
> Registered office address: Quay House 142 Commercial Street Edinburgh EH6 
> 6LB. 
> 
> This email message has been scanned for viruses by Mimecast.
> ---
>




[flexcoders] Need help writing alorithm

2009-05-29 Thread fumeng5
Hi,

I'm looking for help writing an algorithm in a filter function I am using. 
Here's the situation: Based on a page number and a number of records per page, 
I want to return all indexes that fall within a certain range. There are 4 
records per page. 

For example;

- page 1 will return indexes 0-4
- page 2 will return indexes 5 - 9
- page 3 will return indexes 10 - 14
etc, etc...

So, here are the vars:

var index:int = myCollection.getItemIndex( item );
var recordsPerPage:int = 4;

It's embarrassing, but this is what I have so far

if( page <= index < (page * page + recordsPerPage) )
return true

Can anyone offer some helpful insight, please? 

Thank you for any help. 


   



[flexcoders] Re: Toggling borderSkin style

2009-05-06 Thread fumeng5
SOLVED:

The solution is instead of nulling out the borderSkin style, set it to a 
Borderless skin, i.e.

package com.skins
{
import mx.core.UIComponent;

public class BorderlessSkin extends UIComponent
{
public function BorderlessSkin()
{
super();
}

override protected function 
updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void{
super.updateDisplayList(unscaledWidth,unscaledHeight);
}

}
}

Hope that helps someone. 
--- In flexcoders@yahoogroups.com, "fumeng5"  wrote:
>
> Hi,
> 
> I have an HBox with a borderSkin property set to a Class I found that draws 
> dashed borders. 
> var imageContainer:HBox = new HBox();
> imageContainer.setStyle('borderSkin',com.skins.DashedBorder);
> 
> When you click on/off the skin I want to toggle the borderSkin property, i.e. 
> remove the dashed lines and make it look selected/unselected, i.e.
> 
> if(container.name != _selectedImage.name){
> container.setStyle('borderStyle',null);   
> container.setStyle('borderThickness',null);
> container.setStyle('borderSkin',null);
> }else{
> _selectedImage.setStyle('borderStyle','solid');   
>   _selectedImage.setStyle('borderThickness', '2');
> _selectedImage.setStyle('borderSkin', com.skins.DashedBorder);
> }
> 
> That doesn't work. It draws the borderSkin just fine when I first instantiate 
> the HBox, but when I start toggling it's gone. 
> 
> However, it works fine if I'm just using a borderColor and not a skin, a la:
> 
> if(container.name != _selectedImage.name){
> container.setStyle('borderStyle',null);   
> container.setStyle('borderThickness',null);
> container.setStyle('borderColor',null);
> }else{
> _selectedImage.setStyle('borderStyle','solid');   
>   _selectedImage.setStyle('borderThickness', '2');
> _selectedImage.setStyle('borderColor', 'green');
> }
> 
> SoI guess you can't toggle borderSkin property...is that right? 
> 
> Thanks for any tips.
>




[flexcoders] Toggling borderSkin style

2009-05-06 Thread fumeng5
Hi,

I have an HBox with a borderSkin property set to a Class I found that draws 
dashed borders. 
var imageContainer:HBox = new HBox();
imageContainer.setStyle('borderSkin',com.skins.DashedBorder);

When you click on/off the skin I want to toggle the borderSkin property, i.e. 
remove the dashed lines and make it look selected/unselected, i.e.

if(container.name != _selectedImage.name){
container.setStyle('borderStyle',null); 
container.setStyle('borderThickness',null);
container.setStyle('borderSkin',null);
}else{  
_selectedImage.setStyle('borderStyle','solid'); 
_selectedImage.setStyle('borderThickness', '2');
_selectedImage.setStyle('borderSkin', com.skins.DashedBorder);
}

That doesn't work. It draws the borderSkin just fine when I first instantiate 
the HBox, but when I start toggling it's gone. 

However, it works fine if I'm just using a borderColor and not a skin, a la:

if(container.name != _selectedImage.name){
container.setStyle('borderStyle',null); 
container.setStyle('borderThickness',null);
container.setStyle('borderColor',null);
}else{  
_selectedImage.setStyle('borderStyle','solid'); 
_selectedImage.setStyle('borderThickness', '2');
_selectedImage.setStyle('borderColor', 'green');
}

SoI guess you can't toggle borderSkin property...is that right? 

Thanks for any tips. 




[flexcoders] Re: Sorting VBox elements based on an XML ID

2009-05-03 Thread fumeng5
SOLVED: I was using the right RegEx expression but on the wrong elements. I had 
it backwards. 

The solution is this:

var pattern:RegExp = new RegExp('^' + activeID + ".*"); 
pattern.test( currentID )
--- In flexcoders@yahoogroups.com, "fumeng5"  wrote:
>
> Thank you. That expression is bringing back only itself, i.e. the element in 
> the DP with the ID I'm testing against. 
> 
> I'm hoping to have an element with an ID of '3', to bring back '31', '32', 
> etc...
> 
> I've adjusted the expression thinking it will do the trick but it doesn't 
> seem to cut it:
> 
> var pattern:RegExp = new RegExp(currentID + "\d*");
> 
> Doesn't this say as long as the test string has the currentID at the 
> beginning plus any digits after it???
> 
> and then i test the string like this:
> 
> activeID.match( pattern ) 
> 
> thanks for your help. 
> 
> matt
> --- In flexcoders@yahoogroups.com, thomas parquier  wrote:
> >
> > I'm not sure currentID is replaced in slash syntax, so :
> > var pattern:RegExp = new RegExp('^'+currentID);
> > should work.
> > 
> > thomas
> > ---
> > http://www.web-attitude.fr/
> > msn : thomas.parquier@
> > softphone : sip:webattitude@ 
> > téléphone portable : +33601 822 056
> > 
> > 
> > 2009/5/3 fumeng5 
> > 
> > >
> > >
> > > Wow, works like a charm; big thanks.
> > >
> > > And if I want to test it against IDs with 3 characters I'm thinking that
> > > RegExes are the way to go. Here's what I've got that isn't quite working.
> > >
> > > var currentID:String = item.id.toString();
> > > var pattern:RegExp = /^/;
> > >
> > > if ( pattern.test( activeID ) )
> > >
> > > return true;
> > > else
> > > return false;
> > >
> > > I'm thinking my pattern will test for the currentID (no matter how many
> > > characters) at the beginning of the activeID. But it's not making any
> > > matches. Am I that far off?
> > >
> > > --- In flexcoders@yahoogroups.com , "Tracy
> > > Spratt"  wrote:
> > > >
> > > > Assuming strings:
> > > >
> > > > If (currentID.charAt(0) == activeID) { //if the first
> > > > character matches the activeId
> > > >
> > > > return true;
> > > >
> > > > }
> > > >
> > > > Else {
> > > >
> > > > return false;
> > > >
> > > > }
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > If the ids are numbers then the logic will be different.
> > > >
> > > >
> > > >
> > > > Tracy Spratt,
> > > >
> > > > Lariat Services, development services available
> > > >
> > > > _
> > > >
> > > > From: flexcoders@yahoogroups.com  [mailto:
> > > flexcoders@yahoogroups.com ] On
> > > > Behalf Of fumeng5
> > > > Sent: Saturday, May 02, 2009 5:19 PM
> > > > To: flexcoders@yahoogroups.com 
> > > > Subject: [flexcoders] Re: Sorting VBox elements based on an XML ID
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > I'm creating an ArrayCollection based on the XML loaded in. I iterate
> > > over
> > > > that and build the UI. I have a simple conditional that decides whether
> > > to
> > > > run one block of code and create a button or run another and create a
> > > radio
> > > > button. I think that part is fine as it is right now.
> > > >
> > > > I've never worked with a Filter function before but what I'm
> > > understanding
> > > > is that I can get the ID for the button clicked without a problem. I've
> > > > tested that and it works. I just don't know how to compare that ID with
> > > all
> > > > the other IDs and return only the ones I want.
> > > >
> > > > This is what I have so far for the Filter function:
> > > >
> > > > private function stateFilterFunc(item:Object):Boolean {
> > > > var currentID:String = item.id; // The ID of the current item in the
> > > > DataProvider
> > > > var activeID:Strin

[flexcoders] Re: Sorting VBox elements based on an XML ID

2009-05-03 Thread fumeng5
Thank you. That expression is bringing back only itself, i.e. the element in 
the DP with the ID I'm testing against. 

I'm hoping to have an element with an ID of '3', to bring back '31', '32', 
etc...

I've adjusted the expression thinking it will do the trick but it doesn't seem 
to cut it:

var pattern:RegExp = new RegExp(currentID + "\d*");

Doesn't this say as long as the test string has the currentID at the beginning 
plus any digits after it???

and then i test the string like this:

activeID.match( pattern ) 

thanks for your help. 

matt
--- In flexcoders@yahoogroups.com, thomas parquier  wrote:
>
> I'm not sure currentID is replaced in slash syntax, so :
> var pattern:RegExp = new RegExp('^'+currentID);
> should work.
> 
> thomas
> ---
> http://www.web-attitude.fr/
> msn : thomas.parqu...@...
> softphone : sip:webattit...@... 
> téléphone portable : +33601 822 056
> 
> 
> 2009/5/3 fumeng5 
> 
> >
> >
> > Wow, works like a charm; big thanks.
> >
> > And if I want to test it against IDs with 3 characters I'm thinking that
> > RegExes are the way to go. Here's what I've got that isn't quite working.
> >
> > var currentID:String = item.id.toString();
> > var pattern:RegExp = /^/;
> >
> > if ( pattern.test( activeID ) )
> >
> > return true;
> > else
> > return false;
> >
> > I'm thinking my pattern will test for the currentID (no matter how many
> > characters) at the beginning of the activeID. But it's not making any
> > matches. Am I that far off?
> >
> > --- In flexcoders@yahoogroups.com , "Tracy
> > Spratt"  wrote:
> > >
> > > Assuming strings:
> > >
> > > If (currentID.charAt(0) == activeID) { //if the first
> > > character matches the activeId
> > >
> > > return true;
> > >
> > > }
> > >
> > > Else {
> > >
> > > return false;
> > >
> > > }
> > >
> > >
> > >
> > >
> > >
> > > If the ids are numbers then the logic will be different.
> > >
> > >
> > >
> > > Tracy Spratt,
> > >
> > > Lariat Services, development services available
> > >
> > > _
> > >
> > > From: flexcoders@yahoogroups.com  [mailto:
> > flexcoders@yahoogroups.com ] On
> > > Behalf Of fumeng5
> > > Sent: Saturday, May 02, 2009 5:19 PM
> > > To: flexcoders@yahoogroups.com 
> > > Subject: [flexcoders] Re: Sorting VBox elements based on an XML ID
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > I'm creating an ArrayCollection based on the XML loaded in. I iterate
> > over
> > > that and build the UI. I have a simple conditional that decides whether
> > to
> > > run one block of code and create a button or run another and create a
> > radio
> > > button. I think that part is fine as it is right now.
> > >
> > > I've never worked with a Filter function before but what I'm
> > understanding
> > > is that I can get the ID for the button clicked without a problem. I've
> > > tested that and it works. I just don't know how to compare that ID with
> > all
> > > the other IDs and return only the ones I want.
> > >
> > > This is what I have so far for the Filter function:
> > >
> > > private function stateFilterFunc(item:Object):Boolean {
> > > var currentID:String = item.id; // The ID of the current item in the
> > > DataProvider
> > > var activeID:String = buttonID; // The ID of the button clicked on
> > >
> > > if ( (activeID< currentID) )
> > > return true;
> > > else
> > > return false;
> > > }
> > >
> > > So, how do I build the conditional that'll allow me to, in the case where
> > ID
> > > = 1, filter to show IDs that have 1, 11, 12, 13, etc...
> > >
> > > And the IDs are 1 and 2 characters.
> > >
> > > Thank you for your help.
> > >
> > > Matt
> > >
> > > --- In flexcod...@yahoogro 
> > > <mailto:flexcoders%40yahoogroups.com>
> > ups.com,
> > > "Tracy Spratt"  wrote:
> > > >
> > > > In that case I would create a component that had two states, one radio
> > and
> > > > 

[flexcoders] Re: Sorting VBox elements based on an XML ID

2009-05-02 Thread fumeng5
Wow, works like a charm; big thanks. 

And if I want to test it against IDs with 3 characters I'm thinking that 
RegExes are the way to go. Here's what I've got that isn't quite working. 

var currentID:String = item.id.toString();
var pattern:RegExp = /^/; 

if ( pattern.test( activeID ) )
  return true;
else
  return false;

I'm thinking my pattern will test for the currentID (no matter how many 
characters) at the beginning of the activeID. But it's not making any matches. 
Am I that far off? 

--- In flexcoders@yahoogroups.com, "Tracy Spratt"  wrote:
>
> Assuming strings:
> 
> If (currentID.charAt(0) == activeID)  {   //if the first
> character matches the activeId
> 
> return true;
> 
> }
> 
> Else  {
> 
> return false;
> 
> }
> 
>  
> 
>  
> 
> If the ids are numbers then the logic will be different.
> 
>  
> 
> Tracy Spratt,
> 
> Lariat Services, development services available
> 
>   _  
> 
> From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
> Behalf Of fumeng5
> Sent: Saturday, May 02, 2009 5:19 PM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] Re: Sorting VBox elements based on an XML ID
> 
>  
> 
> 
> 
> 
> 
> 
> I'm creating an ArrayCollection based on the XML loaded in. I iterate over
> that and build the UI. I have a simple conditional that decides whether to
> run one block of code and create a button or run another and create a radio
> button. I think that part is fine as it is right now. 
> 
> I've never worked with a Filter function before but what I'm understanding
> is that I can get the ID for the button clicked without a problem. I've
> tested that and it works. I just don't know how to compare that ID with all
> the other IDs and return only the ones I want.
> 
> This is what I have so far for the Filter function:
> 
> private function stateFilterFunc(item:Object):Boolean {
> var currentID:String = item.id; // The ID of the current item in the
> DataProvider
> var activeID:String = buttonID; // The ID of the button clicked on
> 
> if ( (activeID< currentID) )
> return true;
> else
> return false;
> }
> 
> So, how do I build the conditional that'll allow me to, in the case where ID
> = 1, filter to show IDs that have 1, 11, 12, 13, etc...
> 
> And the IDs are 1 and 2 characters. 
> 
> Thank you for your help.
> 
> Matt
> 
> --- In flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com,
> "Tracy Spratt"  wrote:
> >
> > In that case I would create a component that had two states, one radio and
> > one button, and repeat that, passing in the entire currentItem in a setter
> > function, and set the state based on the passed in data.
> > 
> > 
> > 
> > On the filter, are you asking for an e4x expression?
> > 
> > 
> > 
> > One tip is that in an e4x expression, you can use a function in place of
> > in-line expressions, pass a ref to the current node into the function, do
> > whatever logic and return a Boolean if the node should be included.
> > 
> > 
> > 
> > Are all the ids 1 or 2 chars only?
> > 
> > 
> > 
> > Tracy Spratt,
> > 
> > Lariat Services, development services available
> > 
> > _ 
> > 
> > From: flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com
> [mailto:flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com]
> On
> > Behalf Of fumeng5
> > Sent: Saturday, May 02, 2009 11:58 AM
> > To: flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com
> > Subject: [flexcoders] Re: Sorting VBox elements based on an XML ID
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > I've got it almost working now. However, I'm trying to write a Filter
> > function. This function will compare an ID and return a subset of IDs.
> > 
> > For example, an ID of 1 will return IDs with 11, 12, 13; an ID of 2 will
> > return IDs with 21, 22, 23, etc...
> > 
> > How do I compare IDs as strings to return what I want? Any tip in the
> right
> > direction is greatly appreciated. 
> > 
> > --- In flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com,
> > "fumeng5"  wrote:
> > >
> > > Hmmm...I didn't know about the Repeater component, that's quite useful.
> > However, I should have explained that I'm not working with all the same
> > comp

[flexcoders] Re: Sorting VBox elements based on an XML ID

2009-05-02 Thread fumeng5
I'm creating an ArrayCollection based on the XML loaded in. I iterate over that 
and build the UI. I have a simple conditional that decides whether to run one 
block of code and create a button or run another and create a radio button. I 
think that part is fine as it is right now. 

I've never worked with a Filter function before but what I'm understanding is 
that I can get the ID for the button clicked without a problem. I've tested 
that and it works. I just don't know how to compare that ID with all the other 
IDs and return only the ones I want.

This is what I have so far for the Filter function:

private function stateFilterFunc(item:Object):Boolean {
var currentID:String = item.id; // The ID of the current item in 
the DataProvider
var activeID:String = buttonID; // The ID of the button clicked on

if ( (activeID< currentID) )
return true;
else
return false;
}

So, how do I build the conditional that'll allow me to, in the case where ID = 
1, filter to show IDs that have 1, 11, 12, 13, etc...

And the IDs are 1 and 2 characters. 

Thank you for your help.

Matt

--- In flexcoders@yahoogroups.com, "Tracy Spratt"  wrote:
>
> In that case I would create a component that had two states, one radio and
> one button, and repeat that, passing in the entire currentItem in a setter
> function, and set the state based on the passed in data.
> 
>  
> 
> On the filter, are you asking for an e4x expression?
> 
>  
> 
> One tip is that in an e4x expression, you can use a function in place of
> in-line expressions, pass a ref to the current node into the function, do
> whatever logic and return a Boolean if the node should be included.
> 
>  
> 
> Are all the ids 1 or 2 chars only?
> 
>  
> 
> Tracy Spratt,
> 
> Lariat Services, development services available
> 
>   _  
> 
> From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
> Behalf Of fumeng5
> Sent: Saturday, May 02, 2009 11:58 AM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] Re: Sorting VBox elements based on an XML ID
> 
>  
> 
> 
> 
> 
> 
> 
> I've got it almost working now. However, I'm trying to write a Filter
> function. This function will compare an ID and return a subset of IDs.
> 
> For example, an ID of 1 will return IDs with 11, 12, 13; an ID of 2 will
> return IDs with 21, 22, 23, etc...
> 
> How do I compare IDs as strings to return what I want? Any tip in the right
> direction is greatly appreciated. 
> 
> --- In flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com,
> "fumeng5"  wrote:
> >
> > Hmmm...I didn't know about the Repeater component, that's quite useful.
> However, I should have explained that I'm not working with all the same
> components. The XML is more complex than I posted. 
> > 
> > Here's what it really looks like:
> > 
> >  
> > 1
> > First Class
> > 
> > 
> > 
> >  
> > 2
> > Second Class
> > 1.31
> > 
> > 
> >  
> > 11
> > Subclass of first class
> > 
> > 
> > So my conditional for building the UI goes like this; if Class_Amount is
> empty, this element has a subclass, i.e. 
> > 
> > for (var i:int=0; i > 
> > if(classDataNode.Class_Amount == ''){
> > var myButton:Button = new Button();
> > myButton.label = classData[i].Class_Name;
> > addChild( myButton );
> > }else{
> > var myRadioButton:RadioButton = new RadioButton();
> > myRadioButton.label = classData[i].Class_Name;
> > addChild( myRadioButton );
> > }
> > }
> > 
> > I guess that with this scenario I'm not able to use the Repeater compnent
> and will be forced to create a custom sorting of VBox child elements. 
> > 
> > Is that right? 
> > 
> > --- In flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com,
> "Tracy Spratt"  wrote:
> > >
> > > Use Repeater, and then just sort the dataProvider.
> > > 
> > > 
> > > 
> > > Tracy Spratt,
> > > 
> > > Lariat Services, development services available
> > > 
> > > _ 
> > > 
> > > From: flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com
> [mailto:flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com]
> On
> > > Behalf Of fumeng5
> > > Sent: Friday, May 01, 2009 3:15 PM
> > > To: flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com
> > >

[flexcoders] Re: Sorting VBox elements based on an XML ID

2009-05-02 Thread fumeng5
I've got it almost working now. However, I'm trying to write a Filter function. 
This function will compare an ID and return a subset of IDs.

For example, an ID of 1 will return IDs with 11, 12, 13; an ID of 2 will return 
 IDs with 21, 22, 23, etc...

How do I compare IDs as strings to return what I want? Any tip in the right 
direction is greatly appreciated. 


--- In flexcoders@yahoogroups.com, "fumeng5"  wrote:
>
> Hmmm...I didn't know about the Repeater component, that's quite useful. 
> However, I should have explained that I'm not working with all the same 
> components. The XML is more complex than I posted. 
> 
> Here's what it really looks like:
> 
>  
> 1
> First Class
> 
> 
>  
>  
> 2
> Second Class
> 1.31
> 
> 
>  
> 11
> Subclass of first class
> 
> 
> So my conditional for building the UI goes like this; if Class_Amount is 
> empty, this element has a subclass, i.e. 
> 
> for (var i:int=0; i 
> if(classDataNode.Class_Amount == ''){
> var myButton:Button = new Button();
> myButton.label = classData[i].Class_Name;
> addChild( myButton );
> }else{
> var myRadioButton:RadioButton = new RadioButton();
> myRadioButton.label = classData[i].Class_Name;
> addChild( myRadioButton );
> }
>  }
> 
> I guess that with this scenario I'm not able to use the Repeater compnent and 
> will be forced to create a custom sorting of VBox child elements. 
> 
> Is that right? 
> 
> --- In flexcoders@yahoogroups.com, "Tracy Spratt"  wrote:
> >
> > Use Repeater, and then just sort the dataProvider.
> > 
> >  
> > 
> > Tracy Spratt,
> > 
> > Lariat Services, development services available
> > 
> >   _  
> > 
> > From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
> > Behalf Of fumeng5
> > Sent: Friday, May 01, 2009 3:15 PM
> > To: flexcoders@yahoogroups.com
> > Subject: [flexcoders] Sorting VBox elements based on an XML ID
> > 
> >  
> > 
> > 
> > 
> > 
> > 
> > 
> > Hi,
> > 
> > I've got something that I'm trying to troubleshoot and I can't figure it
> > out. I have an XML file full of elements, i.e.
> > 
> >  
> > 1
> > First Class
> > 
> > 
> >  
> > 2
> > Second Class
> > 
> > 
> >  
> > 11
> > Subclass of first class
> > 
> > 
> >  
> > 21
> > Subclass of second class
> > 
> > 
> > ...
> > 
> > Some classes have subclasses, i.e. Class ID 1 has a subclass of Class ID 11.
> > And Class ID 2 has a subclass of Class ID 21. 
> > 
> > My XML parsing class creates UI elements based on the XML and adds them to a
> > VBox, i.e. 
> > 
> > private var classXML:XML;
> > private var classData:XMLList;
> > 
> > for (var i:int=0; i > 
> > var myButton:Button = new Button();
> > myButton.label = classData[i].Class_Name;
> > 
> > addChild( myButton );
> > }
> > 
> > When the XML first loads, the elements will be added to the VBox in the way
> > they're defined in the XML. 
> > 
> > However, I have to add the functionality that if a class is clicked it goes
> > to the top of the VBox and all its subclasses are listed right under it i.e.
> > Class ID 1 is clicked, it goes to the top with Class ID 11 right under it. 
> > 
> > This is what I don't know how to do. What is the best way to resort children
> > in a VBox based on ID? 
> > 
> > Any tips are very much appreciated. 
> > 
> > Thank you.
> >
>




[flexcoders] Re: Sorting VBox elements based on an XML ID

2009-05-01 Thread fumeng5
Hmmm...I didn't know about the Repeater component, that's quite useful. 
However, I should have explained that I'm not working with all the same 
components. The XML is more complex than I posted. 

Here's what it really looks like:

 
1
First Class


 
 
2
Second Class
1.31


 
11
Subclass of first class


So my conditional for building the UI goes like this; if Class_Amount is empty, 
this element has a subclass, i.e. 

for (var i:int=0; i wrote:
>
> Use Repeater, and then just sort the dataProvider.
> 
>  
> 
> Tracy Spratt,
> 
> Lariat Services, development services available
> 
>   _  
> 
> From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
> Behalf Of fumeng5
> Sent: Friday, May 01, 2009 3:15 PM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] Sorting VBox elements based on an XML ID
> 
>  
> 
> 
> 
> 
> 
> 
> Hi,
> 
> I've got something that I'm trying to troubleshoot and I can't figure it
> out. I have an XML file full of elements, i.e.
> 
>  
> 1
> First Class
> 
> 
>  
> 2
> Second Class
> 
> 
>  
> 11
> Subclass of first class
> 
> 
>  
> 21
> Subclass of second class
> 
> 
> ...
> 
> Some classes have subclasses, i.e. Class ID 1 has a subclass of Class ID 11.
> And Class ID 2 has a subclass of Class ID 21. 
> 
> My XML parsing class creates UI elements based on the XML and adds them to a
> VBox, i.e. 
> 
> private var classXML:XML;
> private var classData:XMLList;
> 
> for (var i:int=0; i 
> var myButton:Button = new Button();
> myButton.label = classData[i].Class_Name;
> 
> addChild( myButton );
> }
> 
> When the XML first loads, the elements will be added to the VBox in the way
> they're defined in the XML. 
> 
> However, I have to add the functionality that if a class is clicked it goes
> to the top of the VBox and all its subclasses are listed right under it i.e.
> Class ID 1 is clicked, it goes to the top with Class ID 11 right under it. 
> 
> This is what I don't know how to do. What is the best way to resort children
> in a VBox based on ID? 
> 
> Any tips are very much appreciated. 
> 
> Thank you.
>




[flexcoders] Sorting VBox elements based on an XML ID

2009-05-01 Thread fumeng5
Hi,

I've got something that I'm trying to troubleshoot and I can't figure it out. I 
have an XML file full of elements, i.e.

 
1
First Class


 
2
Second Class


 
11
Subclass of first class


 
21
Subclass of second class


...

Some classes have subclasses, i.e. Class ID 1 has a subclass of Class ID 11. 
And Class ID 2 has a subclass of Class ID 21. 

My XML parsing class creates UI elements based on the XML and adds them to a 
VBox, i.e. 

private var classXML:XML;
private var classData:XMLList;

for (var i:int=0; i

[flexcoders] Re: Outputting a variable into htmlText

2009-04-30 Thread fumeng5
You are exactly right! It worked perfectly when I added a listener for the 
creationComplete event in my constructor and set the handler to be init. 

I learned something new today. Thank you very, very much for your help. 
--- In flexcoders@yahoogroups.com, "valdhor"  wrote:
>
> I don't believe you need that. I do what you are doing all the time although 
> I don't do it in the init method (I am assuming you are calling the init 
> method on initialize of the component?). I would try calling it on 
> creationComplete (That's what I do). You may find that the initialize method 
> runs before you get a chance to set acctName.
> 
> 
> --- In flexcoders@yahoogroups.com, "fumeng5"  wrote:
> >
> > The String I'm constructing is inside a PopUp dialog bog. I set it from 
> > another component a la:
> > 
> > private function createAcct():void {
> > 
> > acctDialog.acctName   = accountName;
> > PopUpManager.addPopUp(acctDialog,this as Canvas,true);
> > }
> > 
> > The accessor methods for acctName look like this:
> > 
> > private var _acctName:String;
> > public function set acctName(s:String):void{
> > acctName = s;
> > }
> > [Bindable]
> > public function get acctName():String{
> > return _acctName;
> > }
> > 
> > And I set the content.htmlText property in the init() method when acctName 
> > is null. So, I think the solution is to use binding utils in the init() 
> > method, like this:
> > 
> > BindingUtils.bindProperty(content,'htmlText',msgString);
> > 
> > but I think I'm missing an argument in there...i think it needs 4 args. 
> > 
> > Thank you very much for your help. 
> > 
> > 
> > 
> > 
> > 
> > --- In flexcoders@yahoogroups.com, "valdhor"  wrote:
> > >
> > > How is acctName created?
> > > 
> > > 
> > > --- In flexcoders@yahoogroups.com, "fumeng5"  wrote:
> > > >
> > > > Ok, I see what you're saying. So here's the constructor for my 
> > > > component that is responsible for all this:
> > > > 
> > > > public function CreateAcctDialog()
> > > > {
> > > > super();
> > > > init();
> > > > }
> > > > 
> > > > ...and init():
> > > > 
> > > > private function init():void
> > > > {   
> > > > msgString = "The account " + this.acctName + 
> > > > " has been created "
> > > > }
> > > > 
> > > > and the last part: 
> > > > content.htmlText = msgString;
> > > > 
> > > > This comes out as: The account null has been created. 
> > > > 
> > > > I thought the init() method would handle the proper setting of this 
> > > > var.
> > > > 
> > > > 
> > > > --- In flexcoders@yahoogroups.com, "valdhor"  wrote:
> > > > >
> > > > > For the first part, you are setting the value of msgString during its 
> > > > > declaration. At this point acctName will be null. You would need to 
> > > > > declare msgString and then assign it in a creationComplete handler.
> > > > > 
> > > > > Secondly, you can't do this in ActionScript:
> > > > > 
> > > > > content.htmlText = "{msgString}"
> > > > > 
> > > > > You have to do this:
> > > > > 
> > > > > content.htmlText = msgString
> > > > > 
> > > > > The "{}" syntax is to bind a variable in MXML.
> > > > > 
> > > > > Also, For the above, the variable does not need to be bindable.
> > >
> >
>




[flexcoders] Re: Outputting a variable into htmlText

2009-04-30 Thread fumeng5
The String I'm constructing is inside a PopUp dialog bog. I set it from another 
component a la:

private function createAcct():void {

acctDialog.acctName   = accountName;
PopUpManager.addPopUp(acctDialog,this as Canvas,true);
}

The accessor methods for acctName look like this:

private var _acctName:String;
public function set acctName(s:String):void{
acctName = s;
}
[Bindable]
public function get acctName():String{
return _acctName;
}

And I set the content.htmlText property in the init() method when acctName is 
null. So, I think the solution is to use binding utils in the init() method, 
like this:

BindingUtils.bindProperty(content,'htmlText',msgString);

but I think I'm missing an argument in there...i think it needs 4 args. 

Thank you very much for your help. 





--- In flexcoders@yahoogroups.com, "valdhor"  wrote:
>
> How is acctName created?
> 
> 
> --- In flexcoders@yahoogroups.com, "fumeng5"  wrote:
> >
> > Ok, I see what you're saying. So here's the constructor for my component 
> > that is responsible for all this:
> > 
> > public function CreateAcctDialog()
> > {
> > super();
> > init();
> > }
> > 
> > ...and init():
> > 
> > private function init():void
> > {   
> > msgString = "The account " + this.acctName + " has 
> > been created "
> > }
> > 
> > and the last part: 
> > content.htmlText = msgString;
> > 
> > This comes out as: The account null has been created. 
> > 
> > I thought the init() method would handle the proper setting of this var.
> > 
> > 
> > --- In flexcoders@yahoogroups.com, "valdhor"  wrote:
> > >
> > > For the first part, you are setting the value of msgString during its 
> > > declaration. At this point acctName will be null. You would need to 
> > > declare msgString and then assign it in a creationComplete handler.
> > > 
> > > Secondly, you can't do this in ActionScript:
> > > 
> > > content.htmlText = "{msgString}"
> > > 
> > > You have to do this:
> > > 
> > > content.htmlText = msgString
> > > 
> > > The "{}" syntax is to bind a variable in MXML.
> > > 
> > > Also, For the above, the variable does not need to be bindable.
>




[flexcoders] Re: Outputting a variable into htmlText

2009-04-30 Thread fumeng5
Ok, I see what you're saying. So here's the constructor for my component that 
is responsible for all this:

public function CreateAcctDialog()
{
super();
init();
}

...and init():

private function init():void
{   
msgString = "The account " + this.acctName + " has 
been created "
}

and the last part: 
content.htmlText = msgString;

This comes out as: The account null has been created. 

I thought the init() method would handle the proper setting of this var.


--- In flexcoders@yahoogroups.com, "valdhor"  wrote:
>
> For the first part, you are setting the value of msgString during its 
> declaration. At this point acctName will be null. You would need to declare 
> msgString and then assign it in a creationComplete handler.
> 
> Secondly, you can't do this in ActionScript:
> 
> content.htmlText = "{msgString}"
> 
> You have to do this:
> 
> content.htmlText = msgString
> 
> The "{}" syntax is to bind a variable in MXML.
> 
> Also, For the above, the variable does not need to be bindable.
> 
> 
> 
> 
> --- In flexcoders@yahoogroups.com, "fumeng5"  wrote:
> >
> > Thanks for your responses. 
> > 
> > What I mean is that in the 1st case:
> > content.htmlText = "The account " + this.acctName + " has been 
> > created."
> > 
> > ...the message comes out to be: The account null has been created. However, 
> > I can use the debugger to see that acctName is definitely being set 
> > correctly. 
> > 
> > And in the second case:
> > [Bindable]
> > private var msgString:String = "The account " + this.acctName + " 
> > hasbeen created .
> > 
> > content.htmlText = "{msgString}"
> > 
> > ...the message comes out to be: {msgString}
> > 
> > Now I'm not setting 'msgString' right away. I build it in the setter for 
> > acctName, as in:
> > [Bindable]
> > private var msgString:String;
> > 
> > public function set acctName(s:String):void{
> > _acctName = s;
> > msgString = "The account " + _acctName + " has been created "
> > }
> > [Bindable]
> > public function get acctName():String{
> > return _acctName;
> > }
> > 
> > I'm pretty sure this should be working and I must be missing something 
> > small. Thank you for your help, it's very appreciated.
> > 
> > 
> > 
> > --- In flexcoders@yahoogroups.com, Pedro Sena  wrote:
> > >
> > > try
> > > 
> > > [Bindable]
> > > private var msgString:String = "The account " + this.acctName + " has
> > > been created .
> > > 
> > > content.htmlText = "{msgString}"
> > > 
> > > and make sure your acctName is not blank.
> > > 
> > > On Thu, Apr 30, 2009 at 9:55 AM, valdhor wrote:
> > > 
> > > >
> > > >
> > > > What do you mean by "That didn't work"?
> > > >
> > > >
> > > > --- In flexcoders@yahoogroups.com ,
> > > > "fumeng5"  wrote:
> > > > >
> > > > > Hi --
> > > > >
> > > > > I want to output a variable and hardcoded text in the htmlText 
> > > > > property
> > > > of a Text component.
> > > > >
> > > > > Here's what I tried first:
> > > > >
> > > > > content.htmlText = "The account " + this.acctName + " has been 
> > > > > created
> > > > ."
> > > > >
> > > > > ('acctName' is a private var that has accessor methods to get/set it.)
> > > > >
> > > > > That didn't work, so I read thru the archives and found a solution 
> > > > > that
> > > > didn't work either.
> > > > >
> > > > > [Bindable]
> > > > > private var msgString:String = "The account " + {acctName} + " has
> > > > been created .
> > > > >
> > > > > content.htmlText = "{msgString}"
> > > > >
> > > > > What am I missing here? Can anyone offer any helpful pointers?
> > > > >
> > > >
> > > >  
> > > >
> > > 
> > > 
> > > 
> > > -- 
> > > /**
> > > * Pedro Sena
> > > * Systems Architect
> > > * Sun Certified Java Programmer
> > > * Sun Certified Web Component Developer
> > > */
> > >
> >
>




[flexcoders] Re: Outputting a variable into htmlText

2009-04-30 Thread fumeng5
Thanks for your responses. 

What I mean is that in the 1st case:
content.htmlText = "The account " + this.acctName + " has been created."

...the message comes out to be: The account null has been created. However, I 
can use the debugger to see that acctName is definitely being set correctly. 

And in the second case:
[Bindable]
private var msgString:String = "The account " + this.acctName + " hasbeen 
created .

content.htmlText = "{msgString}"

...the message comes out to be: {msgString}

Now I'm not setting 'msgString' right away. I build it in the setter for 
acctName, as in:
[Bindable]
private var msgString:String;

public function set acctName(s:String):void{
_acctName = s;
msgString = "The account " + _acctName + " has been created "
}
[Bindable]
public function get acctName():String{
return _acctName;
}

I'm pretty sure this should be working and I must be missing something small. 
Thank you for your help, it's very appreciated.



--- In flexcoders@yahoogroups.com, Pedro Sena  wrote:
>
> try
> 
> [Bindable]
> private var msgString:String = "The account " + this.acctName + " has
> been created .
> 
> content.htmlText = "{msgString}"
> 
> and make sure your acctName is not blank.
> 
> On Thu, Apr 30, 2009 at 9:55 AM, valdhor wrote:
> 
> >
> >
> > What do you mean by "That didn't work"?
> >
> >
> > --- In flexcoders@yahoogroups.com ,
> > "fumeng5"  wrote:
> > >
> > > Hi --
> > >
> > > I want to output a variable and hardcoded text in the htmlText property
> > of a Text component.
> > >
> > > Here's what I tried first:
> > >
> > > content.htmlText = "The account " + this.acctName + " has been created
> > ."
> > >
> > > ('acctName' is a private var that has accessor methods to get/set it.)
> > >
> > > That didn't work, so I read thru the archives and found a solution that
> > didn't work either.
> > >
> > > [Bindable]
> > > private var msgString:String = "The account " + {acctName} + " has
> > been created .
> > >
> > > content.htmlText = "{msgString}"
> > >
> > > What am I missing here? Can anyone offer any helpful pointers?
> > >
> >
> >  
> >
> 
> 
> 
> -- 
> /**
> * Pedro Sena
> * Systems Architect
> * Sun Certified Java Programmer
> * Sun Certified Web Component Developer
> */
>




[flexcoders] Outputting a variable into htmlText

2009-04-29 Thread fumeng5
Hi --

I want to output a variable and hardcoded text in the htmlText property of a 
Text component. 

Here's what I tried first: 

content.htmlText = "The account " + this.acctName + " has been created ."

('acctName' is a private var that has accessor methods to get/set it.) 

That didn't work, so I read thru the archives and found a solution that didn't 
work either. 

[Bindable]
private var msgString:String = "The account " + {acctName} + " has been 
created . 

content.htmlText = "{msgString}"

What am I missing here? Can anyone offer any helpful pointers? 



[flexcoders] Imported SWC files don't display correctly

2009-04-23 Thread fumeng5
Hi,

I am importing 4 swc files; a left arrow, right arrow, up arrow, and down 
arrow. 

The problem is that the right arrow displays as the left, and the down as the 
up arrow. 

When I preview the SWC files in their corresponding SWF files they look right. 

Has anyone else experienced problems displaying SWC files correctly? 

Thanks for any helpful tips!



[flexcoders] Re: DataGridColumn itemRenderers interfere with DataGrid row rollover

2009-04-17 Thread fumeng5
Hi,

I've got an update to my issue below: If I set the backgroundColor of the 
DataGridColumn and the itemRenderer extends any container, the highlighting of 
that column doesn't work correctly. If I remove the backgroundColor then all is 
well. 

...all other columns rollover correctly except the one with the item renderer. 
I've tried implementing the IDropInListItemRenderer interface and overriding 
the validateNow() method but that still doesn't fix that rollover being a 
single strip over that column. 

Does anyone have an idea what might be going on? 

Thanks in advance for any helpful tips. 
--- In flexcoders@yahoogroups.com, "fumeng5"  wrote:
>
> Hi,
> 
> It seems that whenever I have an HBox itemRenderer for a DataGridColumn, and 
> I place an image in that itemRenderer, that DataGrid column doesn't 
> highglight correctly. For instance, there's only a thin line that covers that 
> column. However, the rest of the rollovers for all other columns work 
> correctly. 
> 
> What about the HBox/Image itemRenderer could be interfering with this? 
> 
> Here's my itemRenderer:
> 
> package pb.renderers
> {
>   import flash.display.DisplayObject;
>   import flash.text.TextField;
>   
>   import mx.containers.HBox;
>   import mx.controls.Image;
> 
>   public class IconRenderer extends HBox
>   {
>   private var iconImg:Image;
>   [Embed("assets/settings/icon.jpg")]
>   private var favIcon:Class;
> 
>   public function IconRenderer()
>   {
>   super();
>   }
>   
>   override public function set data(value:Object):void
>   {
>   super.data = value;
>   
>   if(data.favorite == 'true')
>   iconImg.visible = true;
>   else
>   iconImg.visible = false;
>   
>   invalidateProperties();
>   }
>   
>   // set the styles for the buttons
>   override protected function createChildren():void{
>   super.createChildren();
>   
>   iconImg = new Image();
>   iconImg.source = favIcon;
>   iconImg.scaleContent = false;
>   iconImg.visible = false;
>   
>   this.addChild(iconImg);
>   }
> 
>   /* center the checkbox if we're in a datagrid */
>   override protected function updateDisplayList(w:Number, 
> h:Number):void
>   {
>   super.updateDisplayList(w,h);
>   
>   var n:int = numChildren;
>   for (var i:int = 0; i < n; i++)
>   {
>   var c:DisplayObject = getChildAt(i);
>   if (!(c is TextField))
>   {
>   c.x = (w - c.width) / 2;
>   c.y = 0;
>   }
>   }
>   }
>   
>   }
> }
> 
> Thank you for any helpful tips.
>




[flexcoders] DataGridColumn itemRenderers interfere with DataGrid row rollover

2009-04-16 Thread fumeng5
Hi,

It seems that whenever I have an HBox itemRenderer for a DataGridColumn, and I 
place an image in that itemRenderer, that DataGrid column doesn't highglight 
correctly. For instance, there's only a thin line that covers that column. 
However, the rest of the rollovers for all other columns work correctly. 

What about the HBox/Image itemRenderer could be interfering with this? 

Here's my itemRenderer:

package pb.renderers
{
import flash.display.DisplayObject;
import flash.text.TextField;

import mx.containers.HBox;
import mx.controls.Image;

public class IconRenderer extends HBox
{
private var iconImg:Image;
[Embed("assets/settings/icon.jpg")]
private var favIcon:Class;

public function IconRenderer()
{
super();
}

override public function set data(value:Object):void
{
super.data = value;

if(data.favorite == 'true')
iconImg.visible = true;
else
iconImg.visible = false;

invalidateProperties();
}

// set the styles for the buttons
override protected function createChildren():void{
super.createChildren();

iconImg = new Image();
iconImg.source = favIcon;
iconImg.scaleContent = false;
iconImg.visible = false;

this.addChild(iconImg);
}

/* center the checkbox if we're in a datagrid */
override protected function updateDisplayList(w:Number, 
h:Number):void
{
super.updateDisplayList(w,h);

var n:int = numChildren;
for (var i:int = 0; i < n; i++)
{
var c:DisplayObject = getChildAt(i);
if (!(c is TextField))
{
c.x = (w - c.width) / 2;
c.y = 0;
}
}
}

}
}

Thank you for any helpful tips.   



[flexcoders] Re: Access DataGridColumn on DataGrid Row Click

2009-04-14 Thread fumeng5
Yes, I want a user to be able to continuously select and unselect the checkbox. 

And casting the selectedItem to XML now suppresses that error but I am still 
unable to select/unselect the checkbox. 

It seems that when I mouse over a row when i'm in the 2nd column, the row isn't 
being highlighted. so as a result of the row not getting the event, i am unable 
to select the checkbox. 

however, the rollover and selection works if i'm in the 1st column. 
hwhat am i missing? 

here's the DP and my DataGrid.

















thank you. 
--- In flexcoders@yahoogroups.com, "Tracy Spratt"  wrote:
>
> Ah, your items are XML, that is fine, I am personally quite fond of XML.
> 
>  
> 
> First, what line is throwing that error?
> 
>  
> 
> Also, make this change:
> 
> var xmlItem:Object = XML(event.currentTarget.selectedItem);
> 
> and change oItem to xmlItem everywhere in that function too.
> 
>  
> 
> This toggles the checkbox, is that what you want?
> 
> oit...@selected = (oit...@selected == 'true') ? false : true;
> 
>  
> 
>  
> 
> Tracy Spratt,
> 
> Lariat Services, development services available
> 
>   _  
> 
> From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
> Behalf Of fumeng5
> Sent: Tuesday, April 14, 2009 3:48 PM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] Re: Access DataGridColumn on DataGrid Row Click
> 
>  
> 
> 
> 
> 
> 
> 
> Thank you, this is working very well now except for one bug:
> 
> When I click directly on the checkbox I get the following error:
> Property @selected not found on Boolean and there is no default value.
> Meaning that 'oItem', instead of coming back as an object
> (event.currentTarget.selectedItem) is being set to a Boolean value. 
> 
> This also happens, albeit inconsistently, on a row click when the row
> doesn't appear to have focus. 
> 
> note: I change oItem.selected to oit...@selected because the DP 'selected'
> is an attribute, not a property. 
> 
> here's the updated code (and thank you again!): 
> private function onItemClick( event:ListEvent ):void {
> var oItem:Object = event.currentTarget.selectedItem;
> oit...@selected = (oit...@selected == 'true') ? false : true;
> var coll:XMLListCollection = myDG.dataProvider as XMLListCollection;
> coll.itemUpdated(oItem); //this is required when you directly set an item
> property
> }
> 
> --- In flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com,
> "Tracy Spratt"  wrote:
> >
> > You are very close. But setItemAt requires an entire item, not just the
> > changed property. While setItemAt might be better practice, I would just
> > set the property directly, and then call itemUpdated:
> > 
> > private function onItemClick( event:ListEvent ):void {
> > var oItem:Object = event.currentTarget.selectedItem;
> > 
> > oItem.selected = true;
> > 
> > var coll:XMLListCollection = myDG.dataProvider as XMLListCollection;
> > coll.itemUpdated(oItem); //this is required when you directly set an item
> > property
> > 
> > }
> > 
> > 
> > 
> > Tracy Spratt,
> > 
> > Lariat Services, development services available
> > 
> > _ 
> > 
> > From: flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com
> [mailto:flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com]
> On
> > Behalf Of fumeng5
> > Sent: Tuesday, April 14, 2009 1:32 PM
> > To: flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com
> > Subject: [flexcoders] Re: Access DataGridColumn on DataGrid Row Click
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > Tracy,
> > 
> > Thank you for your response. I've got the checkbox renderer from cflex and
> > it's working just fine. i've updated my XMLListCollection with the
> > 'selected' property and it renders fine as well. 
> > 
> > The problem is updating the collection on click of a datagrid row. 
> > 
> > Here is what I have:
> >

[flexcoders] Re: Access DataGridColumn on DataGrid Row Click

2009-04-14 Thread fumeng5
Thank you, this is working very well now except for one bug:

When I click directly on the checkbox I get the following error:
Property @selected not found on Boolean and there is no default value. Meaning 
that 'oItem', instead of coming back as an object 
(event.currentTarget.selectedItem) is being set to a Boolean value. 

This also happens, albeit inconsistently, on a row click when the row doesn't 
appear to have focus. 

note: I change oItem.selected to oit...@selected because the DP 'selected' is 
an attribute, not a property. 

here's the updated code (and thank you again!): 
private function onItemClick( event:ListEvent ):void {
var oItem:Object = event.currentTarget.selectedItem;
oit...@selected = (oit...@selected == 'true') ? false : 
true;
var coll:XMLListCollection = myDG.dataProvider as 
XMLListCollection;
coll.itemUpdated(oItem);  //this is required when you 
directly set an item property
}

--- In flexcoders@yahoogroups.com, "Tracy Spratt"  wrote:
>
> You are very close.  But setItemAt requires an entire item, not just the
> changed property.  While setItemAt might be better practice, I would just
> set the property directly, and then call itemUpdated:
> 
> private function onItemClick( event:ListEvent ):void {
> var oItem:Object = event.currentTarget.selectedItem;
> 
> oItem.selected = true;
> 
> var coll:XMLListCollection = myDG.dataProvider as XMLListCollection;
> coll.itemUpdated(oItem);  //this is required when you directly set an item
> property
> 
> }
> 
>  
> 
> Tracy Spratt,
> 
> Lariat Services, development services available
> 
>   _  
> 
> From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
> Behalf Of fumeng5
> Sent: Tuesday, April 14, 2009 1:32 PM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] Re: Access DataGridColumn on DataGrid Row Click
> 
>  
> 
> 
> 
> 
> 
> 
> Tracy,
> 
> Thank you for your response. I've got the checkbox renderer from cflex and
> it's working just fine. i've updated my XMLListCollection with the
> 'selected' property and it renders fine as well. 
> 
> The problem is updating the collection on click of a datagrid row. 
> 
> Here is what I have:
> 
> private function onItemClick( event:ListEvent ):void {
> // update the dataprovider using the collection API
> var e:ListEvent = event;
> var rowIndex:Number = e.rowIndex;
> var coll:XMLListCollection = myDG.dataProvider as XMLListCollection;
> coll.setItemAt({selected:true},rowIndex);
> }
> 
> I don't appear to be setting the correct object. Do I wanted to be setting
> the datagrid's selectedItem instead?
> 
> and here is my XMLListCollection.
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> Thank you very much for your help.
> --- In flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com,
> "Tracy Spratt"  wrote:
> >
> > You need to study up on item renderers a bit. What you are trying to do
> > will not work. The check box state must be driven by a value in the
> > dataProvider item. You should not attempt to access the check box directly
> > via code.
> > 
> > 
> > 
> > Find an example of a checkbox renderer, there are many, I have one on
> > www.cflex.net <http://www.cflex. <http://www.cflex.net/> net/> . Do not
> attempt to create an
> > interactive itemRenderer from scratch
> > 
> > 
> > 
> > When you have a working renderer, you can simply set the property on the
> > dataProvider item (using the collection API, or itemUpdated())
> > 
> > 
> > 
> > Tracy Spratt,
> > 
> > Lariat Services, development services available
> > 
> > _ 
> > 
> > From: flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com
> [mailto:flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com]
> On
> > Behalf Of fumeng5
> > Sent: Tuesday, April 14, 2009 9:56 AM
> > To: flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com
> > Subject: [flexcoders] Access DataGridColumn on DataGrid Row Click
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > Hi,
> > 
> > I'm trying to access a DataGridColumn when a user clicks on a DataGrid
> row.
> > The problem is that I'm not trying to access the column that was clicked
> > on
> > 
> > I want to select a checkbox that is always in the 2nd column whether a
> user
> > clicks on the 2nd column or not. I'm having trouble figuring out how to do
> > that..Can anyone point me in the right direction?
> > 
> > Thanks!
> > 
> >  > itemClick="onItemClick(event)">
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> >
>




[flexcoders] Re: Access DataGridColumn on DataGrid Row Click

2009-04-14 Thread fumeng5
Tracy,

Thank you for your response. I've got the checkbox renderer from cflex and it's 
working just fine. i've updated my XMLListCollection with the 'selected' 
property and it renders fine as well. 

The problem is updating the collection on click of a datagrid row. 

Here is what I have:

private function onItemClick( event:ListEvent ):void {
// update the dataprovider using the collection API
var e:ListEvent = event;
var rowIndex:Number = e.rowIndex;
var coll:XMLListCollection = myDG.dataProvider as 
XMLListCollection;
coll.setItemAt({selected:true},rowIndex);
}

I don't appear to be setting the correct object. Do I wanted to be setting the 
datagrid's selectedItem instead?


and here is my XMLListCollection.













Thank you very much for your help.
--- In flexcoders@yahoogroups.com, "Tracy Spratt"  wrote:
>
> You need to study up on item renderers a bit.  What you are trying to do
> will not work.  The check box state must be driven by a value in the
> dataProvider item.  You should not attempt to access the check box directly
> via code.
> 
>  
> 
> Find an example of a checkbox renderer, there are many, I have one on
> www.cflex.net <http://www.cflex.net/> .  Do not attempt to create an
> interactive itemRenderer from scratch
> 
>  
> 
> When you have a working renderer, you can simply set the property on the
> dataProvider item (using the collection API, or itemUpdated())
> 
>  
> 
> Tracy Spratt,
> 
> Lariat Services, development services available
> 
>   _  
> 
> From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
> Behalf Of fumeng5
> Sent: Tuesday, April 14, 2009 9:56 AM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] Access DataGridColumn on DataGrid Row Click
> 
>  
> 
> 
> 
> 
> 
> 
> Hi,
> 
> I'm trying to access a DataGridColumn when a user clicks on a DataGrid row.
> The problem is that I'm not trying to access the column that was clicked
> on
> 
> I want to select a checkbox that is always in the 2nd column whether a user
> clicks on the 2nd column or not. I'm having trouble figuring out how to do
> that..Can anyone point me in the right direction?
> 
> Thanks!
> 
>  itemClick="onItemClick(event)">
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>




[flexcoders] Access DataGridColumn on DataGrid Row Click

2009-04-14 Thread fumeng5
Hi,

I'm trying to access a DataGridColumn when a user clicks on a DataGrid row. The 
problem is that I'm not trying to access the column that was clicked on

I want to select a checkbox that is always in the 2nd column whether a user 
clicks on the 2nd column or not. I'm having trouble figuring out how to do 
that..Can anyone point me in the right direction?

Thanks!

































[flexcoders] Re: Accessing button properties from the ToggleButtonBar

2008-08-22 Thread fumeng5
found my own solution:

(myToggleButtonBar.getChildAt(index) as Button).enabled

thanks for listening. 

--- In flexcoders@yahoogroups.com, "fumeng5" <[EMAIL PROTECTED]> wrote:
>
> Hi.
> 
> I want to set properties for each element in my ToggleButtonBar's
> dataprovider, i.e. enabled, visible, etc...
> 
> Something like this:
> 
> (myToggleButtonBar.dataProvider.getItemAt(0) as Button).enabled = false;
> 
> But that doesn't work. 
> 
> I know the dataprovider of a ToggleButtonBar has to be a String,
> Array, or IList. I already tried setting the dataprovider to be a
> collection of buttons. 
> 
> So, is it possible to set button properties on my ToggleButtonBar?
> 
> Thanks for any tips,
> 
> fumeng.
>




[flexcoders] Accessing button properties from the ToggleButtonBar

2008-08-22 Thread fumeng5
Hi.

I want to set properties for each element in my ToggleButtonBar's
dataprovider, i.e. enabled, visible, etc...

Something like this:

(myToggleButtonBar.dataProvider.getItemAt(0) as Button).enabled = false;

But that doesn't work. 

I know the dataprovider of a ToggleButtonBar has to be a String,
Array, or IList. I already tried setting the dataprovider to be a
collection of buttons. 

So, is it possible to set button properties on my ToggleButtonBar?

Thanks for any tips,

fumeng. 



[flexcoders] Re: Comparing numbers with a tolerance

2008-07-14 Thread fumeng5
--- In flexcoders@yahoogroups.com, "Samuel Neff" <[EMAIL PROTECTED]> wrote:
>
> If you want to know to compare two values with tolerance then
subtract them
> and see if the result is within your tolerance.
> 
> public function within(x:Number, y:Number, tolerance:Number):Boolean {
>   var difference:Number = x - y;
>   return difference <= tolerance && difference >= - tollerance;
> }
> 
> HTH,
> 
> Sam
> 
> -
> We're Hiring! Seeking passionate Flex, C#, or C++ (RTSP, H264)
developer in
> the Washington D.C. Contact [EMAIL PROTECTED]
> 
> On Mon, Jul 14, 2008 at 3:07 PM, fumeng5 <[EMAIL PROTECTED]> wrote:
> 
> > Hi,
> >
> > I'm trying to compare 3 points but because of double precision in AS3
> > i'm running into some issues with trailing digits causing the numbers
> > to not be equal, i.e. 1.25 != 1.24999
> >
> >
> >
>
Thanks for the responses:

Tim, I need more precision than rounding to the nearest integer, but
thank you. 

Lampei, that solution sounded perfect at first but I was running into
problems when I started passing over 900 points to be compared. 

Sam, this looks like exactly what I am looking for. My test cases seem
to be passing so far and all is well. 

Thank you for all the quick responses. 

fumeng. 



[flexcoders] Comparing numbers with a tolerance

2008-07-14 Thread fumeng5
Hi,

I'm trying to compare 3 points but because of double precision in AS3
i'm running into some issues with trailing digits causing the numbers
to not be equal, i.e. 1.25 != 1.24999

what i'd like to figure out how to do is introduce a tolerance of say
.001. then i'd compare the test point against the other two points
saying: is testPoint.x within the range of point1.x and point2.x and
is testPoint.y within the range of point1.y and point2.y. if so,
return true. 

i just can't figure it out. here's what i have so far:

public static function isEndPoint(p:Point, Lp1:Point, Lp2:Point):Boolean {
var tolerance:int = .001;
var newLp1:Point = new Point(tolerance * Lp1.x,tolerance * 
Lp1.y);
var newLp2:Point = new Point(tolerance * Lp2.x,tolerance * 
Lp2.y);
return (p.equals(newLp1) || p.equals(newLp2));
}

I guess I'm seeing that the equals() method at the bottom of this code
is not really what i want. Plus, multiplying everything by .001
doesn't solve the problem as i'll essentially be using the same
numbers i started with.

Can someone perhaps point me in the right direction here, please? I'm
not sure where exactly to go from here. 

Thanks,

fumeng. 



[flexcoders] Re: DataGrid Sorts on Columns with No Data???

2008-06-30 Thread fumeng5
--- In flexcoders@yahoogroups.com, "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> You can get the HEADER_RELEASE event and block it by calling
> preventDefault() if the column doesn't have any data
> 
>  
> 
> 
> 
> From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
> Behalf Of fumeng5
> Sent: Monday, June 30, 2008 11:11 AM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] DataGrid Sorts on Columns with No Data???
> 
>  
> 
> Hi -
> 
> I've got a DataGrid with dynamic data in it that is constantly redrawn
> with new data. Sometimes a column may have no data whatsoever, but
> it's still sortable. 
> 
> The problem is that if I sort a column with data in it and then I sort
> this column with no data in it, it still appears to be sorting. But
> sorting on what?? All I know is that the column with data in it is
> re-sorted after I do this.what's happening here and how can I stop
> it? 
> 
> Just a little confused...Any tips on how to stop this are appreciated. 
> 
> Thank you,
> 
> Fumeng.
>
thanks Alex, it works like a charm. 



[flexcoders] DataGrid Sorts on Columns with No Data???

2008-06-30 Thread fumeng5
Hi -

I've got a DataGrid with dynamic data in it that is constantly redrawn
with new data. Sometimes a column may have no data whatsoever, but
it's still sortable. 

The problem is that if I sort a column with data in it and then I sort
this column with no data in it, it still appears to be sorting. But
sorting on what?? All I know is that the column with data in it is
re-sorted after I do this.what's happening here and how can I stop
it? 

Just a little confused...Any tips on how to stop this are appreciated. 

Thank you,

Fumeng.  



[flexcoders] Event overloads and the Flex framework

2008-06-25 Thread fumeng5
Hi,

After a long build we're testing and noticing a lot of time out errors
and other things from remote calls to our Java services. One question
that has been posed to me that I don't know how to answer is this: how
does Flex handle someone clicking madly on a button that invokes a
remote service? For example, is there a 1:1 ratio in the sense that
for each call made there will be a response...eventually, or is there
some threshold where Flex will queue the calls or cancel all pending
calls and only return the last one? 

Just trying to wrap my head around this. If anyone has some experience
with this I'd love to hear. 

Thank you, 

Fumeng. 



[flexcoders] Re: Looking for the right loop

2008-06-24 Thread fumeng5
--- In flexcoders@yahoogroups.com, "Tracy Spratt" <[EMAIL PROTECTED]> wrote:
>
> You fixed:
> 
> if(!numThings[i].selected){ //
> 
> correct?
> 
> numThings is an int, you need the array there.
> 
> Tracy
> 
>  
> 
> 
> 
> From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
> Behalf Of fumeng5
> Sent: Tuesday, June 24, 2008 12:39 PM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] Re: Looking for the right loop
> 
>  
> 
> --- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
> , "Tracy Spratt"  wrote:
> >
> > I think this line:
> > 
> > if(!numThings[i].selected){ //
> > 
> > should be:
> > 
> > if(!things[i].selected){ //
> > 
> > Tracy
> > 
> > 
> > 
> > 
> > 
> > From: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
> [mailto:flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
> ] On
> > Behalf Of Doug McCune
> > Sent: Tuesday, June 24, 2008 12:11 PM
> > To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> 
> > Subject: Re: [flexcoders] Looking for the right loop
> > 
> > 
> > 
> > There's nothing wrong with your code. You can also use a for each loop
> > instead, which might be a bit faster, but doesn't give you elements in
> > any kind of order.
> > 
> > But you could try this for each loop:
> > 
> > for each(var thing:Object in things) {
> > 
> > if(thing.selected == false) {
> > 
> > //whatever
> > 
> > }
> > 
> > }
> > 
> > Just note that using a for loop from 0 to the number of items will
> give
> > you those items in order, but a for each loop will give you them in
> > non-sequential order.
> > 
> > Doug
> > 
> > On Tue, Jun 24, 2008 at 8:57 AM, fumeng5  > <mailto:fumeng5@> > wrote:
> > 
> > Hi,
> > 
> > I'm confused on how to best create a loop to do the following:
> > discover if each element's "selected" property is set to false.
> > Basically, I just want to detect when all elements of my array have a
> > "selected" property set to false. 
> > 
> > Here's my code:
> > var numThings:int = things.length;
> > 
> > for (var i:int=0;i > if(!numThings[i].selected){ // 
> > } 
> > }
> > 
> > I know I'm not using the correct loop, I just can't figure out how to
> > better approach this problem. Any tips are very much appreciated.
> > Thank you. 
> > 
> > Fumeng.
> >
> Thank you for your quick responses. I've decided to add another var to
> my code and it's working just fine now:
> 
> var thingsNotSelected:int = 0;
> var numThings:int = things.length;
> 
> for (var i:int=0;i if(!numThings[i].selected){
> thingsNotSelected++;
> } 
> }
> if(thingsNotSelected == numThings){
> // I know everything inside the array is not selected.
> }
> 
> Thank you again for your help.
> 
> Fumeng.
>
correct. nice catch. 

thanks. 



[flexcoders] Re: Looking for the right loop

2008-06-24 Thread fumeng5
--- In flexcoders@yahoogroups.com, "Tracy Spratt" <[EMAIL PROTECTED]> wrote:
>
> I think this line:
> 
> if(!numThings[i].selected){ //
> 
> should be:
> 
> if(!things[i].selected){ //
> 
> Tracy
> 
>  
> 
> 
> 
> From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
> Behalf Of Doug McCune
> Sent: Tuesday, June 24, 2008 12:11 PM
> To: flexcoders@yahoogroups.com
> Subject: Re: [flexcoders] Looking for the right loop
> 
>  
> 
> There's nothing wrong with your code. You can also use a for each loop
> instead, which might be a bit faster, but doesn't give you elements in
> any kind of order.
> 
> But you could try this for each loop:
> 
> for each(var thing:Object in things) {
> 
> if(thing.selected == false) {
> 
> //whatever
> 
> }
> 
> }
> 
> Just note that using a for loop from 0 to the number of items will give
> you those items in order, but a for each loop will give you them in
> non-sequential order.
> 
> Doug
> 
> On Tue, Jun 24, 2008 at 8:57 AM, fumeng5 <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]> > wrote:
> 
> Hi,
> 
> I'm confused on how to best create a loop to do the following:
> discover if each element's "selected" property is set to false.
> Basically, I just want to detect when all elements of my array have a
> "selected" property set to false. 
> 
> Here's my code:
> var numThings:int = things.length;
> 
> for (var i:int=0;i if(!numThings[i].selected){ // 
> } 
> }
> 
> I know I'm not using the correct loop, I just can't figure out how to
> better approach this problem. Any tips are very much appreciated.
> Thank you. 
> 
> Fumeng.
>
Thank you for your quick responses. I've decided to add another var to
my code and it's working just fine now:

var thingsNotSelected:int = 0;
var numThings:int = things.length;

for (var i:int=0;i

[flexcoders] Looking for the right loop

2008-06-24 Thread fumeng5
Hi,

I'm confused on how to best create a loop to do the following:
discover if each element's "selected" property is set to false.
Basically, I just want to detect when all elements of my array have a
"selected" property set to false. 

Here's my code:
var numThings:int = things.length;

for (var i:int=0;i

[flexcoders] Resizing an Image loaded at runtime

2008-04-28 Thread fumeng5
Hi -

I'm trying to resize an image when a user resizes a TitleWindow
component (I'm using a custom Sizeable TitleWindow component). 

I don't have a width or height set on my custom component but all
containers (children) have width and height set to 100%. I also have
scaleContent and maintainAspectRatio set to true. I think I have all
the pieces and am unsure why it still isn't resizing. Does anyone see
anything wrong with the code below?

Thanks in advance for taking a look,

Fumeng























[flexcoders] Re: accessing node via XML.child()

2007-11-09 Thread fumeng5
quick update; the coordinatesStr line should be this:
var coordinatesStr:String = gml.child("gml:coordinates")[0].toXMLString();

anyway, that's what is strange. i can see the gml XML object in the
debugger and all of its nodes. i step into the coordinatesStr line
using the debugger and all is fine and then i step again and that's
when i get the term is undefined error. but it doesn't show what term.
obviously, it's not 'gml' as that object exists, so it must the name
of the node , "gml:coordinates"...i'm guessing. 

thanks.

matt.

--- In flexcoders@yahoogroups.com, Tom Chiverton <[EMAIL PROTECTED]>
wrote:
>
> On Friday 09 Nov 2007, Matthew Ganz wrote:
> > i get the error message: 'a term is undefined and has no properties'
> 
> Stop it in the debugger and find out which one.
> 
> -- 
> Tom Chiverton
> Helping to administratively seize high-yield features
> on: http://thefalken.livejournal.com
> 
> 
> 
> This email is sent for and on behalf of Halliwells LLP.
> 
> Halliwells LLP is a limited liability partnership registered in
England and Wales under registered number OC307980 whose registered
office address is at St James's Court Brown Street Manchester M2 2JF.
 A list of members is available for inspection at the registered
office.  Any reference to a partner in relation to Halliwells LLP
means a member of Halliwells LLP.  Regulated by The Solicitors
Regulation Authority.
> 
> CONFIDENTIALITY
> 
> This email is intended only for the use of the addressee named above
and may be confidential or legally privileged.  If you are not the
addressee you must not read it and must not use any information
contained in nor copy it nor inform any person other than Halliwells
LLP or the addressee of its existence or contents.  If you have
received this email in error please delete it and notify Halliwells
LLP IT Department on 0870 365 2500.
> 
> For more information about Halliwells LLP visit www.halliwells.com.
>