Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Custom Event Problems
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Brad Cedergren  
View profile  
 More options Oct 29, 3:51 pm
From: Brad Cedergren <b_cederg...@hotmail.com>
Date: Thu, 29 Oct 2009 14:51:39 -0500
Local: Thurs, Oct 29 2009 3:51 pm
Subject: Custom Event Problems

I have a form as a custom component with four text fields and two check boxes that I need to have the information sent to the main application. I have created a custom event to be able to dispatch the text from the text fields and display in an Alert box. For some reason it is not sending the text over but the event is being dispatched.

The code is listed below:

main.mxml:

<mx:Script>
   <![CDATA[
      import mx.controls.Alert;
      import events.FormEvent;

   [Bindable]
    private var firstNameInput:String = new String;
    private var lastNameInput:String = new String;
    private var emailAddressInput:String = new String;
    private var stateInput:String = new String;
    private var countryInput:String = new String;
    private var newsletterCheck:Boolean = new Boolean;
    private var surveysCheck:Boolean = new Boolean;

    private function formSubmitHandler(event:FormEvent):void {
    firstNameInput = event.firstNameInput;
    lastNameInput = event.lastNameInput;
    emailAddressInput = event.emailAddressInput;

    Alert.show(firstNameInput);
    }
    ]]>
   </mx:Script>

  <com:form horizontalCenter="0" verticalCenter="0" id="form1" formSubmit="formSubmitHandler(event)"/>

form.mxml:

<mx:Metadata>
    [Event(name="formSubmit", type="events.FormEvent")]
</mx:Metadata>

<mx:Script>
   <![CDATA[
    import mx.rpc.events.AbstractEvent;
    import events.FormEvent;
    import mx.controls.Alert;

   // Create variables for form fields
    [Bindable]
     public var firstNameInput:String;
     public var lastNameInput:String;
     public var emailAddressInput:String;
     public var stateInput:String;
     public var countryInput:String;
     public var newsletterCheck:Boolean;
     public var surveysCheck:Boolean;

    // Function to handle the form submissions
    private function submitForm():void {
    //customEventHandler(event);
    }

    private function dispatchEventHandler(event:FormEvent):void {
    var formObj:FormEvent = new FormEvent(firstNameInput, lastNameInput, emailAddressInput);
    formObj.firstNameInput = firstname.text;
    formObj.lastNameInput = lastname.text;
    formObj.emailAddressInput = email.text;
    dispatchEvent(formObj);
    }

]]>
</mx:Script>

<mx:VBox id="Panel">
<mx:Form>
   <mx:HBox width="100%">
      <mx:FormItem required="true" label="First Name">
         <mx:TextInput id="firstname"/>
      </mx:FormItem>
      <mx:FormItem required="true" label="Last Name">
         <mx:TextInput id="lastname"/>
      </mx:FormItem>
   </mx:HBox>
   <mx:HBox width="100%">
      <mx:FormItem label="Email" required="true">
         <mx:TextInput id="email" />
      </mx:FormItem>
      <mx:FormItem label="State">
         <mx:TextInput id="state"/>
      </mx:FormItem>
      <mx:FormItem label="Country">
         <mx:TextInput id="country"/>
      </mx:FormItem>
   </mx:HBox>
   <mx:HBox>
      <mx:FormItem label="" required="false">
         <mx:CheckBox id="enewsletter"/>

      </mx:FormItem>
   </mx:HBox>
   <mx:HBox width="100%">
      <mx:FormItem label="" required="false">
         <mx:CheckBox id="surveys" />
      </mx:FormItem>
   </mx:HBox>
</mx:Form>

<mx:Button label="Submit Details" click="submitForm()" id="submitButton"/>

</mx:VBox>

FormEvent.as:

package events
{
   import flash.events.Event;

   public class FormEvent extends Event
  {
      public var firstNameInput:String;
      public var lastNameInput:String;
      public var emailAddressInput:String;

      public function FormEvent(type:String, firstNameInput:String="", lastNameInput:String="",
emailAddressInput:String="")
{
      super(type);
      this.firstNameInput = firstNameInput;
      this.lastNameInput = lastNameInput;
      this.emailAddressInput = emailAddressInput;

}

      override public function clone():Event
   {
      return new FormEvent(type, firstNameInput, lastNameInput, emailAddressInput);
   }
 }

}

