[flexcoders] RichTextEditor's Minimum Size

2007-12-18 Thread triggersoftware
Is there any way around RichTextEditor's minimum size?  It has a
minimum size of 220 pixels wide by 200 pixels high, which is just too
big for my application.  

If I set the size to smaller than this scroll bars appear *within* the
control.

Cheers,

David.



[flexcoders] Re: RichTextEditor's Minimum Size

2007-12-18 Thread triggersoftware
Got it!  Set the textArea subcomponent's size:

  form.txtField.textArea.height = form.txtField.height;

What a faff!  Can anyone explain why I have to do this?

--- In flexcoders@yahoogroups.com, triggersoftware [EMAIL PROTECTED]
wrote:

 Is there any way around RichTextEditor's minimum size?  It has a
 minimum size of 220 pixels wide by 200 pixels high, which is just too
 big for my application.  
 
 If I set the size to smaller than this scroll bars appear *within* the
 control.
 
 Cheers,
 
 David.





[flexcoders] Flex Builder 3

2007-12-10 Thread triggersoftware
I've upgrade to Flex Builder 3 and noticed that it's more pedantic about
how I form my web service calls.  The following code WORKS:

 const service:WebService = new WebService();

service.loadWSDL(http://d6zltz1j:8080/Misura360/RespondentService?wsdl\
);
 service.addEventListener(FaultEvent.FAULT, onFault);
 service.addEventListener(ResultEvent.RESULT, onResult);
 var loginOperation:Operation = new Operation();
 loginOperation.name = login;
 loginOperation.request = new
Login([EMAIL PROTECTED], db);
 service.operations = {login : loginOperation};
 service.login();

...but this doesn't:

 const service:WebService = new WebService();

service.loadWSDL(http://d6zltz1j:8080/Misura360/RespondentService?wsdl\
);
 service.addEventListener(FaultEvent.FAULT, onFault);
 service.addEventListener(ResultEvent.RESULT, onResult);
 service.login(new Login([EMAIL PROTECTED],
db));

The onResult handler is still called, but my result object is NULL.  How
come?



[flexcoders] Web Services and Arrays

2007-12-07 Thread triggersoftware
I've been connecting our Flex app to Web Services written in JBoss for
the first time and noticed some odd things happening when the web
service sends back an array.

This problem basically goes away if you change the operation tag's
resultFormat attribute from object to e4x.  Can anyone explain this?

Here's the soap message that is coming back:

env:Envelope xmlns:env=http://schemas.xmlsoap.org/soap/envelope/;
env:Header/
env:Body
   ns2:fetchLookupsResponse
xmlns:ns2=http://session.misura.triggersoft.com/;
  return
 functions
descriptionHR/description
functionId1/functionId
 /functions
 functions
descriptionFinance/description
functionId2/functionId
 /functions
 functions
descriptionIT/description
functionId3/functionId
 /functions
 grades
descriptionG01/description
gradeId1/gradeId
 /grades
 grades
descriptionG02/description
gradeId2/gradeId
 /grades
 grades
descriptionG03/description
gradeId3/gradeId
 /grades
  /return
   /ns2:fetchLookupsResponse
/env:Body
/env:Envelope

According to JBoss, this is how lists are sent over soap. [shrug]

When the operation is defined as having a resultFormat of object, the
structure of the ResultEvent is as follows:

event:ResultEvent
- result:ObjectProxy
   - return:ObjectProxy
 - functions:ArrayCollection
   [0] ComplexString
   - value = HR
   [1] ComplexString
   - value = 1
   [2] ArrayCollection
   [0] ComplexString
   - Value = Finance
   [1] ComplexString
   - Value = 2
   [3] ArrayCollection
   [0] ComplexString
   - Value = IT
   [1] ComplexString
   - Value = 3
 - grades:ArrayCollection
   [0] ComplexString
   [1] ComplexString
   [2] ArrayCollection
   [3] ArrayCollection

As you can see, the first two elements of the array should really be
sub-elements.  However, when I change the resultFormat attribute from
object to e4x the output is as follows:

event:ResultEvent
- result: XMLList
   [0]:XML
   - ns2:fetchLookupsResponse
 - return
   - functions
 - description
   HR
 - functionId
   1
   - functions
 - description
   Finance
 - functionId
   2
   - functions
 - description
   IT
 - functionId
   3
   - grades
 ...

Can anyone explain why the object version behaves so strangely?

Cheers,

David.



[flexcoders] Re: Web Services and Arrays

2007-12-07 Thread triggersoftware
It looks to me like the Flash deserialising code can't deal when an
array is sent back with other objects at the same level:

someObject
   grades
   grades
   grades
   someOtherObject
/someObject

It doesn't work properly out that it's an array unless all sibling
nodes are of the same type:

someObject
   gradeWrapper
 grades
 grades
 grades
   /gradeWrapper
   someOtherObject
/someObject




[flexcoders] Re: Web Services and Arrays

