[flexcoders] Triggering Validator based on string value for TextInput

2008-10-02 Thread djohnson29
Does anyone know how to trigger a validator on a TextInput based on a
certain string value?

I have a regular TextInput with a regular Validator attached to it
(required Validation).  I would like to also trigger this Validator so
that the red outline and tooltip displays when there is a particular
value in the text property. 

So if the TextInput is empty, then the required validation kicks in,
and if the text property contains for example, foo, then then the
Validator fires as well.

Is there a quick and easy way to do this without overridding the
Validator?



[flexcoders] Re: Triggering Validator based on string value for TextInput

2008-10-02 Thread djohnson29
Thanks - I tried that out but the problem is the Regex matches the
value that I don't want. In other words I need the opposite of the
matched expression to trigger a valid result, and the matched
expression to be invalid.

Anyways, after much canoodling I just overrode the Validator class. 
Perhaps this will help someone else - 

package classes
{   
import mx.validators.ValidationResult;
import mx.validators.Validator;

   
public class CustomStringValidator extends Validator {

// Define Array for the return value of doValidation().
private var results:Array;

// Define the string that is not allowed and will trigger the
Validation error.
private var _stringNotAllowed:String;

private var _stringErrorMessage:String;


public function get stringNotAllowed():String{
return this._stringNotAllowed;
}

public function set stringNotAllowed(s:String):void{
_stringNotAllowed = s;
}

public function get stringErrorMessage():String{
return this._stringErrorMessage;
}

public function set stringErrorMessage(s:String):void{
_stringErrorMessage = s;
}
  
// Constructor.
public function CustomStringValidator() {
// Call base class constructor. 
super();
}

// Define the doValidation() method.
override protected function doValidation(value:Object):Array {

// Clear results Array.
results = [];

// Call base class doValidation().
results = super.doValidation(value);
// Return if there are errors.
if (results.length  0)
return results;

if(String(value) == _stringNotAllowed){
results.push(new
ValidationResult(true,null,notAllowed,_stringErrorMessage));
return results;
}

return results;
}
}
}


In mxml, I declare the component as follows:

 comp:CustomStringValidator source={myTextInput} property=text
stringNotAllowed=[Enter your name] stringErrorMessage=Please enter
a valid name. /





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

 I suppose you would need to use the regular expression validator.
 
 Ryan Gravener
 http://twitter.com/ryangravener
 
 
 On Thu, Oct 2, 2008 at 12:46 PM, djohnson29 [EMAIL PROTECTED] wrote:
 
Does anyone know how to trigger a validator on a TextInput based
on a
  certain string value?
 
  I have a regular TextInput with a regular Validator attached to it
  (required Validation). I would like to also trigger this Validator so
  that the red outline and tooltip displays when there is a particular
  value in the text property.
 
  So if the TextInput is empty, then the required validation kicks in,
  and if the text property contains for example, foo, then then the
  Validator fires as well.
 
  Is there a quick and easy way to do this without overridding the
  Validator?
 
   
 





[flexcoders] Re: Passing URLVariables from 1 Flex App to another?

2008-09-22 Thread djohnson29
Thanks for your suggestions.  The reason I want Login to be a separate
application is because I am using Spring Security to secure the app. 
Therefore, Login.mxml I want to be accessible to everyone, but in
order to access Main.mxml the user will have to have the required
Spring Security ROLE to be able to access it.

I was able to get this to work but not by passing the logged in values
to the 2nd app.  Instead, upon a successful login I load Main.mxml and
in the 2nd app's creationComplete event I use an HTTP service to call
a java delegate class which talks to Spring Security directly and
fetches the login info again.



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

 I have 2 Flex Applications, Login.mxml and Main.mxml.  Login.mxml
 handles the use Login and upon a successful authentication (with
 Spring Security), I want to load Main.mxml (Main.html which contains
 Main.swf)
 
 After a successfully logging in with spring security, from Login.mxml
 I load the main app like so:
 
 
 var url:URLRequest = new URLRequest(Main.html);
 var uv:URLVariables = new URLVariables();
 url.method = POST;
 uv.UserName = username;  // string var   
 navigateToURL(url,_self);
 
 Main.html (containing Main.swf) loads successfully, but I am unable to
 extract the desired parameters.  I want to pass the logged in user
 info from Login to Main.
 
 How do I access these URLVariables from the newly loaded Application?
 
 What is the best (simplest!) way to do this?
 
 Thanks