Brad Cedergren
http://www.bradcedergren.com

_________________________________________________________________
Windows 7: It works the way you want. Learn more.
http://www.microsoft.com/Windows/windows-7/default.aspx?ocid=PID24727...


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mike Fritts  
View profile  
 More options Oct 29, 5:10 pm
From: Mike Fritts <mike.app_develo...@yahoo.com>
Date: Thu, 29 Oct 2009 14:10:13 -0700 (PDT)
Local: Thurs, Oct 29 2009 5:10 pm
Subject: Re: Custom Event Problems
Where is the FormEvent instance created that is input to the method
dispatchEventHandler and where is this method invoked?

On Oct 29, 2:51 pm, Brad Cedergren <b_cederg...@hotmail.com> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ahti Hujanen  
View profile  
 More options Oct 29, 6:07 pm
From: Ahti Hujanen <ahuja...@yottaworks.com>
Date: Thu, 29 Oct 2009 17:07:35 -0500
Local: Thurs, Oct 29 2009 6:07 pm
Subject: Re: [mnswf] Custom Event Problems

Brad,

You might try changing the constructor parameter names for your FormEvent
constructor. They are the same name as the public properties on the class.

Ahti

On Thu, Oct 29, 2009 at 2:51 PM, Brad Cedergren <b_cederg...@hotmail.com>wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dustin Tauer  
View profile  
 More options Oct 29, 6:14 pm
From: "Dustin Tauer" <Dus...@easelsolutions.com>
Date: Thu, 29 Oct 2009 17:14:35 -0500
Local: Thurs, Oct 29 2009 6:14 pm
Subject: RE: [mnswf] Custom Event Problems

Looks like you're missing a parameter in your creation of you event
object (the type).   This line:

    var formObj:FormEvent = new FormEvent(firstNameInput, lastNameInput,
emailAddressInput);

should be:

    var formObj:FormEvent = new FormEvent("formSubmit", firstNameInput,
lastNameInput, emailAddressInput);

From: mnswf@googlegroups.com [mailto:mnswf@googlegroups.com] On Behalf
Of Brad Cedergren
Sent: Thursday, October 29, 2009 2:52 PM
To: mnswf@googlegroups.com
Subject: [mnswf] Custom Event Problems

I have a form as a custom component with four text fields and two check
boxes that I need to have the information sent to the main application.
I have created a custom event to be able to dispatch the text from the
text fields and display in an Alert box. For some reason it is not
sending the text over but the event is being dispatched.

The code is listed below:

main.mxml:

<mx:Script>

   <![CDATA[

      import mx.controls.Alert;

      import events.FormEvent;

   [Bindable]

    private var firstNameInput:String = new String;

    private var lastNameInput:String = new String;

    private var emailAddressInput:String = new String;

    private var stateInput:String = new String;

    private var countryInput:String = new String;

    private var newsletterCheck:Boolean = new Boolean;

    private var surveysCheck:Boolean = new Boolean;

    private function formSubmitHandler(event:FormEvent):void {

    firstNameInput = event.firstNameInput;

    lastNameInput = event.lastNameInput;

    emailAddressInput = event.emailAddressInput;

    Alert.show(firstNameInput);

    }

    ]]>

   </mx:Script>

  <com:form horizontalCenter="0" verticalCenter="0" id="form1"
formSubmit="formSubmitHandler(event)"/>

form.mxml:

<mx:Metadata>

    [Event(name="formSubmit", type="events.FormEvent")]

</mx:Metadata>

<mx:Script>

   <![CDATA[

    import mx.rpc.events.AbstractEvent;

    import events.FormEvent;

    import mx.controls.Alert;

   // Create variables for form fields

    [Bindable]

     public var firstNameInput:String;

     public var lastNameInput:String;

     public var emailAddressInput:String;

     public var stateInput:String;

     public var countryInput:String;

     public var newsletterCheck:Boolean;

     public var surveysCheck:Boolean;

    // Function to handle the form submissions

    private function submitForm():void {

    //customEventHandler(event);

    }

    private function dispatchEventHandler(event:FormEvent):void {

    var formObj:FormEvent = new FormEvent(firstNameInput, lastNameInput,
emailAddressInput);

    formObj.firstNameInput = firstname.text;

    formObj.lastNameInput = lastname.text;

    formObj.emailAddressInput = email.text;

    dispatchEvent(formObj);

    }

]]>

