//File: UserEvents.as
package events { import flash.events.Event;  import vo.User;
public class UserEvents extends Event {
public static const USER_SUBMIT:String = "userSubmit";
public var user:User;  public function UserEvents(type:String,
bubbles:Boolean=false, cancelable:Boolean=false) { super(type, bubbles,
cancelable); }  } }
--- In flexcoders@yahoogroups.com, Alan Rother <alan.rot...@...> wrote:
>
> This is the entire UserEvents class as the example showed me how to
build
> it. I'm guessing that the declaration for my event is supposed to be
in
> here, but in the demo we actually created it in the component we were
> loading. How and where do I add it to the UserEvents class and why
does it
> work when I call it from MXML but not from AS?
> //File: UserEvents.as
> package events
> {
> import flash.events.Event;
> import vo.User;
>
> public class UserEvents extends Event
> {
> public var user:User;
> public function UserEvents(type:String, bubbles:Boolean=false,
> cancelable:Boolean=false)
> {
> super(type, bubbles, cancelable);
> }
> }
> }
>
>
> //Script Code from Component
> <mx:Metadata>
> [Event(name="userSubmit", type="events.UserEvents")]
> </mx:Metadata>
> <mx:Script>
> <![CDATA[
> import vo.User;
> import events.UserEvents;
> import mx.managers.PopUpManager;
> private function onClick():void {
> var event:UserEvents = new UserEvents("userSubmit");
> var user:User = new User();
> user.fname = fname.text;
> user.lname = lname.text;
> user.email = email.text;
> event.user = user;
> dispatchEvent(event);
> }
> ]]>
> </mx:Script>
>
> --
> Alan Rother
> Adobe Certified Advanced ColdFusion MX 7 Developer
> Manager, Phoenix Cold Fusion User Group, AZCFUG.org
>

Reply via email to