[flexcoders] Passing URLVariables from 1 Flex App to another?

2008-09-19 Thread djohnson29
I have 2 Flex Applications, Login.mxml and Main.mxml.  Login.mxml
handles the use Login and upon a successful authentication (with
Spring Security), I want to load Main.mxml (Main.html which contains
Main.swf)

After a successfully logging in with spring security, from Login.mxml
I load the main app like so:


var url:URLRequest = new URLRequest(Main.html);
var uv:URLVariables = new URLVariables();
url.method = POST;
uv.UserName = username;  // string var 
navigateToURL(url,_self);

Main.html (containing Main.swf) loads successfully, but I am unable to
extract the desired parameters.  I want to pass the logged in user
info from Login to Main.

How do I access these URLVariables from the newly loaded Application?

What is the best (simplest!) way to do this?

Thanks 






[flexcoders] TabNavigator - how to make label a hyperlink that loads a specific module

2008-08-14 Thread djohnson29

I have a regular TabNavigator like so:

mx:TabNavigator id=mainTabNav  
 mx:VBox id=tab1 label=First Tab
  mx:ModuleLoader id=ml1 url=modules/FirstPage.swf/
 /mx:VBox

 // more tabs go here

/mx:TabNavigator


Within each tab, at various times in the program, I change the url of
the moduleLoader to load a new module within this container.  When I
navigate to another tab, and then go back to this tab, the last loaded
module is displaying.

I would like to have the functionality so that the Label of the Tab is
a hyperlink - that would always load the top-level module.  In other
words, the tab label will always load a specific module.

How can I make this a hyperlink or a LinkButton when the label
property is actually part of the VBox? Not sure how to do this

Thanks

 




[flexcoders] Re: TextArea - changing backgroundColor on MouseOver when used in an ItemRenderer

2008-07-21 Thread djohnson29
Thanks for the reply Alex - Most of the examples I see are using the
DataGrid and working with the DataGridItemRenderer.  Do you have any
specific examples using ListItemRenderer and a List?  I have been
googling modifying ListItemRenderer but can't seem to see any
examples.  The only examples I can seem to find with List use the
mx:itemRenderer tag with child components laid out in the same way
that I have in my code.

It's not clear to me what exactly I would need to modify in
ListItemRenderer.  And if the ListItemRenderer uses TextFields which
are more efficient, how would I specify these in the mxml?  Also, how
would I be able to specify the Image that I need?  Currently the mxml
looks like this:
mx:itemRenderer 
mx:Component
 mx:Label ...
 mx:Image ...
 etc...

I am fairly inexperienced with modifying / overriding existing Flex
components so I apologize if these questions seem a bit redundant.  

Thanks



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

 I'd copy and modify the code from ListItemRenderer and not use
 Canvas/Label/TextArea.  It uses textFields which you can more easily
 control backgrounds and your renderer will be much smaller and faster.
 You can see some of the ways I do this on my blog
 (blogs.adobe.com/aharui).
 
  
 
 
 
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of djohnson29
 Sent: Friday, July 18, 2008 1:06 PM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Re: TextArea - changing backgroundColor on
 MouseOver when used in an ItemRenderer
 
  
 
 Arghgh...sorry folks - posted my question before finishing it...
 
 My question is: How can I change the backgroundColor of a TextArea
 that is used within an itemRenderer when the MouseOver event fires?
 
 I have the following code:
 
 mx:List id=lstPeople dataProvider={people.person} 
 width=250 height=160 
 mx:itemRenderer 
 mx:Component
 mx:Canvas width=240 height=75 
 mx:Label left=50 top=3 text={data.Name}/
 mx:TextArea id=taAddress left=50 top=21
 text={data.Address} editable=false 
 borderStyle=none / 
 mx:Image source=assets/person.png left=10 top=3/
 /mx:Canvas 
 /mx:Component 
 /mx:itemRenderer 
 /mx:List
 
 When the user hovers the mouse over the List, the default behaviour is
 to highlight the background color of each cell in the List. Since I
 am using a TextArea, the background of this particular control stays
 white and stands out.
 
 The TextArea component has a backgroundColor property and a MouseOver
 event, so I figured that I could call an function from within the
 MouseOver event to set the TextArea's background color.
 
 I have been unsuccessful - I can't get a reference to the textArea,
 even though it has an ID, and if I try to call the function inline
 from the mouseOver event in the TextArea's mxml, I get a compiler area.
 
 Thanks.