</mx:Script>

<mx:VBox id="Panel">

<mx:Form>

   <mx:HBox width="100%">

      <mx:FormItem required="true" label="First Name">

         <mx:TextInput id="firstname"/>

      </mx:FormItem>

      <mx:FormItem required="true" label="Last Name">

         <mx:TextInput id="lastname"/>

      </mx:FormItem>

   </mx:HBox>

   <mx:HBox width="100%">

      <mx:FormItem label="Email" required="true">

         <mx:TextInput id="email" />

      </mx:FormItem>

      <mx:FormItem label="State">

         <mx:TextInput id="state"/>

      </mx:FormItem>

      <mx:FormItem label="Country">

         <mx:TextInput id="country"/>

      </mx:FormItem>

   </mx:HBox>

   <mx:HBox>

      <mx:FormItem label="" required="false">

         <mx:CheckBox id="enewsletter"/>

      </mx:FormItem>

   </mx:HBox>

   <mx:HBox width="100%">

      <mx:FormItem label="" required="false">

         <mx:CheckBox id="surveys" />

      </mx:FormItem>

   </mx:HBox>

</mx:Form>

<mx:Button label="Submit Details" click="submitForm()"
id="submitButton"/>

</mx:VBox>

FormEvent.as:

package events

{

   import flash.events.Event;

   public class FormEvent extends Event

  {

      public var firstNameInput:String;

      public var lastNameInput:String;

      public var emailAddressInput:String;

      public function FormEvent(type:String, firstNameInput:String="",
lastNameInput:String="",

emailAddressInput:String="")

{

      super(type);

      this.firstNameInput = firstNameInput;

      this.lastNameInput = lastNameInput;

      this.emailAddressInput = emailAddressInput;

}

      override public function clone():Event

   {

      return new FormEvent(type, firstNameInput, lastNameInput,
emailAddressInput);

   }

 }

}

Brad Cedergren
http://www.bradcedergren.com <http://www.bradcedergren.com/>  

________________________________

Windows 7: It works the way you want. Learn more.
<http://www.microsoft.com/Windows/windows-7/default.aspx?ocid=PID24727::
T:WLMTAGL:ON:WL:en-US:WWL_WIN_evergreen2:102009>


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Colin Petit  
View profile  
 More options Oct 29, 7:30 pm
From: Colin Petit <co...@shot1.com>
Date: Thu, 29 Oct 2009 18:30:47 -0500
Local: Thurs, Oct 29 2009 7:30 pm
Subject: Re: [mnswf] Custom Event Problems

It looks like your submitButton calls submitForm(), but the only line  
of code there is commented out.
Maybe try throwing some trace statements like:
        trace('submitForm called');
        trace('formSubmitHandler called');
inside the appropriate function so you know what's getting called and  
what isn't where you expect it to.

On Oct 29, 2009, at 2:51 PM, Brad Cedergren wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Brad Cedergren  
View profile  
 More options Oct 29, 8:38 pm
From: Brad Cedergren <b_cederg...@hotmail.com>
Date: Thu, 29 Oct 2009 19:38:52 -0500
Local: Thurs, Oct 29 2009 8:38 pm
Subject: RE: [mnswf] Re: Custom Event Problems

Thanks Dustin. That was what was missing.

Brad Cedergren
http://www.bradcedergren.com

Subject: [mnswf] Re: Custom Event Problems
Date: Thu, 29 Oct 2009 17:14:35 -0500
From: Dus...@easelsolutions.com
To: mnswf@googlegroups.com

Looks like you’re missing a parameter in your creation of you event object (the type).   This line:

    var formObj:FormEvent = new FormEvent(firstNameInput, lastNameInput, emailAddressInput);

should be:

    var formObj:FormEvent = new FormEvent(“formSubmit”, firstNameInput, lastNameInput, emailAddressInput);

From: mnswf@googlegroups.com [mailto:mnswf@googlegroups.com] On Behalf Of Brad Cedergren
Sent: Thursday, October 29, 2009 2:52 PM
To: mnswf@googlegroups.com
Subject: [mnswf] Custom Event Problems

