Re: [flexcoders] Event Dispatching through more than one component

2007-03-20 Thread Jon Hirschi
It doesn't happen automatically.  You need to set this up, but it's not hard to 
do.  the thing about popups is that they act essentially like their own 
application.  so they don't normally pass events outside of the popup window.  
events originate and terminate with the popup. 

so for example,  if you have 

parent application
|
popup #1
|
popup #2

dispatch the event in popup #2 and listen for it in popup #1.

in popup #2 you would do a dispatchEvent(new Event(myCustomEventPopUp2))
and in popup #1 in the same location that you generate/ create popup#2 you 
would put an event listener on popup #2.
   ie:  popupObj.addEventListener(myCustomEventPopUp2,myPopUp2Function)

then in your function:

function myPopUp2Function(event){
dispatchEvent(event)
}
Then in your parent app, you would put in the same kind of listener as you had 
in the first popup:
 ie:  popupObj.addEventListener(myCustomEventPopUp2,myPopUp2Function)

It's a little round about, but it  will get the job done.  unfortunately, flex 
doesn't handle this sort of event handling.

Hope that helps.

Jon Hirschi


- Original Message 
From: qnotemedia [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Tuesday, March 20, 2007 1:21:29 PM
Subject: [flexcoders] Event Dispatching through more than one component

I'm still messing around with custom events.

If I have a popup embedded within another popup and want to dispatch an 
event from the top-most component down to the parent application, do I 
have to dispatch it to the first popup, and then redispatch the same 
event to the parent app?

Is there any way to dispatch an event, but have it automatically go 
through all components down to the root? Obviously I've tried, but 
events seems to stop at the parent component, and they are not 
automatically delivered to their parent's parent, etc.

What I'm thinking of doing instead is having each popup send a message 
to the root to open other embedded popups, so that they are ALL created 
from the root application rather than the popup. In essence, a custom 
popup manager.

But I'm still curious if there's a way around the above scenario.

Thanks,
- Chris





 

Don't pick lemons.
See all the new 2007 cars at Yahoo! Autos.
http://autos.yahoo.com/new_cars.html 

RE: [flexcoders] how do you dispatch event from a custom class?

2006-06-23 Thread Jon Hirschi

Hi Paul,

So I'm putting my event listener in the application
core.  What I would like is for this event to enter
the event stream and bubble up to the application
core.  Currently, it doesn't look like it even makes
it out of the document that I'm in.  I'm not even sure
that it gets populated outside of the class itself.

What i'd really like is to have this event entered
automatically into the event stream with out having to
have an event repeater.

--- Paul Williams [EMAIL PROTECTED] wrote:

 Hi Jon,
 
 Sprite extends EventDispatcher, so you don't need to
 instantiate another
 EventDispatcher in your class.
 
 Instead, try the following:
 
 this.dispatchEvent(new
 Event(AuthenticationFailed,true,false));
 
 If you still have problems can you let us know what
 object you are
 creating your event listener on?
 
 Paul
 
 -Original Message-
 From: flexcoders@yahoogroups.com
 [mailto:[EMAIL PROTECTED] On
 Behalf Of Jon Hirschi
 Sent: Thursday, June 22, 2006 9:45 PM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] how do you dispatch event from
 a custom class?
 
 
 I have a custom class that I want to be able to
 dispatch an event. However, it's not entering the
 event into the event stream, I don't even think the
 event is getting out of the class.  I have bubbles
 set
 to true.  does anyone know how to get the event
 entered into the event stream... the docs aren't
 very
 explicit on this subject
 
 ie
 
 code to call my class...
 
 private function
 handleLBResponse(eventObj:ResultEvent):void  {
   var tempArray:Array;
   var checkResult:WebServiceCheck = new
 WebServiceCheck();
   if

(checkResult.checkServiceReturnStatus(eventObj,true))
 
 {
   tempArray =

mx.utils.ArrayUtil.toArray(eventObj.result.lbvServerTos);
   if (tempArray.length  1)  {
   dpLBVServerData.source =
 tempArray;
   } else  {
   
 dpLBVServerData.removeAll();
   }
   } else {
   dpLBVServerData.removeAll();
   }
   
   }
 
 
 
 
 --
 code in the class
 
 ---
 
 package comp.webconfig.services   {
   
   import flash.display.Sprite;
   import mx.rpc.events.ResultEvent;
   import mx.controls.Alert;
   import flash.events.Event;
   import flash.events.EventDispatcher;
   
   public class WebServiceCheck extends Sprite {
   
   
   
   public var isSuccess:Boolean;
   public var statusType:String;
   public var message:String;
   public var rawMessage:String;
   
   public function WebServiceCheck()  {
   
   }
   
public function

checkServiceReturnStatus(resultToCheck:ResultEvent,alertOnError:Boolean=
 false):Boolean
 {
   var myMessage:String;
   var isSuccess:Boolean = true;
   var myRawMessage:String;
   var myRawStatus:String;
   var dispatcher:EventDispatcher = new
 EventDispatcher();
   if (resultToCheck.result != null)  {
   if (resultToCheck.result.requestMessage
 != null) 
 {
   myRawMessage =
 resultToCheck.result.requestMessage;
   }
   if (resultToCheck.result.requestStatus)
 {
   myRawStatus =
 resultToCheck.result.requestStatus;
   }
   }
   if (myRawStatus != null) {
   switch (myRawStatus) {
   case Failed :
   // do something here
 like popup a message
   myMessage = Sorry,
 there was an error trying to
 access the information you requested. \n\n
   myMessage +=
 myRawMessage;
   isSuccess = false;
   break;
   case Unauthorized :
   // do something here...
 like popup a message
   myMessage = Sorry, you
 were not authorized to
 access the information you requested. \n\n
   myMessage +=
 myRawMessage

Re: [flexcoders] how do you dispatch event from a custom class?

2006-06-23 Thread Jon Hirschi
is there anyway to enter an event into the event
stream without a class being a display object?   ie,
not having it in the display list?

--- Ralf Bokelberg [EMAIL PROTECTED] wrote:

 Either by instantiating it in mxml or explicitely by
 adding it using
 container.addChild.
 Cheers,
 Ralf.
 
 On 6/24/06, Jon Hirschi [EMAIL PROTECTED]
 wrote:
 
  I tried what you said and attempted to have the
  WebServiceCheck itself dispatch the event,
 however, it
  doesn't dispatch anything into the event stream,
 even
  attaching an event listener to the variable return
  variable doesn't do anything.
 
  How do I make it part of a displaylist??
 
  --- Ralf Bokelberg [EMAIL PROTECTED]
 wrote:
 
   Hello Paul
  
   In your code you are creating a separate
   EventDispatcher, which is not
   part of any displaylist. If you let your
   WebServiceCheck dispatch the
   event instead, it should work. At least as long
 as
   it is part of a
   displaylist.
  
   Cheers,
   Ralf.
  
   On 6/23/06, Jon Hirschi [EMAIL PROTECTED]
   wrote:
   
Hi Paul,
   
So I'm putting my event listener in the
   application
core.  What I would like is for this event to
   enter
the event stream and bubble up to the
 application
core.  Currently, it doesn't look like it even
   makes
it out of the document that I'm in.  I'm not
 even
   sure
that it gets populated outside of the class
   itself.
   
What i'd really like is to have this event
 entered
automatically into the event stream with out
   having to
have an event repeater.
   
--- Paul Williams [EMAIL PROTECTED] wrote:
   
 Hi Jon,

 Sprite extends EventDispatcher, so you don't
   need to
 instantiate another
 EventDispatcher in your class.

 Instead, try the following:

 this.dispatchEvent(new
 Event(AuthenticationFailed,true,false));

 If you still have problems can you let us
 know
   what
 object you are
 creating your event listener on?

 Paul

 -Original Message-
 From: flexcoders@yahoogroups.com
 [mailto:[EMAIL PROTECTED] On
 Behalf Of Jon Hirschi
 Sent: Thursday, June 22, 2006 9:45 PM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] how do you dispatch
 event
   from
 a custom class?


 I have a custom class that I want to be able
 to
 dispatch an event. However, it's not
 entering
   the
 event into the event stream, I don't even
 think
   the
 event is getting out of the class.  I have
   bubbles
 set
 to true.  does anyone know how to get the
 event
 entered into the event stream... the docs
 aren't
 very
 explicit on this subject

 ie

 code to call my class...

 private function
 handleLBResponse(eventObj:ResultEvent):void 
 {
   var
   tempArray:Array;
   var
   checkResult:WebServiceCheck = new
 WebServiceCheck();
   if

   
  
 

(checkResult.checkServiceReturnStatus(eventObj,true))

 {
  
 tempArray
   =

   
  
 

mx.utils.ArrayUtil.toArray(eventObj.result.lbvServerTos);
   if
   (tempArray.length  1)  {

   dpLBVServerData.source =
 tempArray;
   } else
  {

 dpLBVServerData.removeAll();
   }
   } else {

   dpLBVServerData.removeAll();
   }

   }




 --
 code in the class

 ---

 package comp.webconfig.services   {

   import flash.display.Sprite;
   import mx.rpc.events.ResultEvent;
   import mx.controls.Alert;
   import flash.events.Event;
   import flash.events.EventDispatcher;

   public class WebServiceCheck extends
   Sprite {



   public var isSuccess:Boolean;
   public var statusType:String;
   public var message:String;
   public var rawMessage:String;

   public function
 WebServiceCheck()
   {

   }

public function

   
  
 

checkServiceReturnStatus(resultToCheck:ResultEvent,alertOnError:Boolean=
 false):Boolean
 {
   var myMessage:String;
   var isSuccess:Boolean
 =
 
=== message truncated ===


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


 Yahoo! Groups Sponsor ~-- 
Great things are happening at Yahoo! Groups.  See

[flexcoders] how do you dispatch event from a custom class?

2006-06-22 Thread Jon Hirschi

I have a custom class that I want to be able to
dispatch an event. However, it's not entering the
event into the event stream, I don't even think the
event is getting out of the class.  I have bubbles set
to true.  does anyone know how to get the event
entered into the event stream... the docs aren't very
explicit on this subject

ie

code to call my class...

private function
handleLBResponse(eventObj:ResultEvent):void  {
var tempArray:Array;
var checkResult:WebServiceCheck = new
WebServiceCheck();
if
(checkResult.checkServiceReturnStatus(eventObj,true)) 
{
tempArray =
mx.utils.ArrayUtil.toArray(eventObj.result.lbvServerTos);
if (tempArray.length  1)  {
dpLBVServerData.source = 
tempArray; 
} else  {
dpLBVServerData.removeAll();
}
} else {
dpLBVServerData.removeAll();
}

}




--
code in the class

---

package comp.webconfig.services {

import flash.display.Sprite;
import mx.rpc.events.ResultEvent;
import mx.controls.Alert;
import flash.events.Event;
import flash.events.EventDispatcher;

public class WebServiceCheck extends Sprite {



public var isSuccess:Boolean;
public var statusType:String;
public var message:String;
public var rawMessage:String;

public function WebServiceCheck()  {

}

 public function
checkServiceReturnStatus(resultToCheck:ResultEvent,alertOnError:Boolean=false):Boolean
{
var myMessage:String;
var isSuccess:Boolean = true;
var myRawMessage:String;
var myRawStatus:String;
var dispatcher:EventDispatcher = new
EventDispatcher();
if (resultToCheck.result != null)  {
if (resultToCheck.result.requestMessage != 
null) 
{
myRawMessage =
resultToCheck.result.requestMessage;
}
if (resultToCheck.result.requestStatus)   {
myRawStatus =
resultToCheck.result.requestStatus;
}
}
if (myRawStatus != null) {
switch (myRawStatus) {
case Failed :
// do something here like popup 
a message
myMessage = Sorry, there was 
an error trying to
access the information you requested. \n\n
myMessage += myRawMessage;
isSuccess = false;
break;
case Unauthorized :
// do something here... like 
popup a message
myMessage = Sorry, you were 
not authorized to
access the information you requested. \n\n
myMessage += myRawMessage;
isSuccess = false;
break;
case AuthenticationFailed :
dispatcher.dispatchEvent(new
Event(AuthenticationFailed,true,false));
myMessage = Sorry, you are 
either not Logged
in, or you have been logged out. \n\n
myMessage += myRawMessage;
isSuccess = false;
trace(this person is 
unauthorized);
break;
default :
// do nothing because they 
should be fine here.
// this should be a success
myMessage = Results returned 
successfully;

[flexcoders] Why does a java Long get converted to ComplexString??

2006-06-17 Thread Jon Hirschi
Anybody know why a java long gets converted to a
ComplexString??

--- biggermork [EMAIL PROTECTED] wrote:

 
 hey, according to the docs, a long in java should
 map over to a number
 in actionscript/flex (using web service with soap) 
 That doesn't seem
 to be happening with my app however. Where i should
 be getting a long,
 i seem to be getting a ComplexString type which
 essentially has the
 xml stored in it.  Trying to display it in a graph
 seems to work out
 pretty well, but when trying to do anything with it,
 there seem to be
 issues.   any body have any idea why it's not
 getting converted properly?
 
 ie from the soap:
 
   multiRef id=id16 soapenc:root=0

soapenv:encodingStyle=http://schemas.xmlsoap.org/soap/encoding/;

xmlns:soapenc=http://schemas.xmlsoap.org/soap/encoding/;
 xsi:type=xsd:long60/multiRef
 
 and what it gets translated as is:
 
 csvServerId = mx.rpc.xml.ComplexString (@4588219)
   id = id106
   soapenc:root = 60
   soapenv:encodingStyle =
 http://schemas.xmlsoap.org/soap/encoding/;
   value = 60
   xmlns:soapenc =
 http://schemas.xmlsoap.org/soap/encoding/;
   xsi:type = xsd:long
 
 anybody know what's going on and/or how to get flex
 to recognize this
 as a number?
 
 thanks!
 
 
 
 
 
 


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


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

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 





[flexcoders] How do i check the old value against a new value in an itemeditor?

2006-06-01 Thread Jon Hirschi



I'm writing a custom itemEditor (text input) and I
want to check the Old value vs the new value that's
entered. if the new value isn't an integer, i want to
revert to the old value (which should be an integer)

anybody know how to do this?

most notably, it doesn't like this:
this.listData.dataField

what i've gotten so far hasn't worked very well. :(

?xml version=1.0 encoding=utf-8?
mx:TextInput
xmlns:mx=http://www.adobe.com/2006/mxml
valueCommit=handleCommitValue(event)   
 
 mx:Metadata
 [Event(name=CommittedValue,
type=flash.events.Event)]
 /mx:Metadata
 
 mx:Script
  ![CDATA[
   import flash.events.Event;
   
   private var oldValue:String = new String();
   
   override public function set
data(value:Object):void {
if (value != null) {
 super.data = "">
}
   }
   
   private function
handleCommitValue(eventObj:Event):void {
if (super.data.valueOf(this.listData.dataField) !=
this.text) {
 if ((parseInt(this.text) != NaN) 
(parseInt(this.text).toString() == this.text)) {
  super.data[this.listData.dataField] = this.text;
  dispatchEvent(new Event(CommittedValue,true));
 } else {
  this.text =
super.data.valueOf(this.listData.dataField);
 }
}
   }
  ]]
 /mx:Script
/mx:TextInput

thanks for the help!


__
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  











Re: [flexcoders] ActionScript setting width to 100%

2006-06-01 Thread Jon Hirschi



myButton.percentWidth = 100;

works pretty well.

--- shravan kumar [EMAIL PROTECTED] wrote:

 Hi,
 
 How to set a button width to 100% while creating
 it in an .as file. 
 
 Following is the code I have used:- 
 
 var myCanvas=createClassObject(Canvas,
 canvas1, this.getNextHighestDepth());
 var myButton=myCanvas.createClassObject(Button,
 button1, myCanvas.getNextHighestDepth());
 myButton.width = 100%;
 
 
 Thanks  Regards
 Shravan Kumar S
 
   
 -
 Feel free to call! Free PC-to-PC calls. Low rates on
 PC-to-Phone. Get Yahoo! Messenger with Voice


__
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  











[flexcoders] is a header renderer supposed to remember it's state?

2006-05-31 Thread Jon Hirschi




So I've been messing around with a DataGrid
headerRenderer, trying to use a check box to
select/unselect a bunch of other check boxes in a
data grid. What I'm running into is that if I send
out an itemUpdated event or if I update the
dataProvider in such a way that it fires off
the itemUpdated event (or whatever event it is) it
invalidates the header. What I'm running into is that
it seems like I can't get the header to remember it's
current state if I change it. It always reverts
back to the primitive state upon an update event from
the dataGrid. If you click on the checkbox in the
header, you'll see what I mean. it should check all
boxes in the datagrid column and remain clicked,
however it doesn't. clicking on the column header
will check all of the column boxes, but the column
header remains unchecked - even though it is
specifically set to checked.

Am I doing something wrong here? Anybody know how to
get around the problem? Is this not supported? 

test swiff is located here:
a
href="" href="http://www.wokits.com/code_samples/checkBoxTest/testHeaderCheckBox.html">http://www.wokits.com/code_samples/checkBoxTest/testHeaderCheckBox.htmlhttp://www.wokits.com/code_samples/checkBoxTest/testHeaderCheckBox.html/a

code is located here:

a
href="" href="http://www.wokits.com/code_samples/checkBoxTest/testHeaderCheckBox.zip">http://www.wokits.com/code_samples/checkBoxTest/testHeaderCheckBox.ziphttp://www.wokits.com/code_samples/checkBoxTest/testHeaderCheckBox.zip/a

Appreciate the help.

Jon Hirschi
Knowledge Management


__
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.