2007-12-07 Thread triggersoftware
That's rubbish!  Who at Adobe do I have to bribe?

I've never submitted a Bug report to Adobe before.  Where should it be
done?

Here ? http://www.adobe.com/bin/fp9betafeedback.cgi



[flexcoders] Re: Web Services and Arrays

2007-12-07 Thread triggersoftware
For anyone else having this problem, you can also get round it by
setting the resultFormat to e4x as it properly preserves lists.

   var service:WebService = new WebService();
  
service.loadWSDL(http://d6zltz1j:8080/Misura360/RespondentService?wsdl\
);
   service.addEventListener(ResultEvent.RESULT, onResult);
   service.addEventListener(FaultEvent.FAULT, onFault);
   service.fetchQuestionnaire.resultFormat = e4x
   service.fetchQuestionnaire(new FetchQuestionnaire(5))


[flexcoders] Summary Data

2007-12-06 Thread triggersoftware
I have two grids.  The first has a list of users:

User  Type
---
Bob   IT
James Marketing
Mark  Marketing
Stef  Sales


The second contains a summary view of the users *by type*:

Type  Count
---
IT 1
Marketing  2
Sales  1


These two grids are on the same form.  As users are added to the first
grid I want to the second grid to refresh.  How do I do this?  

In other languages/frameworks I would write an adapter for the summary
grid, but am unsure of how/where to do this in flex.

Cheers,

David.



[flexcoders] Re: Another Change Event?

2007-12-06 Thread triggersoftware
Thanks.  In the end I just put a delay on the effect.

--- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote:

 Try callLater?
 
  
 
 
 
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of triggersoftware
 Sent: Thursday, November 22, 2007 2:25 AM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Another Change Event?
 
  
 
 I'm writing a Quiz application where the user is automatically
 advanced to the next question upon answering the current question.
 
 I'm currently hooking into the CHANGE event on the RadioButtonGroup
 object, but this event appears to be fired *before* the component gets
 a chance to draw the dot in the relevant RadioButton. The effect of
 this is that the user isn't sure whether or not the Quiz has recorded
 her last answer. 
 
 Currently, to achieve the effect I want I'm having to use a timer to
 delay the moving on to the next question (see below). Is there a
 better way?
 
 ?xml version=1.0 encoding=utf-8?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml
 http://www.adobe.com/2006/mxml 
 layout=vertical
 
 mx:Label text=Reset/
 mx:RadioButtonGroup id=grp1 change=reset()/
 mx:RadioButton id=button1 group={grp1} label=Click Me! /
 mx:RadioButton id=button2 group={grp1} label=Click Me! /
 mx:HRule width=100%/
 
 mx:Script
 ![CDATA[
 private function reset():void {
 button1.selected = false;
 button2.selected = false;
 } 
 ]]
 /mx:Script
 
 mx:Label text=Delayed Reset/
 mx:RadioButtonGroup id=grp2 change=delayedReset()/
 mx:RadioButton id=button3 group={grp2} label=Click Me! /
 mx:RadioButton id=button4 group={grp2} label=Click Me! /
 
 mx:Script
 ![CDATA[
 private function delayedReset():void {
 var t:Timer = new Timer(1000, 1);
 t.addEventListener(TimerEvent.TIMER, timerExpired);
 t.start(); 
 } 
 
 private function timerExpired(event:TimerEvent):void {
 button3.selected = false;
 button4.selected = false; 
 }
 ]]
 /mx:Script
 
 /mx:Application





[flexcoders] Re: Summary Data

2007-12-06 Thread triggersoftware
 Just adjust it's data provider to match the new summary data, from
your existing add method.

Are you talking about adding something into the method which adds a
user to go and recalculate a separate model which is bound to the
summary table?  

If I understand you correctly then I'd have to fire this summary
refresh when I removed a user as well.  I would have expected data
binding to tell the grid to refresh its data rather than me doing it
manually.  

--- In flexcoders@yahoogroups.com, Tom Chiverton [EMAIL PROTECTED]
wrote:

 On Thursday 06 Dec 2007, triggersoftware wrote:
  These two grids are on the same form.  As users are added to the first
  grid I want to the second grid to refresh.  How do I do this?
 
 Just adjust it's data provider to match the new summary data, from your 
 existing add method.
 
 -- 
 Tom Chiverton
 Helping to autoschediastically negotiate sticky appliances
 on: http://thefalken.livejournal.com
 
 
 
 Please note, as of 10th December 2007 the registered office address
of Halliwells LLP will be at 3 Hardman Square, Spinningfields,
Manchester, M3 3EB
 
 
 
 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.





[flexcoders] Re: Summary Data

2007-12-06 Thread triggersoftware
 Maybe if you showed us how the two things are wired up together at
the moment, we'd could be more specific.

The summary grid is not wired up yet.  I just a have my main grid of
users and I want to add the summary grid.  