[flexcoders] TextArea - changing backgroundColor on MouseOver when used in an ItemRenderer

2008-07-18 Thread djohnson29


mx:List id=lstVendors dataProvider={people.person} 
  width=250 height=160
change=handleVendorListChange(event) 
mx:itemRenderer 
mx:Component
mx:Canvas width=240 
height=75 
mx:Script

![CDATA[

import mx.controls.Alert;
]]
/mx:Script
mx:Label 
left=50 top=3 text={data.VendorName}/
mx:TextArea 
id=taAddress left=50 top=21
text={data.Address} editable=false borderStyle=none   / !--
{this.backgroundColor='#B1E0FE'} --
mx:Image 
source=assets/vendor.png left=10 top=3/
/mx:Canvas
/mx:Component 
/mx:itemRenderer  
/mx:List



[flexcoders] Re: TextArea - changing backgroundColor on MouseOver when used in an ItemRenderer

2008-07-18 Thread djohnson29
Arghgh...sorry folks - posted my question before finishing it...

My question is:  How can I change the backgroundColor of a TextArea
that is used within an itemRenderer when the MouseOver event fires?

I have the following code:


mx:List id=lstPeople dataProvider={people.person} 
   width=250 height=160 
mx:itemRenderer 
mx:Component
   mx:Canvas width=240 height=75
mx:Label left=50 top=3 text={data.Name}/
mx:TextArea id=taAddress left=50 top=21
 text={data.Address} editable=false 
 borderStyle=none   /
mx:Image source=assets/person.png left=10 top=3/
   /mx:Canvas 
   /mx:Component  
   /mx:itemRenderer   
/mx:List

When the user hovers the mouse over the List, the default behaviour is
to highlight the background color of each cell in the List.  Since I
am using a TextArea, the background of this particular control stays
white and stands out.

The TextArea component has a backgroundColor property and a MouseOver
event, so I figured that I could call an function from within the
MouseOver event to set the TextArea's background color.

I have been unsuccessful - I can't get a reference to the textArea,
even though it has an ID, and if I try to call the function inline
from the mouseOver event in the TextArea's mxml, I get a compiler area.

Thanks.




[flexcoders] Re: Cancelling a list change event using an Alert popup

2008-07-15 Thread djohnson29
Thanks - I will check that out.

I managed to work around this problem by saving the old index in a
class-wide variable and then just programmatically setting the list
index back to the old index if the user hit the cancel button.



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

 Hi,
 
 I don't know if this solve your problem but I've posted something here