I have a form as a custom component with four text fields and two check boxes that I need to have the information sent to the main application. I have created a custom event to be able to dispatch the text from the text fields and display in an Alert box. For some reason it is not sending the text over but the event is being dispatched.

The code is listed below:

main.mxml:
<mx:Script>
   <![CDATA[
      import mx.controls.Alert;
      import events.FormEvent;

   [Bindable]
    private var firstNameInput:String = new String;
    private var lastNameInput:String = new String;
    private var emailAddressInput:String = new String;
    private var stateInput:String = new String;
    private var countryInput:String = new String;
    private var newsletterCheck:Boolean = new Boolean;
    private var surveysCheck:Boolean = new Boolean;

    private function formSubmitHandler(event:FormEvent):void {
    firstNameInput = event.firstNameInput;
    lastNameInput = event.lastNameInput;
    emailAddressInput = event.emailAddressInput;
    Alert.show(firstNameInput);
    }
    ]]>
   </mx:Script>

  <com:form horizontalCenter="0" verticalCenter="0" id="form1" formSubmit="formSubmitHandler(event)"/>

form.mxml:
<mx:Metadata>
    [Event(name="formSubmit", type="events.FormEvent")]
</mx:Metadata>

<mx:Script>
   <![CDATA[
    import mx.rpc.events.AbstractEvent;
    import events.FormEvent;
    import mx.controls.Alert;

   // Create variables for form fields
    [Bindable]
     public var firstNameInput:String;
     public var lastNameInput:String;
     public var emailAddressInput:String;
     public var stateInput:String;
     public var countryInput:String;
     public var newsletterCheck:Boolean;
     public var surveysCheck:Boolean;

    // Function to handle the form submissions
    private function submitForm():void {
    //customEventHandler(event);
    }

    private function dispatchEventHandler(event:FormEvent):void {
    var formObj:FormEvent = new FormEvent(firstNameInput, lastNameInput, emailAddressInput);
    formObj.firstNameInput = firstname.text;
    formObj.lastNameInput = lastname.text;
    formObj.emailAddressInput = email.text;
    dispatchEvent(formObj);
    }
]]>
</mx:Script>
<mx:VBox id="Panel">
<mx:Form>
   <mx:HBox width="100%">
      <mx:FormItem required="true" label="First Name">
         <mx:TextInput id="firstname"/>
      </mx:FormItem>
      <mx:FormItem required="true" label="Last Name">
         <mx:TextInput id="lastname"/>
      </mx:FormItem>
   </mx:HBox>
   <mx:HBox width="100%">
      <mx:FormItem label="Email" required="true">
         <mx:TextInput id="email" />
      </mx:FormItem>
      <mx:FormItem label="State">
         <mx:TextInput id="state"/>
      </mx:FormItem>
      <mx:FormItem label="Country">
         <mx:TextInput id="country"/>
      </mx:FormItem>
   </mx:HBox>
   <mx:HBox>
      <mx:FormItem label="" required="false">
         <mx:CheckBox id="enewsletter"/>
      </mx:FormItem>
   </mx:HBox>
   <mx:HBox width="100%">
      <mx:FormItem label="" required="false">
         <mx:CheckBox id="surveys" />
      </mx:FormItem>
   </mx:HBox>
</mx:Form>
<mx:Button label="Submit Details" click="submitForm()" id="submitButton"/>
</mx:VBox>

FormEvent.as:
package events
{
   import flash.events.Event;
   public class FormEvent extends Event
  {
      public var firstNameInput:String;
      public var lastNameInput:String;
      public var emailAddressInput:String;

      public function FormEvent(type:String, firstNameInput:String="", lastNameInput:String="",
emailAddressInput:String="")
{
      super(type);
      this.firstNameInput = firstNameInput;
      this.lastNameInput = lastNameInput;
      this.emailAddressInput = emailAddressInput;

}

      override public function clone():Event
   {
      return new FormEvent(type, firstNameInput, lastNameInput, emailAddressInput);
   }
 }

}

Brad Cedergren
http://www.bradcedergren.com

Windows 7: It works the way you want. Learn more.

_________________________________________________________________
Windows 7: Simplify your PC. Learn more.
http://www.microsoft.com/Windows/windows-7/default.aspx?ocid=PID24727...


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google