The kind of thing I was expecting to do was to simply define a
datasource for my summary grid and that datasource to define a
dependency on the main grid's datasource.  Therefore if any of the
main grid's data changed (user added/edited/deleted), the summary grid
would be refreshed.

?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;  
mx:Label text=Users:/
mx:DataGrid   
mx:ArrayCollection id=users
mx:Object name=David type=IT/
mx:Object name=Simon type=IT/ 
mx:Object name=Chris type=Management/ 
mx:Object name=Andy type=Support/
/mx:ArrayCollection   
/mx:DataGrid

mx:Label text=Summary:/
mx:DataGrid   
mx:ArrayCollection id=summary source=/
/mx:DataGrid  
/mx:Application




[flexcoders] Re: Summary Data

2007-12-06 Thread triggersoftware
mx:DataGrid id=summaryGrid dataProvider={
makeSummary(usersGrid.dataProvider) }

Ah...that looks more like it!  The only problem is that the summary
grid is not regenerated if the source changes:

?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
xmlns:local=*

mx:Label text=Users:/
mx:DataGrid id=grd editable=true dataProvider={users}   
mx:columns
mx:DataGridColumn editable=true dataField=name 
headerText=Name/
mx:DataGridColumn editable=true dataField=dept
headerText=Department/   
/mx:columns
/mx:DataGrid

mx:Button label=Add click={users.addItem(new SimpleUser('Test',
'IT'))}/
mx:Button label=Remove
click={users.removeItemAt(grd.selectedIndex)}/

mx:Label text=Summary:/
mx:DataGrid
dataProvider={makeSummary(ArrayCollection(grd.dataProvider))}/   


mx:Script
![CDATA[
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.events.CollectionEvent;

[Bindable]
private var users:ArrayCollection = new 
ArrayCollection([new
SimpleUser(David, IT), new SimpleUser(Simon, Management), new
SimpleUser(Andy, Support), new SimpleUser(Chris, Management)]);

private function
makeSummary(source:ArrayCollection):ArrayCollection {   
var mCount:uint = 0;
var iCount:uint = 0;
var sCount:uint = 0;

for (var i:uint=0; i  source.length; i++) {
var user:SimpleUser = 
SimpleUser(source[i]);
if (user.dept == Management) {
mCount++;
}
if (user.dept == IT) {
iCount++;
}
if (user.dept == Support) {
sCount++;
}   

}

var summary:ArrayCollection = new
ArrayCollection([{Department:'Management', count: mCount},
{Department:'IT', count: iCount}, {Department:'Support', count:
sCount}]);  
return summary;
}
]]
/mx:Script
/mx:Application





package
{

[Bindable]
public class SimpleUser
{   
public function SimpleUser(name:String, dept:String):void {
this.name = name;
this.dept = dept;
}

public var name:String;
public var dept:String;
}
}



[flexcoders] Re: Summary Data

2007-12-06 Thread triggersoftware
It was this level of fiddling about that I didn't really want to have
to get into, but I've managed to limit it to the following:

mx:DataGrid id=grdSummary
creationComplete={ArrayCollection(grdDetail.dataProvider).addEventListener(CollectionEvent.COLLECTION_CHANGE,
makeSummary)};makeSummary()/


private function makeSummary(event:CollectionEvent = null):void {
var mCount:uint = 0;
var iCount:uint = 0;
var sCount:uint = 0;

var source:ArrayCollection = grd.dataProvider as ArrayCollection;

for (var i:uint=0; i  source.length; i++) {
var user:SimpleUser = SimpleUser(source[i]);
if (user.dept == Management) {
mCount++;
}
if (user.dept == IT) {
iCount++;
}
if (user.dept == Support) {
sCount++;
}   

}

var summary:ArrayCollection = new ArrayCollection();
summary.addItem({Department:'Management', count: mCount});
summary.addItem({Department:'IT', count: iCount});
summary.addItem({Department:'Support', count: sCount});

grdSummary.dataProvider = summary;
}


Thanks for all your help.

David.



[flexcoders] Sanity Check!

2007-12-06 Thread triggersoftware
Is there any way to strongly type the objects that come back from a
Webservice call?  Something along the lines of:

[Bindable(wsdl=http://localhost:8080/MyProject/CandidateService?wsdl.Questionnaire)]
public class Questionnaire {
  ...
}

I know about the proxy generation in Flex Builder 3...



[flexcoders] JBoss Basic Authentication and Web Services

2007-11-29 Thread triggersoftware
My backend developer wants to secure with Basic Authentication the web
services he is going to produce.  Will this work properly with Flex?

I've seen .setCredentials(), but I've seen posts saying that this
doesn't work (http://taylorbarstow.com/tags/air/) and also that when
you *do* manage to subvert Flex to work with Basic Authentication, if
the authentication fails the browser takes over, offering its own
popup login - yuk!

Has anyone had experience in doing this or can point me at tutorials I
seem to have missed?

Cheers,

David.



[flexcoders] Transition when reverting to the base state

2007-11-27 Thread triggersoftware
I know how to get a component removal transition to work when I'm
actively calling mx:RemoveChild, but I'm not sure how to get a removal
transition to work when components are removed by Flex to undo the
calls to mx:AddChild which moved us into the current state in the
first place.

Okay, that probably doesn't make much sense, so here's a simple
example.  How do I get the mx:Fade transition to be applied to the
label so that when the user clicks on the Base State button the
label fades out?


?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
layout=vertical
mx:HBox
mx:Button label=State A click=currentState = 'A'/
mx:Button label=Base State click=currentState = ''/   

/mx:HBox
mx:HBox id=placeholder/

mx:states
mx:State name=A
mx:AddChild relativeTo={placeholder}
mx:Label id=lblMessage text=I am now in 
state A!/
/mx:AddChild
/mx:State
/mx:states

mx:transitions
mx:Transition fromState= toState=A
mx:Glow target={lblMessage} alphaFrom=1 alphaTo=0
duration=2000/ 
/mx:Transition
mx:Transition fromState=A toState=
mx:Fade target={lblMessage} alphaFrom=1.0 
alphaTo=0.0
duration=2000/
/mx:Transition
/mx:transitions

/mx:Application



[flexcoders] Re: Transition when reverting to the base state

2007-11-27 Thread triggersoftware
After a bit more playing, I can see that both effects are definitely
getting run, it's just that I can't see the A - Base transition
because Flex has already removed the components.

Still stuck though!

--- In flexcoders@yahoogroups.com, triggersoftware [EMAIL PROTECTED]
wrote:

 I know how to get a component removal transition to work when I'm
 actively calling mx:RemoveChild, but I'm not sure how to get a removal
 transition to work when components are removed by Flex to undo the
 calls to mx:AddChild which moved us into the current state in the
 first place.
 
 Okay, that probably doesn't make much sense, so here's a simple
 example.  How do I get the mx:Fade transition to be applied to the
 label so that when the user clicks on the Base State button the
 label fades out?
 
 
 ?xml version=1.0 encoding=utf-8?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
 layout=vertical
   mx:HBox
   mx:Button label=State A click=currentState = 'A'/
   mx:Button label=Base State click=currentState = ''/   
 
   /mx:HBox
   mx:HBox id=placeholder/
   
   mx:states
   mx:State name=A
   mx:AddChild relativeTo={placeholder}
   mx:Label id=lblMessage text=I am now in 
 state A!/
   /mx:AddChild
   /mx:State
   /mx:states
   
   mx:transitions
   mx:Transition fromState= toState=A
   mx:Glow target={lblMessage} alphaFrom=1 alphaTo=0
 duration=2000/ 
   /mx:Transition
   mx:Transition fromState=A toState=
   mx:Fade target={lblMessage} alphaFrom=1.0 
 alphaTo=0.0
 duration=2000/  
   /mx:Transition
   /mx:transitions
   
 /mx:Application





[flexcoders] Re: Transition when reverting to the base state

2007-11-27 Thread triggersoftware
I've worked it out.  You can specify when the component removal
happens by using a mx:RemoveChildAction tag:



mx:Style
@font-face {
src: local(Arial);
fontFamily: myArial;
}

global {
fontFamily: myArial;
fontSize: 15
}
/mx:Style

mx:transitions
mx:Transition fromState= toState=A
mx:Sequence target={lblMessage} duration=2000 

mx:Glow alphaFrom=1 alphaTo=0 /   

/mx:Sequence

/mx:Transition
mx:Transition fromState=A toState=
mx:Sequence target={lblMessage} duration=2000 

mx:Fade alphaFrom=1 alphaTo=0/
mx:RemoveChildAction/ 
/mx:Sequence
/mx:Transition
/mx:transitions


(Note: I've also embedded a font to allow the Fade effect to work
properly)



[flexcoders] Data Binding and dealing with NULLs

2007-11-26 Thread triggersoftware
I hit this problem quite often and wonder if there is a general
solution...

I have a component which displays a list of questions and has the
concept of a current question i.e. the question the user is answering:

mx:Script
![CDATA[
import mx.collections.ArrayCollection;

[Bindable]  
public var questions:ArrayCollection;

[Bindable]
public var currentQuestion:MultipleChoiceQuestion =
questions[lstBox.selectedIndex];
]]
/mx:Script

The problem is that the questions array doesn't get populated until
after Flex has tried to setup all the bindings meaning I get a
NullPointer when it tries to setup currentQuestion.

At the moment I have to get around this with the following code:

!-- Databinding of Current Question --
mx:Script
![CDATA[
private function init():void {
refreshCurrentQuestion();
}

public function refreshCurrentQuestion():void {
if (questions != null) {
currentQuestion = 
questions[lst.selectedIndex];
}   
}
]]
/mx:Script

This seems quite hacky...



[flexcoders] Another Change Event?

2007-11-22 Thread triggersoftware
I'm writing a Quiz application where the user is automatically
advanced to the next question upon answering the current question.

I'm currently hooking into the CHANGE event on the RadioButtonGroup
object, but this event appears to be fired *before* the component gets
a chance to draw the dot in the relevant RadioButton.  The effect of
this is that the user isn't sure whether or not the Quiz has recorded
her last answer.  

Currently, to achieve the effect I want I'm having to use a timer to
delay the moving on to the next question (see below).  Is there a
better way?


?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
layout=vertical

mx:Label text=Reset/
mx:RadioButtonGroup id=grp1 change=reset()/
mx:RadioButton id=button1 group={grp1} label=Click Me! /
mx:RadioButton id=button2 group={grp1} label=Click Me! /
mx:HRule width=100%/

mx:Script
![CDATA[
private function reset():void {
button1.selected = false;
button2.selected = false;
}   
]]
/mx:Script

mx:Label text=Delayed Reset/
mx:RadioButtonGroup id=grp2 change=delayedReset()/
mx:RadioButton id=button3 group={grp2} label=Click Me! /
mx:RadioButton id=button4 group={grp2} label=Click Me! /

mx:Script
![CDATA[
private function delayedReset():void {
var t:Timer = new Timer(1000, 1);
t.addEventListener(TimerEvent.TIMER, 
timerExpired);
t.start();  

}   

private function timerExpired(event:TimerEvent):void {
button3.selected = false;
button4.selected = false;   
}
]]
/mx:Script

/mx:Application




[flexcoders] Binding Objects to a DataGrid

2007-11-15 Thread triggersoftware
I've got a list an ArrayCollection of objects bound to a grid.  The
User selects a row in the grid and hits a button.  That button
manipulates that row's associated object.  

What do I have to do to get the grid to reflect the changes?  I can
re-assign the dataProvider, but that seems rather heavy-weight.



[flexcoders] Re: Binding Objects to a DataGrid

2007-11-15 Thread triggersoftware
Here's a sample app demonstrating my problem.  You don't see the value
in the Number column get incremented until you hit the Reload button.

?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
layout=vertical

mx:Script
![CDATA[
import mx.collections.ArrayCollection;

private var myData:ArrayCollection = new 
ArrayCollection([
{name:'Bob', value:1}, {name:'Jim', value:2}]);
]]
/mx:Script

mx:DataGrid id=grd dataProvider={myData}
mx:columns
mx:DataGridColumn headerText=Name dataField=name/
mx:DataGridColumn headerText=Value 
dataField=value/
/mx:columns
/mx:DataGrid

mx:HBox
mx:Button label=Increment click={grd.selectedItem.value++}
enabled={grd.selectedItem != null}/
mx:Button label=Reload click={grd.dataProvider = myData}/
/mx:HBox

/mx:Application




[flexcoders] Re: Accessing dataField from within a Custom Item Renderer

2007-11-15 Thread triggersoftware
Genius!  Was just having that problem with another I wrote...

--- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote:

 Better, but will fail if you scroll.  Renderers get recycled and
 creatuinComplete only gets fired once.
 
  
 
 Use the dataChange event instead
 
  
 
 
 
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of triggersoftware
 Sent: Wednesday, November 14, 2007 9:14 AM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Re: Accessing dataField from within a Custom Item
 Renderer
 
  
 
 Yup...I was being dense:
 
 ?xml version=1.0 encoding=utf-8?
 mx:Label xmlns:mx=http://www.adobe.com/2006/mxml
 http://www.adobe.com/2006/mxml 
 textAlign=center creationComplete=setText() 
 mx:Script
 ![CDATA[
 import mx.controls.dataGridClasses.DataGridListData;
 
 private function getFormattedDate():String { 
 var columnMetadata:DataGridListData = DataGridListData(listData)
 var fieldName:String = columnMetadata.dataField; 
 var data:Object = data[fieldName];
 
 return df.format(data);
 }
 
 private function setText():void {
 text = getFormattedDate();
 }
 ]]
 /mx:Script
 mx:DateFormatter id=df formatString=DD-MMM-YY/ 
 /mx:Label





[flexcoders] Popups and Focus

2007-11-14 Thread triggersoftware
I'm trying to get my application to launch a popup as soon as it
starts up and the popup should put the focus its text box.  The
problem is, that while I can see the blue border around the text box,
the cursor is not active in the text box, meaning the user has to
click on the popup in order to type anything in.

How do I make it so the user can type in straight away?


?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
layout=absolute creationComplete=doInit()

mx:Script
![CDATA[
import Login.Login;
import mx.managers.PopUpManager;

private function doInit():void {
PopUpManager.createPopUp(this, TestPopUp, 
true);
}
]]
/mx:Script

/mx:Application




?xml version=1.0 encoding=utf-8?
mx:TitleWindow xmlns:mx=http://www.adobe.com/2006/mxml; 
width=400 height=300 
creationComplete=doInit()

mx:Script
![CDATA[
import mx.controls.Alert;

private function doInit():void {
txt.setFocus(); 
}   
]]
/mx:Script

mx:TextInput id=txt/
/mx:TitleWindow






[flexcoders] Re: Popups and Focus

2007-11-14 Thread triggersoftware
Thanks for the responses.  However, I really need this to work in
Firefox.  

It seems rather insane that this is even a problem - I've called
.setFocus() - why doesn't it do what it's told?!

Any cross-platform solutions?

--- In flexcoders@yahoogroups.com, Hara Jn [EMAIL PROTECTED] wrote:

 BTW all the code is  in index.template.html under html-template
 folder. As said earlier it wont work in firefox
 
 Cheers
 Hara
 
 On Nov 14, 2007 5:18 PM, Hara Jn [EMAIL PROTECTED] wrote:
  AS Muzak said use the id in the function AC_FL_RunContent( in the
  javascript used in the html generated.Use the id.If the id is 
  in the body tag of the html use .focus() in the onload event.
 
  Cheers
  Hara
 
 
  On Nov 14, 2007 4:50 PM, Muzak [EMAIL PROTECTED] wrote:
   Use Javascript to set focus to the swf when it's loaded.
   IIRC, only works in IE, not Firefox.
  
   regards,
   Muzak
  
  
   - Original Message -
   From: triggersoftware [EMAIL PROTECTED]
   To: flexcoders@yahoogroups.com
   Sent: Wednesday, November 14, 2007 11:53 AM
   Subject: [flexcoders] Popups and Focus
  
  
   I'm trying to get my application to launch a popup as soon as it
   starts up and the popup should put the focus its text box.  The
   problem is, that while I can see the blue border around the text
box,
   the cursor is not active in the text box, meaning the user has to
   click on the popup in order to type anything in.
  
   How do I make it so the user can type in straight away?
  
  
   ?xml version=1.0 encoding=utf-8?
   mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
   layout=absolute creationComplete=doInit()
  
   mx:Script
   ![CDATA[
   import Login.Login;
   import mx.managers.PopUpManager;
  
   private function doInit():void {
   PopUpManager.createPopUp(this, TestPopUp, true);
   }
   ]]
   /mx:Script
  
   /mx:Application
  
  
  
  
   ?xml version=1.0 encoding=utf-8?
   mx:TitleWindow xmlns:mx=http://www.adobe.com/2006/mxml;
   width=400 height=300
   creationComplete=doInit()
  
   mx:Script
   ![CDATA[
   import mx.controls.Alert;
  
   private function doInit():void {
   txt.setFocus();
   }
   ]]
   /mx:Script
  
   mx:TextInput id=txt/
   /mx:TitleWindow
  
  
  
  
  
  
  
   --
   Flexcoders Mailing List
   FAQ:
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
   Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.com
   Yahoo! Groups Links
  
  
  
  
 





[flexcoders] Re: Progress Bar Item Renderer

2007-11-14 Thread triggersoftware
Came up with a nearly-pure MXML version:

?xml version=1.0 encoding=utf-8?
mx:HBox xmlns:mx=http://www.adobe.com/2006/mxml;

mx:ProgressBar id=pb mode=manual label=%3%%
labelPlacement=center creationComplete=setData() width=100%/

mx:Script
![CDATA[   
public function setData():void {
var percentageComplete:Number = 
Number(data.percentageComplete) * 100;
pb.setProgress(percentageComplete, 100);

if (percentageComplete == 0)
{   
pb.setStyle(color, 0xda0707);
}
else if (percentageComplete == 100)
{
pb.setStyle(barColor, 0x04ae30);
}
else
{
pb.setStyle(barColor, 0xe17706);
}
}
]]
/mx:Script

/mx:HBox




[flexcoders] Accessing dataField from within a Custom Item Renderer

2007-11-14 Thread triggersoftware
Is there any way I can access the dataField field from within a
custom item renderer?

mx:DataGridColumn itemRenderer=MyCustomComponent
dataField=startDate/
mx:DataGridColumn itemRenderer=MyCustomComponent dataField=endDate/

In this case the component MyCustomComponent would know to look at the
data.startDate field when displaying the first column and the
data.endDate field when displaying the second column.  I would imagine
the component to look something like:

mx:Label text={formatter.format(data[dataField])}/



[flexcoders] Re: Accessing dataField from within a Custom Item Renderer

2007-11-14 Thread triggersoftware
Thanks for the response (I can't believe how hard it's been trying to
find this out!).  I'm trying to use the following component in a
DataGrid, but listData is evaluating to NULL when I debug the
application:

?xml version=1.0 encoding=utf-8?
mx:Label xmlns:mx=http://www.adobe.com/2006/mxml; textAlign=center 
mx:Script
![CDATA[
import mx.controls.dataGridClasses.DataGridListData;

private function getData():Object {
var columnMetadata:DataGridListData = 
DataGridListData(listData)
var fieldName:String = 
columnMetadata.dataField;
return data[fieldName];
}

private function getFormattedDate():String {
return df.format(getData());
}
]]
/mx:Script
mx:DateFormatter id=df formatString=DD-MMM-YY/
mx:Label text={getFormattedDate()}/
/mx:Label

Am I being dense?

--- In flexcoders@yahoogroups.com, ben.clinkinbeard
[EMAIL PROTECTED] wrote:

 Yes, you'll want to look into the listData property. Flex
 automatically populates it for drop-in editors and renderers, so if
 your renderer implements IDropInListItemRenderer or inherits from a
 class that does (Button, Label, ComboBox, plus 11 more) then you will
 be able to access listData. When your renderer is in a DataGrid,
 listData will be of type DataGridListData, which provides properties
 like dataField, columnIndex, rowIndex, etc.
 
 HTH,
 Ben
 
 
 --- In flexcoders@yahoogroups.com, triggersoftware david.bates@
 wrote:
 
  Is there any way I can access the dataField field from within a
  custom item renderer?
  
  mx:DataGridColumn itemRenderer=MyCustomComponent
  dataField=startDate/
  mx:DataGridColumn itemRenderer=MyCustomComponent
 dataField=endDate/
  
  In this case the component MyCustomComponent would know to look at the
  data.startDate field when displaying the first column and the
  data.endDate field when displaying the second column.  I would imagine
  the component to look something like:
  
  mx:Label text={formatter.format(data[dataField])}/
 





[flexcoders] Re: Accessing dataField from within a Custom Item Renderer

2007-11-14 Thread triggersoftware
Yup...I was being dense:

?xml version=1.0 encoding=utf-8?
mx:Label xmlns:mx=http://www.adobe.com/2006/mxml;
textAlign=center creationComplete=setText()
mx:Script
![CDATA[
import mx.controls.dataGridClasses.DataGridListData;

private function getFormattedDate():String {

var columnMetadata:DataGridListData = 
DataGridListData(listData)
var fieldName:String = 
columnMetadata.dataField;
var data:Object = data[fieldName];

return df.format(data);
}

private function setText():void {
text = getFormattedDate();
}
]]
/mx:Script
mx:DateFormatter id=df formatString=DD-MMM-YY/
/mx:Label




[flexcoders] Progress Bar Item Renderer

2007-11-12 Thread triggersoftware
I'm trying to create a progress bar item renderer, but I can't get the
value of progress bar to bind:

mx:AdvancedDataGridColumn headerText=% Complete width=100 
mx:itemRenderer
mx:Component
mx:VBox   

mx:Label id=lbl 
text={data.percentageComplete}/
mx:ProgressBar label=%3%% maximum=100 
width=100%
mode=manual source={data.percentageComplete}/  

/mx:VBox
/mx:Component
/mx:itemRenderer
/mx:AdvancedDataGridColumn

You don't appear to be able to bind the value using source.  What am I
doing wrong?



[flexcoders] Re: Progress Bar Item Renderer

2007-11-12 Thread triggersoftware
 When using 'manual' you could try using the setter method, again
from the docs...

I've tried doing this but Flex doesn't like having script blocks in
the item renderer.

 When needed for binding, take a look at BindingUtils.bindSetter

I don't know what to do with this as I can't get into a SCRIPT block.

A small example would really help.

Cheers,

David.

--- In flexcoders@yahoogroups.com, johantrax [EMAIL PROTECTED]
wrote:

 The source-property is bindable, though as stated in the docs:
 Refers to the control that the ProgressBar is measuring the progress
 of. Use this property only in event and polled mode. A typical usage
 is to set this property to a Loader control.
 
 Since you set your mode to manual, the source-property will be ignored
  and as a consequence, the binding won't be executed.
 
 When using 'manual' you could try using the setter method, again from
 the docs:
 public function setProgress(value:Number, total:Number):void
 Sets the state of the bar to reflect the amount of progress made
 when using manual mode. The value argument is assigned to the value
 property and the maximum argument is assigned to the maximum property.
 The minimum property is not altered.
 
 When needed for binding, take a look at BindingUtils.bindSetter
 
 --jeetee
 
 --- In flexcoders@yahoogroups.com, triggersoftware david.bates@
 wrote:
 
  I'm trying to create a progress bar item renderer, but I can't get the
  value of progress bar to bind:
  
  mx:AdvancedDataGridColumn headerText=% Complete width=100 
  mx:itemRenderer
  mx:Component
  mx:VBox   
  
  mx:Label id=lbl 
  text={data.percentageComplete}/
  mx:ProgressBar label=%3%% maximum=100 
  width=100%
  mode=manual source={data.percentageComplete}/  
  
  /mx:VBox
  /mx:Component
  /mx:itemRenderer
  /mx:AdvancedDataGridColumn
  
  You don't appear to be able to bind the value using source.  What am I
  doing wrong?
 





[flexcoders] Re: Progress Bar Item Renderer

2007-11-12 Thread triggersoftware
hmmm... the code completion in Eclipse builder says it isn't valid,
but the compiler says it is

Anyway, I solved the problem by creating a new class:

?xml version=1.0 encoding=utf-8?
mx:HBox xmlns:mx=http://www.adobe.com/2006/mxml;


mx:Script
![CDATA[
import mx.controls.ProgressBarLabelPlacement;
import mx.controls.ProgressBarMode;
import mx.controls.ProgressBar;

private var _data:Object;

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

var percentageComplete:Number = 
Number(value.percentageComplete) *
100;
var colour:Number   

if (percentageComplete == 0)
{   
colour = 0xda0707;  

}
else if (percentageComplete == 100)
{
colour = 0x04ae30;
}
else
{
colour = 0x005efb;
}


removeAllChildren();

var pb:ProgressBar = new ProgressBar();
pb.mode = ProgressBarMode.MANUAL;
pb.label = %3%%
pb.setStyle(barColor, colour);
pb.labelPlacement = 
ProgressBarLabelPlacement.CENTER;
pb.setProgress(percentageComplete, 100);

pb.percentWidth = 100;


addChild(pb);
}

override public function get data():Object {
return _data;
}
]]
/mx:Script

/mx:HBox


--- In flexcoders@yahoogroups.com, Douglas Knudsen
[EMAIL PROTECTED] wrote:

 Its certainly possible to do this.  Try the following
 
 mx:itemRenderer
 mx:Component
 mx:HBox
 mx:Script
 .
 
 Cheers!
 
 DK
 
 On Nov 12, 2007 8:59 AM, johantrax  [EMAIL PROTECTED] wrote:
 
Seems to me that Flex doesn't like scripts anywhere but in the
root of
  a document. I do not have any experience with item-renderers, nor do I
  have with loaders, but this is my guess:
 
  If you create the ItemRenderer as a custom mxml-component, then you
  should be able to set a script-block in this file.
 
  Again this is just my wild thinking, but I hope that with it, you, or
  others in here, might get to a working example.
 
  Good luck,
 
  --jeetee
 
  --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com,
  triggersoftware david.bates@
  wrote:
  
When using 'manual' you could try using the setter method, again
   from the docs...
  
   I've tried doing this but Flex doesn't like having script blocks in
   the item renderer.
  
When needed for binding, take a look at BindingUtils.bindSetter
  
   I don't know what to do with this as I can't get into a SCRIPT
block.
  
   A small example would really help.
  
   Cheers,
  
   David.
  
   ... [cut out response] ...
 
   
--- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com,
  triggersoftware david.bates@
wrote:

 I'm trying to create a progress bar item renderer, but I can't
  get the
 value of progress bar to bind:

 mx:AdvancedDataGridColumn headerText=% Complete width=100
 mx:itemRenderer
 mx:Component
 mx:VBox
 mx:Label id=lbl text={data.percentageComplete}/
 mx:ProgressBar label=%3%% maximum=100 width=100%
 mode=manual source={data.percentageComplete}/
 /mx:VBox
 /mx:Component
 /mx:itemRenderer
 /mx:AdvancedDataGridColumn

 You don't appear to be able to bind the value using source.
  What am I
 doing wrong?

   
  
 
   
 
 
 
 
 -- 
 Douglas Knudsen
 http://www.cubicleman.com
 this is my signature, like it?





[flexcoders] Re: Displaying an image stored in a database

2007-08-27 Thread triggersoftware
 If you're getting it through an object-serialization framework (AMF,
etc.), 

Yup, that's what I'm doing.

 then you may be receiving it already as a ByteArray, in which
case you need to load it with a Loader instance.

Where could I find information about this?  I've found the flex
documentation on these back-end/front-end integration issues rather
thin on the ground.

Cheers,

David.

--- In flexcoders@yahoogroups.com, Troy Gilbert [EMAIL PROTECTED]
wrote:

  When the employee objects are sent back to the client I don't know how
  to bind to this property as mx:Image source=.../ takes the
  *location* of the image, not the binaries themselves.
 
 Depends on how the data (or what format) its arriving in to your Flex
 app. If it comes over the wire in an XML doc (like a BASE64 encoded
 BLOB from a database), then you'll need to turn that into a ByteArray
 (I believe AS3 corelib, from Adobe -- see Google code -- has API for
 this), then load the ByteArray (assuming its the bytes of a
 PNG/JPG/GIF/SWF) with the Loader class.
 
 If you're getting it through an object-serialization framework (AMF,
 etc.), then you may be receiving it already as a ByteArray, in which
 case you need to load it with a Loader instance.
 
 Note, when using Loader, if you have it load bytes from a ByteArray
 there is still a one-frame delay before the loader completes, i.e. you
 do have to wait for it to fire the COMPLETE event before the content
 is accessible.
 
 Troy.