(http://miti.pricope.com/2008/07/09/datagrid-canceling-a-grid-change-event-using-an-alert-popup/)
 regarding this.
 
 Miti
 
 --- In flexcoders@yahoogroups.com, djohnson29 djohnson29@ wrote:
 
  I have a list of items and a corresponding form to edit values based
  on what the user has selected.
  
  If the user selects another by clicking the grid, I want to provide an
  Alert popup if they have not saved their changes.  If the user clicks
  OK, then the selection takes place as normal, but if they click
  cancel, I want to cancel the change event and have the editor stay on
  the selected item.
  
  I can get the event to cancel by declaring an event handler for
  MouseDown in the creationComplete event, and then having the following
  lines in the MouseDown handler:
  
  event.stopImmediatePropagation();
  event.stopPropagation();
  event.preventDefault();
  
  The problem is that I can only successfully cancel the event
  propogation from within this method.
  
  If I want to have an alert box with an OK and Cancel button, how do I
  achieve this?
  
  I have tried calling an Alert handler and using a class event variable
  to store the event that is received by the MouseDown handler, but
  if I try to cancel the event from within the Alert handler, nothing
  happens - I think it is too late at that point.
  
  Can someone provide me with an example of how to cancel event
  propogation on a grid click or other similar event based on the user's
  selection from an Alert prompt?
  
  Thanks!
 





[flexcoders] Cancelling a list change event using an Alert popup

2008-07-07 Thread djohnson29
I have a list of items and a corresponding form to edit values based
on what the user has selected.

If the user selects another by clicking the grid, I want to provide an
Alert popup if they have not saved their changes.  If the user clicks
OK, then the selection takes place as normal, but if they click
cancel, I want to cancel the change event and have the editor stay on
the selected item.

I can get the event to cancel by declaring an event handler for
MouseDown in the creationComplete event, and then having the following
lines in the MouseDown handler:

event.stopImmediatePropagation();
event.stopPropagation();
event.preventDefault();

The problem is that I can only successfully cancel the event
propogation from within this method.

If I want to have an alert box with an OK and Cancel button, how do I
achieve this?

I have tried calling an Alert handler and using a class event variable
to store the event that is received by the MouseDown handler, but
if I try to cancel the event from within the Alert handler, nothing
happens - I think it is too late at that point.

Can someone provide me with an example of how to cancel event
propogation on a grid click or other similar event based on the user's
selection from an Alert prompt?

Thanks!



[flexcoders] Alert.show - how to pass extra parameter to Alert event handler?

2008-06-09 Thread djohnson29
I have an alert popup with your basic ok / cancel functionality.  The
alert calls an event handler which receives a close event as a
parameter like so:

Alert.show(You have unsaved changed. Continue?  ,My popup,
Alert.OK | Alert.CANCEL, this, cancelEventHandler);

private function cancelEventHandler(event:CloseEvent):void{

  if(event.detail == Alert.OK){
// do whatever you need to do here. 
  }
  else{
 // cancel
  }


I want to be able to pass an additional parameter to the cancel event
handler.  Is there a way to do this?  

For example if I prompt the user to save changes, I may want to pass
in an ID value.





[flexcoders] taking xml var and splitting into 2 xml lists - flex bug?

2008-05-30 Thread djohnson29
I have noticed some weird behaviour when working with XML vars and
XMLListCollections.

I have an xml variable that I am looping through using a for each
loop.  I want to separate the xml into 2 seperate lists based on a
value so as I loop through, I am adding each xml node to 2 different
XmlListCollections.

Here is my code:

// myXML is an xml var declared elsewhere in the program
var xlc1:XMLListCollection = new XMLListCollection();
var xlc2:XMLListCollection = new XMLListCollection();

for each(var x:XML in myXML.MyNode){

if(x.NodeStatus == 0) 
xlc1.addItem(x);
   else if(x.NodeStatus == 1)
xlc2.addItem(x);

The problem is that the original xml var is getting modified.

Say for example that my original myXML variable contains 10 nodes, and
there are 7 nodes that have a NodeStatus of 0 and 3 nodes that have a
NodeStatus of 1.  My 2 XMLListCollection vars contain 7, and 3 nodes
respectively as would be expected.

However, the original myXML var now contains 9 extra nodes!  19 nodes
in total.  Flex somehow is adding all these nodes back onto the
original xml var except for 1 node from each of the categories.  So in
other words, the original XML var contains all the newly added nodes
minus 2.

Is this a bug in Flex? Shouldn't the XMLListCollection just contain
pointers back to the original XML var?











apXLC.addItem(x);
else if(x.ProjectStatus == 
ProjectStatus.PROPOSED)
ppXLC.addItem(x);
}



[flexcoders] Re: converting xml string containing special characters back to regular xml

2008-05-30 Thread djohnson29
Thanks - actually I was able to convert those back like this.  The
.toXMLString method didn't work - but the basic .toString() did.

var x:XML = event.result as XML;
var s:String = x.XmlData.toString();
var formattedXML = new XML(s);


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

 What is doing that encoding?  Trace the data flow to fnd out.
 
  
 
 When saving XML strings, I usually encode them using escape() before
 sending, then unencode using unescape() after retreiving.  This way I
 can do:
 
 var x:XML = XML(myStringXML); //OMIT the new. XML is a function, not a
 class
 
  
 
 Tracy
 
 
 
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of djohnson29
 Sent: Thursday, May 29, 2008 6:12 PM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] converting xml string containing special
 characters back to regular xml
 
  
 
 I have an xml variable that I need to store in my database as a
 string. So I've called .toXMLString() on the variable to turn it into
 a string and it's saved in the db. 
 
 Now when it comes to loading that stored value back into a string
 variable , when I see the string representation of the xml it contains
 symbols instead of the angle brackets like so:
 
 lt;MyNodegt;
 lt;/MyNodegt;
 
 
 How do I convert this back to XML?
 
 I would like to so something like this:
 
 var x:XML = new XML(myStringXML);
 
 but this does not correctly format the xml or convert the angled
 brackets.
 
 Can someone please point me in the right direction?
 
 Thanks!





[flexcoders] converting xml string containing special characters back to regular xml

2008-05-29 Thread djohnson29
I have an xml variable that I need to store in my database as a
string.  So I've called .toXMLString() on the variable to turn it into
a string and it's saved in the db. 

Now when it comes to loading that stored value back into a string
variable , when I see the string representation of the xml it contains
 symbols instead of the angle brackets like so:

lt;MyNodegt;
lt;/MyNodegt;
  

How do I convert this back to XML?

I would like to so something like this:

var x:XML = new XML(myStringXML);

but this does not correctly format the xml or convert the angled brackets.

Can someone please point me in the right direction?

Thanks!



[flexcoders] Slide out panel with 90 degree text on the border

2008-05-22 Thread djohnson29
I have an application that uses a slideout panel.  A small portion of
the panel's left border is displayed off the right hand side of the
screen and when the user clicks on this border the full panel slides
out from right to left to fill the screen.

I would like to have text displayed on the panel's left border -
ideally the text would be vertically oriented as well so that
something like Click here could be displayed vertically in that
piece of protruding left border.

Is it possible to achieve this effect with the panel control?  How do
I vertically align text on a panel border?

Thanks





[flexcoders] Re: Working with modules

2008-05-12 Thread djohnson29
Hi Nate,

That's correct.  Just create each module as an application to start 
with.  Set it as the default application so you can run / debug.  
Once it's all working, just change the root tag.  

I'm working on an application that uses modules and that's how I 
develop each new module. 

cheers



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

 I'm building an application with multiple modules.  Each module is a
 different project in flex builder.  I have a main application 
project
 that each module compiles a swf to.
 
 I want to be able to run each module by it's self to develop/debug 
it.
  I can't figure out how to do this.
 
 My module projects start out as mx:application but when I change 
it
 to mx:module I can't run it and get any output (even though it has
 that green arrow).  
 
 Maybe I just answered my own question, should I just leave it as
 mx:application until I'm done developing then switch it to a 
