Re: [flexcoders] Re: updating display of GroupingCollection on AdvancedDataGrid with refresh

2008-11-04 Thread ibo
Thanks Vijay! I've read the source and I think the filtering stuff is exactly 
the one I'm looking for! :).





From: Vijay Anand Mareddy [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Tuesday, November 4, 2008 10:02:26 PM
Subject: [flexcoders] Re: updating display of GroupingCollection on 
AdvancedDataGrid with refresh


450 rows shouldnt take so long unless u have summaryfunction and labelfunc etc.
First check  the performance by removing the SummaryFunction

Here is an example on filtering:
http://flexpearls. blogspot. com/2008/ 02/groupingcolle ction-to- group-mails- 
on.html

If all else fails you might want to try Async refresh ...GroupingCollecti 
on.refresh( false);
http://flexpearls. blogspot. com/2007/ 10/async- refresh-of- groupingcollecti 
on.html

--- In [EMAIL PROTECTED] ups.com, poweribo [EMAIL PROTECTED] . wrote:

 Hi All,
 
 I have an AdvancedDataGrid, a GroupingCollection and an 
 ArrayCollection as a source of GroupingCollection. 
 
 I update the display by setting a filter on arraycollection and 
 calling refresh. But the AdvancedDataGrid doesnt reflect the changes 
 unless I call GroupingCollection. refresh() . Bad.
 
 My ArrayCollection contains only 450+ items but 
 GroupingCollection. refresh() takes too long time to re-render the 
 list.
 
 Is there any other way that I can do this faster? and without waiting 
 and repopulating the WHOLE list? for example I just want to hide 1 
 item by adding it on my filter, the list should simply adjust by 
 deleting that row only (just like how a normal List 
 UIComp+ArrayCollect ion behaves). Any ideas?
 
 -Stephen
 
 p.s. I have seen the 
 http://flexpearls. blogspot. com/2008/ 06/groupingcolle ction-with- some-
 better.html but it still re-draw the whole thing and doesnt keep the 
 state of the list (expanded/collapsed ).




[flexcoders] re-throwing keystrokes to browser?

2008-08-21 Thread ibo
My flex is running on full screen mode on my browser.
Problem is, if the focus is on the flex app, it wont respond to browser 
keystrokes
like CTRL+T (new tab). I can catch the keycode by listening to keydown event
but how do I send it to the browser? (prefrably cross-browser solution).

Re: [flexcoders] Re: re-throwing keystrokes to browser?

2008-08-21 Thread ibo
I want the browser to react on the CTRL-T (new tab).
But since the focus is on the flash app, it doesnt do that.
So I think I have to catch the keystroke from my flex app and
tell the browser that the user wants a new tab.



- Original Message 
From: sdl1326 [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Thursday, August 21, 2008 6:09:23 PM
Subject: [flexcoders] Re: re-throwing keystrokes to browser?


To clarify my response. I have done some extensive key trapping in Flash/AS3 
where I had to prevent default behaviors in the browser (i.e. F5, F1, etc). In 
some instances these keys would be required by the Flash App. so what I ended 
up doing was setting the focus constantly on the browser (via listeners in 
Flash), trapping the keys, and then sending the event.keyCode back to the Flash 
App. via ExternalInterface. 

Let me know if you would like more details.

HTH
--- In [EMAIL PROTECTED] ups.com, sdl1326 azsl1326-email@ ... wrote:

 Where exactly are you trying to trap the keys? Do you need to prevent
 the browser from performing some default function or do you need to
 prevent the Flex App from performing some function.
 --- In [EMAIL PROTECTED] ups.com mailto:flexcoders@ yahoogroups. com ,
 ibo poweribo@ wrote:
 
  My flex is running on full screen mode on my browser.
  Problem is, if the focus is on the flex app, it wont respond to
 browser keystrokes
  like CTRL+T (new tab). I can catch the keycode by listening to keydown
 event
  but how do I send it to the browser? (prefrably cross-browser
 solution).
 



[flexcoders] regexp problem

2008-08-20 Thread ibo
Hi guys, this might be a trivial prob but Im having problem with regexp pattern.

This wont compile:
var singleDatePattern:RegExp = \d{2}(/)\d{2}(/)\d{4};

I've tried this:
var singleDatePattern:RegExp = new RegExp(/\d{2}(/)\d{2}(/)\d{4}/);

but it wont match against the string 08/20/2008. returns false.

I've tried the pattern on http://gskinner.com/RegExr/ and is confirmed to be 
correct.
What am I missing?

Re: [flexcoders] regexp problem

2008-08-20 Thread ibo
Thanks. Worked for me :)



- Original Message 
From: Josh McDonald [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Wednesday, August 20, 2008 7:40:48 PM
Subject: Re: [flexcoders] regexp problem


Try

var regex : RegExp = /\d{2}\/\d{2} \/\d{4}/;


On Thu, Aug 21, 2008 at 9:35 AM, ibo [EMAIL PROTECTED] com wrote:

Hi guys, this might be a trivial prob but Im having problem with regexp pattern.

This wont compile:
var singleDatePattern: RegExp = \d{2}(/)\d{2} (/)\d{4};

I've tried this:
var singleDatePattern: RegExp = new RegExp(/\d{2}(/)\d{ 2}(/)\d{4} /);

but it wont match against the string 08/20/2008. returns false.

I've tried the pattern on http://gskinner. com/RegExr/ and is confirmed to be 
correct.
What am I missing?

 


-- 
Therefore, send not to know For whom the bell tolls. It tolls for thee.

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED] com


[flexcoders] error message tooltip

2008-08-20 Thread ibo
Is there a reusable component in flex similar to the red tooltip message box
that appears when a validator throws an invalid event? 
Alert.show is ugly and titlewindowis overkill.


[flexcoders] Data binding prob with custom component

2008-08-14 Thread ibo
Hi All,
   
I have a problem with data binding on my custom component.
If my myModel.tokens (arraycollection) was modified somewhere else (i.e. in 
front controller)
the set dataProvider function never gets called. The doThisFunction() only 
gets called
once, during the ui component instantiation I would guess.

I'm changing the contents of myModel.tokens using only:
myModel.tokens.removeAll();
myModel.tokens.addItem(obj);

Parent Component:

[Bindable]
public var myModel:MyModel;// myModel.tokens is an 
arraycollection. MyModel class is marked as Bindable
...
mycomp:CustomLabel id=keywordList dataProvider={myModel.tokens} /


CustomLabel.mxml:

private var _dataProvider:ArrayCollection;
private var dataProviderChanged:Boolean = false;
...
override protected function commitProperties():void {
super.commitProperties();
if (dataProviderChanged) {
doThisFunction();
dataProviderChanged = false;
} 
}
...
public function set dataProvider(tokens:ArrayCollection):void {
_dataProvider = tokens;
dataProviderChanged = true;
invalidateProperties();
}
...
private function doThisFunction():void {
//iterate over array and display on screen...
}

How do I make sure the set dataprovider function gets triggered when the 
contents of tokens changes? Whats wrong with my code?

-Stephen


[flexcoders] applet on top of flash?

2008-07-31 Thread ibo
Anyone tried displaying applet on top of flex/flash? Can someone pls point me a 
link to an example demo?
I did a search on this topic and Ive read that its possible to do so but 
couldnt find an working example.
I want it to be displayed as seamless as possible and dont want to open a new 
browser window (using navigateToURL).
I modified the index.template.html so that It can load the applet and float it 
on top of the flex app
but it wont render the html panel. Im using Yahoo UI Panel btw.

-Stephen


Re: [flexcoders] applet on top of flash?

2008-07-31 Thread ibo
for the benefit of other flex devs integrating applets / dhtml,
on the object tag of your swf, just add param name=wmode 
value=transparent/ as parameter.
As expected, the YUI Panel worked seamlessly.



- Original Message 
From: ibo [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Thursday, July 31, 2008 11:00:12 AM
Subject: [flexcoders] applet on top of flash?


Anyone tried displaying applet on top of flex/flash? Can someone pls point me a 
link to an example demo?
I did a search on this topic and Ive read that its possible to do so but 
couldnt find an working example.
I want it to be displayed as seamless as possible and dont want to open a new 
browser window (using navigateToURL) .
I modified the index.template. html so that It can load the applet and float it 
on top of the flex app
but it wont render the html panel. Im using Yahoo UI Panel btw.

-Stephen


[flexcoders] event listeners on Sprites - performance problem

2008-07-23 Thread ibo
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary=0-617774704-1216825475=:34053

--0-617774704-1216825475=:34053
Content-Type: text/plain; charset=us-ascii

I created a component what I call bookmark bar where there are markers that you 
can click
to jump/scroll to a particular portion of a list (given the index). Similar to 
Eclipse/Flexbuilder when you have
errors and there are markers on the right side pane that lets you jump to the 
erroneous line. I am using 
this for a datagrid using Canvas as parent component.

var uiComponent:UIComponent = new UIComponent();
addChild(uiComponent);

for (var i:int=0; i_dataProvider.length; i++) {
var bm:Bookmark = _dataProvider[i] as Bookmark; 
   

sprite = new MySprite();   // extends Sprite. Creates an 
instance Sprite for each marker
sprite.graphics.lineStyle(3, bm.color, 1, false, 
LineScaleMode.NORMAL, CapsStyle.SQUARE);
sprite.graphics.moveTo(x,  y);
sprite.graphics.lineTo(x + xOffset, y);
...
sprite.addEventListener(MouseEvent.CLICK, scrollToLine);
sprite.buttonMode = true;
...
uiComponent.addChild(sprite);
}

It works as expected but I noticed it is heavy on CPU and affects the 
responsiveness of the
UI. CPU spikes at 55% to 60% even if I only have a few markers (10 to 15).
The lag is very noticeable because just hovering the mouse pointer over the 
list,
the item highlighter, delay in rendering the display is very evident.
It doesnt happen on my app when I turn it off.

Am I doing this right? any workaround?

Regards,
Stephen

--0-617774704-1216825475=:34053
Content-Type: text/html; charset=us-ascii

htmlheadstyle type=text/css!-- DIV {margin:0px;} 
--/style/headbodydiv style=font-family:times new roman, new york, 
times, serif;font-size:12ptdivI created a component what I call bookmark 
bar where there are markers that you can clickbrto jump/scroll to a 
particular portion of a list (given the index). Similar to Eclipse/Flexbuilder 
when you havebrerrors and there are markers on the right side pane that lets 
you jump to the erroneous line. I am using brthis for a datagrid using Canvas 
as parent component.brbrnbsp;nbsp;nbsp; nbsp;nbsp;nbsp; 
nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; var uiComponent:UIComponent = new 
UIComponent();nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; brnbsp;nbsp;nbsp; 
nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; 
addChild(uiComponent);brbrnbsp;nbsp;nbsp; 
nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; for (var i:int=0; 
ilt;_dataProvider.length; i++)
 {brnbsp;nbsp;nbsp; nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; 
nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; var bm:Bookmark = _dataProvider[i] as 
Bookmark;nbsp;nbsp;nbsp; nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; 
nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; brnbsp;nbsp;nbsp; nbsp;nbsp;nbsp; 
nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; 
brnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;
 sprite = new MySprite();nbsp;nbsp; // extends Sprite. Creates an instance 
Sprite for each markerbrnbsp;nbsp;nbsp; 
nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; 
nbsp;nbsp;nbsp; sprite.graphics.lineStyle(3, bm.color, 1, false, 
LineScaleMode.NORMAL, CapsStyle.SQUARE);nbsp;nbsp;nbsp; 
nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; 
nbsp;nbsp;nbsp; brnbsp;nbsp;nbsp; 
nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; nbsp;nbsp;nbsp;
 nbsp;nbsp;nbsp; sprite.graphics.moveTo(x,nbsp; y);brnbsp;nbsp;nbsp; 
nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; 
nbsp;nbsp;nbsp; sprite.graphics.lineTo(x + xOffset, 
y);brnbsp;nbsp;nbsp; nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; 
nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; ... nbsp;nbsp; 
nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; 
nbsp;nbsp;nbsp; brnbsp;nbsp;nbsp; nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; 
nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; sprite.addEventListener(MouseEvent.CLICK, 
scrollToLine);brnbsp;nbsp;nbsp; nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; 
nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; sprite.buttonMode = 
true;brnbsp;nbsp;nbsp; nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; 
nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; ...brnbsp;nbsp;nbsp; 
nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; 
uiComponent.addChild(sprite);nbsp;nbsp;nbsp;
 nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; 
nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; brnbsp;nbsp;nbsp; 
nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; nbsp;nbsp;nbsp; }brbrIt works 
as expected but I noticed it is heavy on CPU and affects the responsiveness of 
thebrUI. CPU spikes at 55% to 60% even if I only have a few markers (10 to 
15).brThe lag is very noticeable because just hovering the mouse pointer over 
the list,brthe item highlighter, delay in rendering the display is very 

[flexcoders] getting absolute height from component

2008-07-21 Thread ibo
If I have a canvas with height set to 100%, how do I get its absolute height? 
(in pixels)
the height attribute is giving me 0.


Re: [flexcoders] Titlewindow resize problem

2008-07-17 Thread ibo
Alex,

It gets clipped but I know its expanding because I have used 
resize effect to observe it in slow mo. Its like the renderer is having problem 
drawing part of the window region. Tried using the latest SDK/Flash Plugin. 
same thing.

Screenshot of it looks like exactly :
http://www. geocities.com/poweribo/clipped.png
Should be like this:
http://www. geocities.com/poweribo/clipped2.png

It turns out that the problem was more of PopupButton issue.
It behaves as expected if TitleWindow is not a child of popup.


On a somewhat related note, there is another serious prob with PopUpButton
when used with ViewStack. The value of popup attribute of PopUpButton
mysteriously gets set to null when you navigating thru the view stack.
I'm actually surprised the issue was closed in Adobe Bugbase bec
they cant replicate it.


- Original Message 
From: Alex Harui [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Thursday, July 17, 2008 1:41:53 AM
Subject: RE: [flexcoders] Titlewindow resize problem


I don’t have time to set this up
right now.  Did it clip or did you get scrollbars?  Should it clip or just
layout differently?
 


 
From:[EMAIL PROTECTED] ups.com [mailto:flexcoders@ yahoogroups. com] On Behalf 
Of ibo
Sent: Wednesday, July 16, 2008
1:23 PM
To: [EMAIL PROTECTED] ups.com
Subject: [flexcoders] Titlewindow
resize problem
 
Guys need help, I've spent a day trying to figure out whats the problem
with
with this app. Its about programmatically resizing a Titlewindow. 

When I'm assigning the TitleWindow a new value for width, a portion of the
window
seems to be clipped for no reason. Is this a bug? Is there a workaround for
this?
Or am I just doing it wrong? If you will check the demo, it works as expected
bec
I have set the viewStackDialogInde x to 2 (as initial value). But if you
close the dialog box
and press the popup window again, clicking on medium and
large item wont expand the 
window anymore.

The compiled app demo:
http://www.geocitie s.com/poweribo/ TitleWindowTest. swf

The code in question:--- - - - --

?xml version=1.0 encoding=utf- 8?
mx:Application xmlns:mx=http: //www.adobe. com/2006/ mxml
width=100% height=100% 
mx:Script
   
![CDATA[   

[Bindable]
private var
viewStackDialogInde x:int = 2;
[Bindable]
private var
dynamicWidth: int = 565;

! private function
displayDateDialog( event:Event) :void {
var
item:Object = listOfThings. selectedItem;
   
viewStackDialogInde x = item.dialog;

if
(item.dialog == 0) {
   
dynamicWidth = 170;
}
else if (item.dialog == 1) {   

   
dynamicWidth = 380;   

}
else if (item.dialog == 2) {   

   
dynamicWidth = 565;   

}
}
]]
/mx:Script

mx:Model id=Shortcuts
  someItems
someItem label=Small
data=1 dialog=0/
someItem
label=Medium data=2 dialog=1/
someItem label=Large
data=3 dialog=2/
  /someItems
/mx:Model
   

mx:PopUpButton id=popUpButton
label=Please Select Item openAlways= true
   
mx:popUp   

mx:TitleWindow
id=titleWindow 
   
showCloseButton= false
close=popUpButton. close()  
   
   
width={dynamicWidt h} height=280
   
   
verticalScrollPolic y=off horizontalScrollPol icy=off

   
mx:HBox width=100% height=100% 
verticalScrollPolic y=off horizontalScrollPol icy=off
   
   

   
mx:List id=listOfThings 
  n! bsp;
dataProvider= {Shortcuts. someItem}  
   
selectedIndex= 2
   
width=140 height=100% 
   
textAlign=left  
   
click=displayDateD ialog(event)
   

   
/mx:List
  nbs! p;

   
mx:VBox id=thisPane width=100%
height=100%  verticalScrollPolic y=off
horizontalScrollPol icy=off
   

   
mx:ViewStack id=myViewStack
width=100% height=100%  
   
selectedIndex= {viewStackDialo gIndex}
verticalScrollPolic y=off horizontalScrollPol icy=off
   
  ! ;  
   
mx:HBox
label=aa width=100% height=100% 
   
   
  verticalScrollPolic y=off
horizontalScrollPol icy=off
   
   
mx:Text text=This is Small/
   
   
/mx:HBox
   
   
   
   

   
mx:HBox
label=bb width=100% height=100

[flexcoders] Titlewindow resize problem

2008-07-16 Thread ibo
Guys need help, I've spent a day trying to figure out whats the problem with
with this app. Its about programmatically resizing a Titlewindow. 

When I'm assigning the TitleWindow a new value for width, a portion of the 
window
seems to be clipped for no reason. Is this a bug? Is there a workaround for 
this?
Or am I just doing it wrong? If you will check the demo, it works as expected 
bec
I have set the viewStackDialogIndex to 2 (as initial value). But if you close 
the dialog box
and press the popup window again, clicking on medium and large item wont 
expand the 
window anymore.

The compiled app demo:
http://www.geocities.com/poweribo/TitleWindowTest.swf

The code in question:

?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; width=100% 
height=100%
mx:Script
![CDATA[
[Bindable]
private var viewStackDialogIndex:int = 2;
[Bindable]
private var dynamicWidth:int = 565;

private function displayDateDialog(event:Event):void {
var item:Object = listOfThings.selectedItem;
viewStackDialogIndex = item.dialog;

if (item.dialog == 0) {
dynamicWidth = 170;
} else if (item.dialog == 1) {
dynamicWidth = 380;
} else if (item.dialog == 2) {
dynamicWidth = 565;
}
}
]]
/mx:Script

mx:Model id=Shortcuts
  someItems
someItem label=Small data=1 dialog=0/
someItem label=Medium data=2 dialog=1/
someItem label=Large data=3 dialog=2/
  /someItems
/mx:Model

mx:PopUpButton id=popUpButton label=Please Select Item 
openAlways=true
mx:popUp
mx:TitleWindow id=titleWindow 
showCloseButton=false close=popUpButton.close() 
 
width={dynamicWidth} height=280
verticalScrollPolicy=off 
horizontalScrollPolicy=off

mx:HBox width=100% height=100% verticalScrollPolicy=off 
horizontalScrollPolicy=off

mx:List id=listOfThings 
dataProvider={Shortcuts.someItem} 
selectedIndex=2
width=140 height=100%
textAlign=left  
click=displayDateDialog(event)   
 
/mx:List

mx:VBox id=thisPane width=100% height=100% 
verticalScrollPolicy=off horizontalScrollPolicy=off

mx:ViewStack id=myViewStack width=100% 
height=100% 
selectedIndex={viewStackDialogIndex} 
verticalScrollPolicy=off horizontalScrollPolicy=off

mx:HBox label=aa width=100% height=100%
  verticalScrollPolicy=off 
horizontalScrollPolicy=off
mx:Text text=This is Small/
/mx:HBox

mx:HBox label=bb width=100% height=100% 
 verticalScrollPolicy=off 
horizontalScrollPolicy=off
mx:Text text=This is Medium/
 
/mx:HBox

mx:HBox label=cc width=100% height=100% 
 verticalScrollPolicy=off 
horizontalScrollPolicy=off
mx:Text text=This is Large/
/mx:HBox
/mx:ViewStack

/mx:VBox
/mx:HBox
/mx:TitleWindow
/mx:popUp
/mx:PopUpButton
/mx:Application

---

Regards,
Stephen


[flexcoders] scrolling prob on itemrenderers

2008-06-11 Thread ibo
I have created a custom ItemRenderer with a textarea in it. This ItemRenderer 
is being used in a DataGrid. If the mouse pointer is over the 
textarea(ItemRenderer), the datagrid doesnt react to any mouse wheel movement. 
How I enable the DataGrid to receive the mouse wheel events when the mouse is 
over that textarea?


[flexcoders] word highlighting

2008-05-22 Thread ibo
Have anyone worked on something like this before? What I want is to highlight 
the word by changing the background color of each keyword from a 
sentence/paragraph.

Here is my code so far:

  private function applyTextHighlight(textField:UIComponent, 
listOfWordPositions:Array):void {
   var textArea:TextArea = TextArea(textField);
   var tr:TextRange = new TextRange(textArea);
   
   tr.htmlText = textArea[htmlText];
   
   for (var i:int=0; ilistOfWordPositions.length; i++) {
  var metaWord:WordPositions = listOfWordPositions[i];
  tr.beginIndex = metaWord.startIndex;
  tr.endIndex = metaWord.endIndex;
  tr.htmlText = formattedText(tr.text, metaWord.color); 
  
 //tr[color] = metaWord.color;
 //tr[fontWeight] = bold;
 //tr[fontSize] = 12;
   }  
  }
  
private function formattedText(text:String, color:uint):String {
return FONT style='BACKGROUND-COLOR:  + color + ' + text + 
/FONT;
}


TextRange seems to be very limited on how much you can format your html text so 
I'm not surprised it doesnt really fully support HTML. Any workaround to get a 
similar behavior?
Changing the text color, size and weight works though (see commented out lines).

-Stephen
   

Re: [flexcoders] word highlighting

2008-05-22 Thread ibo
Frederico,

I did try it. I used the highlighter on a custom item renderer. looks good on 
initial display but when you try scrolling the list component, the display 
screws up. the rectangular box used as background doesnt flow with the 
text. something to do with relative x,y positioning. looks like it was not 
designed to be used for renderers.

Frederico Garcia [EMAIL PROTECTED] wrote: ibo 
escreveu:
  Have anyone worked on something like this before? What I want is to 
  highlight the word by changing the background color of each keyword 
  from a sentence/paragraph.
 
  Here is my code so far:
 
private function applyTextHighlight(textField:UIComponent, 
  listOfWordPositions:Array):void {
 var textArea:TextArea = TextArea(textField);
 var tr:TextRange = new TextRange(textArea);

 tr.htmlText = textArea[htmlText];

 for (var i:int=0; ilistOfWordPositions.length; i++) 
  {   
var metaWord:WordPositions = listOfWordPositions[i];
tr.beginIndex = metaWord.startIndex;
tr.endIndex = metaWord.endIndex;
tr.htmlText = formattedText(tr.text, 
  metaWord.color);  
   //tr[color] = metaWord.color;
   //tr[fontWeight] = bold;
   //tr[fontSize] = 12;
 } 
}
   
  private function formattedText(text:String, color:uint):String {
  return FONT style='BACKGROUND-COLOR:  + color + ' + 
  text + /FONT;   
  }
 
 
  TextRange seems to be very limited on how much you can format your 
  html text so I'm not surprised it doesnt really fully support HTML. 
  Any workaround to get a similar behavior?
  Changing the text color, size and weight works though (see commented 
  out lines).
 
  -Stephen
 
  
 
  __ NOD32 3118 (20080521) Information __
 
  This message was checked by NOD32 antivirus system.
  http://www.eset.com
 hi,
 
 have you tried the highlighter from flexlib? take a look at:
 
 
http://flexlib.googlecode.com/svn/trunk/examples/Highlighter/Highlighter_Sample.swf
 
 kind regards,
 
 Frederico Garcia
 
 
   

   

[flexcoders] datagrid column width - by percentage

2008-05-13 Thread ibo
Why is it that setting Datagrid column width by percentage is not allowed?
How do make sure your columns dont get messed up when viewed from different 
monitor resolutions?

   

[flexcoders] working with ICollectionView and IViewCursor

2008-05-09 Thread ibo
I wanted to update my datagrid / arraycollection with data coming from server.
the list is sorted by date field by default. if the record item exists in the 
list,
i will replace the existing item with the new one, and if its not on the list, 
I will add it to the list.

Here is the catch, updates should be done by insert sort using uniqueId field 
while additions done by insert sort using the date field.

How do I accomplish this? 

I've tried creating two sets of Sort/ICollectionView/IViewCursor, one for 
update and another for addition. Unfortunately it did not work. Arent these 
views and cursors only a virtual window to the actual collection data?

-is this the right way to do it?---

 var sortByUniqueKey:Sort = new Sort();  
 sortByUniqueKey.fields = [new SortField(uniqueId)];
 
 var sortByStartTime:Sort = new Sort();  
 sortByStartTime.fields = [new SortField(dateField)]; 
  
  var viewSortedByUniqueKey:ICollectionView = new 
ArrayCollection(items.toArray());
  viewSortedByUniqueKey.sort = sortByUniqueKey;
  viewSortedByUniqueKey.refresh();
  
  var viewSortedByStartTime:ICollectionView = new 
ArrayCollection(items.toArray());
  viewSortedByStartTime.sort = sortByStartTime;
  viewSortedByStartTime.refresh();
  
  var forUpdateCursor:IViewCursor = 
viewSortedByUniqueKey.createCursor();
  var forAdditionCursor:IViewCursor = 
viewSortedByStartTime.createCursor();

 do stuff here on individual cursors ...
-
I noticed calling ICViewSortedByUniqueKey.refresh() and 
ICViewSortedByUniqueId.refresh() affects the same reference collection.

Any ideas? 


   
-
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.

[flexcoders] value object binding problem

2008-05-08 Thread ibo
I have this VO binding from java to as3:


JAVA / JDK6 - LookupStuff.java

public class LookupStuff {
private ListClassA attributeA;
private ListClassA attributeB;  
private MapString, ListClassB attribute1;
private MapString, ListClassC attribute2;
private MapString, ListClassD attribute3;

...setter/getters...
}

-
AS3 - LookupStuff.as

[RemoteClass(alias=my.java.package.LookupStuff)]
import mx.collections.ArrayCollection;

[Bindable]
public class LookupData {
public var attributeA:ArrayCollection;
public var attributeB:ArrayCollection;
public var attribute1:ArrayCollection;
public var attribute2:ArrayCollection;
public var attribute3:ArrayCollection;
}
--
private function myHandler(event:ResultEvent):void {
 var lookup:LookupStuff = event.result as LookupStuff;
 // lookup is null! why???
 }
 
Im getting null when my actionscript handler (thru RemoteObject / ResultEvent) 
finally gets event.result. Anybody knows why? Can a Map and List interfaces 
easily maps to an AS3 ArrayCollection?

I've verified that my java code is returning a good return value (not null).



   
-
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.

Re: RES: [flexcoders] value object binding problem

2008-05-08 Thread ibo
Luciano,

Thanks it worked for ListClassX but not for MapString, ListClassB. How do 
we convert this map to AS3?

Luciano Manerich Junior [EMAIL PROTECTED] wrote:  
  
You MUST import the classes used into the  ArrayCollection.
  
 Or, you may use the ArrayElementType, for the auto-import at the compiler  
time.
  
  
 public class LookupData  { 
 [ArrayElementType(package.ClassA)]
 public var attributeA:ArrayCollection;
 [ArrayElementType(package.ClassB)]
 public var attributeB:ArrayCollection;
 [ArrayElementType(package.ClassB)]
 public var attribute1:ArrayCollection;
 [ArrayElementType(package.ClassC)]
 public var attribute2:ArrayCollection;
 [ArrayElementType(package.ClassD)]
 public var attribute3:ArrayCollection;
 }

  

  
-
 De: flexcoders@yahoogroups.com  [mailto:[EMAIL PROTECTED] Em nome de ibo
Enviada em:  quinta-feira, 8 de maio de 2008 14:51
Para:  flexcoders@yahoogroups.com
Assunto: [flexcoders] value object binding  problem


 
  I have this VO binding from java to  as3:


JAVA / JDK6 -  LookupStuff.java

public class LookupStuff {
 private ListClassA attributeA;
private  ListClassA attributeB;  
private  MapString, ListClassB attribute1;
private  MapString, ListClassC attribute2;
private  MapString, ListClassD attribute3;
 
...setter/getters...
} 

-
AS3 -  LookupStuff.as

 [RemoteClass(alias=my.java.package.LookupStuff)] 
import  mx.collections.ArrayCollection;
 
[Bindable]
nbs p;public class LookupData { 
public var  attributeA:ArrayCollection;
 public var  attributeB:ArrayCollection;
 public var  attribute1:ArrayCollection;
 public var  attribute2:ArrayCollection;
 public var attribute3:ArrayCollection;
 }
--
 private function myHandler(event:ResultEvent):void  {
var  lookup:LookupStuff = event.result as  LookupStuff;
 // lookup is null! why???
 }

Im getting null when my  actionscript handler (thru RemoteObject / ResultEvent) 
finally gets  event.result. Anybody knows why? Can a Map and List 
interfaces  easily maps to an AS3 ArrayCollection?

I've verified that my java code is  returning a good return value (not null).


 
 

-
 Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try  it 
now. 

 
 
   

   
-
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.

[flexcoders] blazeds / livecycle ds question

2008-04-30 Thread ibo
I know I have asked this question before but unfortunately I havent found an 
answer yet :P. Maybe Mr. Vroom can shed some light on this? tia.

what if there is at least 500 users using the client, assuming the server is 
configured to handle the load hardware-wise, does the blazeds keeps instances 
of this remoteobjects? all 500 of them? or does it use pooling and keeping at 
least half of them and have them re-use objects like how EJB 
(passivate/activate) does? (for java devs in this list). My understanding of 
how the DS work behind the scenes so pardon me if the questions are 
inapplicable :P.

Regards, 
Stephen 
   
-
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.

Re: [flexcoders] The XML Class / E4X - best tutorials?

2008-04-27 Thread ibo
dont know any online but the Oreilly actionscript cookbook has a whole chapter 
discussing E4X. excellent stuff.

Josh McDonald [EMAIL PROTECTED] wrote: Hey guys, 
just a quickie - while I'm getting what I need done, I'm definitely not making 
the best use of the E4X features; I'm wondering if anybody's seen any 
particularly good tutorials online I should check out?
 
Cheers,
-J

-- 
Therefore, send not to know For whom the bell tolls. It tolls for thee.

 :: Josh 'G-Funk' McDonald
 :: 0437 221 380 :: [EMAIL PROTECTED] 
 
   

   
-
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.

[flexcoders] adjust row height of datagridcolumns?

2008-04-27 Thread ibo
Hi guys, I have a datagrid, and I have created custom item editor for each 
column but is bigger than the usual row height (equivalent to 3 lines and 
purposely designed it that way). the itemEditor gets displayed when I click on 
it but the actual height of the row doesnt adjust and scroll bars appears, 
rendering it all cramped and you'll hardly see anything.
How do I make it adjust the height automatically when itemEditor springs into 
action? preferably something that I can attach a resize effect. tia.

   
-
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.

Re: [flexcoders] BlazeDS in the integrated Tomcat configuration

2008-04-22 Thread ibo
it means blazeds was pre-configured to run on tomcat and it came with the 
download. if you unzip the downloaded file, you'll see that there is a tomcat 
directory included. and if you take a look at /tomcat/webapps/ , youll notice 
that a sample web application using blazeds is pre-installed. unzip and run.

hworke [EMAIL PROTECTED] wrote: 
Hi in the BlazeDS configuration document they are talking
about integrated Tomcat- what does in really mean? How
do I know if my tomcat is integrated Tomcat or not. Here
is the installation guide that I am referring to: 
 
 http://opensource.adobe.com/wiki/display/blazeds/Installation+Guide
 
 Regards.
 
 
 
   

   
-
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.

Re: [flexcoders] connection downtime in flex/blazeds?

2008-04-20 Thread ibo
Steve,

I'm curious, If the AS3 version of Consumer class can do it and I'm assuming 
its identical in terms of functionality, why did you guys  decided to use 
FABridge instead?

Also I have a follow up question, a lil diff topic and the concern is on the 
scalability issue:

what if there is at least 500 clients using the client, assuming the server is 
configured to handle the load hardware-wise, does the blazeds keeps instances 
of this remoteobjects? all 500 of them? or does it use pooling and keeping at 
least half of them and have them re-use objects like how EJB 
(passivate/activate) does? (for java devs in this list).

Regards,
Stephen

Cutter (Flex Related) [EMAIL PROTECTED] wrote: 
We went through this recently with an HTML/AJAX based AIR app, utilizing 
 the Flex/Ajax Bridge to communicate with blazeDS. We found a method in 
 the Consumber obj that basically checked the connection and 
 re-subscribed if the connection had been broken. The Flex/Ajax Bridge 
 Consumer object is basically a JavaScript version of the AS3 class 
 within Flex (same API, mostly), in fact we used the AS3 API docs to 
 figure out it's usage (since the FAB is not well documented.)
 
 Steve Cutter Blades
 Adobe Certified Professional
 Advanced Macromedia ColdFusion MX 7 Developer
 _
 http://blog.cutterscrossing.com
 
 ibo wrote:
  
  
  Is there a way for a flex client to know that the connection got cut 
  off from a blazeds backend? (ie. server was restarted). i have a flex 
  grid that gets updated regularly (partial data, accumulates overtime) by 
  a backend service using pub/sub messaging.. but if the server gets 
  rebooted, the server should push the whole list of data (not partial). 
 
 
 
   

   
-
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.

[flexcoders] connection downtime in flex/blazeds?

2008-04-19 Thread ibo
Is there a way for a flex client to know that the connection got cut off from 
a blazeds backend? (ie. server was restarted). i have a flex grid that gets 
updated regularly (partial data, accumulates overtime) by a backend service 
using pub/sub messaging.. but if the server gets rebooted, the server should 
push the whole list of data (not partial). whats the best way to solve this 
kind of prob?

   
-
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.

[flexcoders] Sort - findItem - compareFunction prob

2008-04-16 Thread ibo
Hi I'm having problem with sorting, the compiler says :

error:

[mxmlc] C:\stephen\Main.mxml(51):  Error: Implicit coercion of a value of 
type Boolean to an unrelated type String.
[mxmlc] insertionIndex = sort.findItem(forAddition[i], Sort.
LAST_INDEX_MODE, true, compareTitles);
[mxmlc]

compiler documentation says:

* 1067
* Implicit coercion of a value of type _ to an unrelated type _.  
* You are attempting to cast an object to a type to which it cannot be 
converted. This can happen if the class you are casting to is not in the 
inheritance chain of the object being cast. This error appears only when the 
compiler is running in strict mode.

code:
--
private function compareTitles(itemA:MyObj, itemB:MyObj):int {
var valueA:String = itemA.title;
var valueB:String = itemB.title;
return ObjectUtil.stringCompare(valueA, valueB);
}
---
// forAddition is pre-sorted from the backend
var forAddition:ArrayCollection = ..some data..;

// Check insertion index to maintain sorting order
var sort:Sort = new Sort();
var insertionIndex:int = 0;

for (var i:int=0; iforAddition.length; i++) {
insertionIndex = sort.findItem(forAddition[i], 
Sort.LAST_INDEX_MODE, true, compareTitles);
items.addItemAt(forAddition[i], insertionIndex);
}
---

What changes do I need to do fix the error? I dont see any datatype mismatch at 
the method parameters.

Regards,
Stephen

   
-
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.

RE: [flexcoders] Sort - findItem - compareFunction prob

2008-04-16 Thread ibo
second arg?

sort.findItem(forAddition[i], Sort.LAST_INDEX_MODE, true, compareTitles);

The 2nd argument is a constant provided in Sort class. I used whats available. 
The other 2 options are : 

Sort.LAST_INDEX_MODE
Sort.ANY_INDEX_MODE

Care to give a correct sample usage of Sort.findItem()? I cant find an example 
anywhere. Thanks.

Alex Harui [EMAIL PROTECTED] wrote:   
  You’re missing the second argument to findItem.
   
  
-
  
  From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of ibo
 Sent: Wednesday, April 16, 2008 2:10 PM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Sort - findItem - compareFunction prob
  
   
Hi I'm having problem with sorting, the compiler says :
 
 error:
 
 [mxmlc] C:\stephen\Main.mxml(51):  Error: Implicit coercion of a value of 
type Boolean to an unrelated type String.
 [mxmlc] insertionIndex = sort.findItem(forAddition[i], 
Sort.
 LAST_INDEX_MODE, true, compareTitles);
 [mxmlc]
 
 compiler documentation says:
 
 * 1067
 * Implicit coercion of a value of type _ to an unrelated type _.  
 * You are attempting to cast an object to a type to which it cannot be 
converted. This can happen if the class you are casting to is not in the 
inheritance chain of the object being cast. This error appears only when the 
compiler is running in strict mode.
 
 code:
 --
 private function compareTitles(itemA:MyObj, itemB:MyObj):int {
 var valueA:String = itemA.title;
 var valueB:String = itemB.title;
 return ObjectUtil.stringCompare(valueA, valueB);
 }
 ---
 // forAddition is pre-sorted from the backend
 var forAddition:ArrayCollection = ..some data..;
 
 ! // Check insertion index to maintain sorting order
 var sort:Sort = new Sort();
 var insertionIndex:int = 0;
 
 for (var i:int=0; iforAddition.length; i++) {
 insertionIndex = sort.findItem(forAddition[i], 
Sort.LAST_INDEX_MODE, true, compareTitles);
 items.addItemAt(forAddition[i], insertionIndex);
 }
 ---
 
 What changes do I need to do fix the error? I dont see any datatype mismatch 
at the method parameters.
 
 Regards,
 Stephen


-
  
  Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.
  
  
 


 
   

   
-
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.

RE: [flexcoders] Sort - findItem - compareFunction prob

2008-04-16 Thread ibo
Agh. How could I miss that. ive depended too much on IDE and its showing now 
that im using plain text editor :P. Thanks a bunch.

Alex Harui [EMAIL PROTECTED] wrote:   
  From the source code:  LAST_INDEX_MODE is the third param.
   
  /**
  *  Finds the specified object within the specified array (or the insertion
  *  point if asked for), returning the index if found or -1 if not.
  *  The ListCollectionView class codefindixxx/i()/code methods use 
  *  this method to find the requested item; as a general rule, it is 
  *  easier to use these functions, and not codefindItem()/code to find 
  *  data in ListCollectionView-based objects. 
  *  You call the codefindItem()/code method directly when writing a 
class
  *  that supports sorting, such as a new ICollectionView implementation.
  *
  *  @param items the Array within which to search.
  *  @param values Object containing the properties to look for (or
  *the object to search for, itself).
  *The object must consist of field name/value pairs, where
  *the field names are names of fields specified by the 
  *codeSortFields/code property, in the same order they 
  *are used in that property. 
  *You do not have to specify all of the fields from the 
  *codeSortFields/code property, but you 
  *cannot skip any in the order. 
  *Therefore, if the codeSortFields/code
  *properity lists three fields, you can specify its first
  *and second fields in this parameter, but you cannot 
specify 
  *only the first and third fields.
  *  @param mode String containing the type of find to perform.
  *   Valid values are
  * ul
  *   liANY_INDEX_MODE/li Return any position that
  *   is valid for the values.
  *   liFIRST_INDEX_MODE/li Return the position
  *   where the first occurrance of the values is found.
  *   liLAST_INDEX_MODE/li Return the position
  *   where the
  *   last ocurrance of the specified values is found.
  * /ul
  *  @param returnInsertionIndex If the method does not find an item 
identified
  * by the codevalues/code parameter, and this 
parameter
  * is codetrue/code the codefindItem()/code
  * method returns the insertion point for the values,
  * that is the point in the sorted order where you 
should 
  * insert the item.
  *  @param compareFunction a comparator function to use to find the item.  
If 
  * you do not specify this parameter, the function uses 
  * the function determined by the Sort instance's 
  * codecompareFunction/code property, 
  * passing in the array of fields determined
  * by the values object and the current SortFields.
  *  @return int The index in the array of the found item.
  *If the codereturnInsertionIndex/code parameter is
  *  codefalse/code and the item is not found, returns -1.
  *If the codereturnInsertionIndex/code parameter is
  *  codetrue/code and the item is not found, returns
  *the index of the point in the sorted array where the 
values
  *  would be inserted.
  */
  public function findItem(items:Array,
   values:Object,
   mode:String,
   returnInsertionIndex:Boolean = false,
   compareFunction:Function = null):int
  {
   
  
-
  
  From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of ibo
 Sent: Wednesday, April 16, 2008 8:13 PM
 To: flexcoders@yahoogroups.com
 Subject: RE: [flexcoders] Sort - findItem - compareFunction prob
  
   
second arg?
 
 sort.findItem(forAddition[i], Sort.LAST_INDEX_MODE, true, compareTitles);
 
 The 2nd argument is a constant provided in Sort class. I used whats available. 
The other 2 options are : 
 
 Sort.LAST_INDEX_MODE
 Sort.ANY_INDEX_MODE
 
 Care to give a correct sample usage of Sort.findItem()? I cant find an example 
anywhere. Thanks.
 
 Alex Harui [EMAIL PROTECTED] wrote:
  You’re missing the second argument to findItem.
  
 
  
  
-
  
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of ibo
 Sent: Wednesday, April 16, 2008 2:10 PM
 To: flexcoders@yahoogroups.com