module?
 
 Thanks so much for the help,
 
 Nate





[flexcoders] Re: Flexbuilder or Eclipse plugin to emulate VisualStudio function drop down?

2008-04-30 Thread djohnson29
Thanks very much - that is a great feature that I was unaware of.  That 
should speed things up nicely!


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

 You can press Ctrl + o (thats o as in ox) and it will give you a
 little popup that lets you type and filter variables and functions...
 you might like that...
 
 http://axelscript.com
 Axel Jensen





[flexcoders] Flexbuilder or Eclipse plugin to emulate VisualStudio function drop down?

2008-04-29 Thread djohnson29
Just wondering if anyone knows of, or could recommend a plugin for 
Flexbuilder or Eclipse that would allow you to select your function 
from a drop down combobox and jump to the corresponding function just 
like in Visual Studio?

I have quite a few functions in my script block and I'm constantly 
scrolling up and down to find stuff.  That feature would be nice!

Thanks





[flexcoders] DataGrid embedding image with headerSeparatorSkin property

2008-04-17 Thread djohnson29

I am trying to hide the column divider in a datagrid header.

To do this, you can set an image as a skin using the 
headerSeparatorSkin property.  


mx:DataGrid headerSeparatorSkin=@Embed('assets/transparent.png') 

I am getting a compile time error that says:

unable to resolve 'assets/transparent.png' for transcoding

The filename and path are all correct so I'm not sure why the compiler 
is complaining





[flexcoders] Re: DataGrid embedding image with headerSeparatorSkin property

2008-04-17 Thread djohnson29
Problem solved - it was a path problem - my images folder was under 
the flex_bin folder.  Of course, since we are embedding an image at 
compile time, the full path has to be specified, or else the images 
folder needs to be a subfolder underneath the src folder. 

This path works:
headerSeparatorSkin=@Embed('../flex_bin/assets/transparent.png')


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

 
 I am trying to hide the column divider in a datagrid header.
 
 To do this, you can set an image as a skin using the 
 headerSeparatorSkin property.  
 
 
 mx:DataGrid headerSeparatorSkin=@Embed('assets/transparent.png') 

 
 I am getting a compile time error that says:
 
 unable to resolve 'assets/transparent.png' for transcoding
 
 The filename and path are all correct so I'm not sure why the 
compiler 
 is complaining





[flexcoders] Flex application that saves to the local fiesystem using Adobe AIR

2008-04-04 Thread djohnson29
Are there any good examples of this out there that someone could share?

I want to have a Flex app that runs in the browser, but that has the 
ability to save text files to the local filesystem.  I realize that you 
need Adobe AIR to do this.  I am wondering the best approach - how to 
get Flex to talk to AIR and allow this functionality (without showing 
the AIR app to the user.