Query in writing a Custom Event class
Hi ,
I am trying to work with the Events for pratic epurposes , when i am copying , pasting the code from web tutorilas they are working finr , but whne i tries myself they aren't working .
Please help me
This is my Custom Event .
I want to pass the VO Object through Event . PLease see this below code and let me know as where i am doing wrong .
package events
import flash.events.Event;
import vo.User;
public class LoginEvent extends Event
public static const LOGIN_EVENT:String = "LoginEvent";
public var user : User;
public function LoginEvent(type:String,user:User)
super(type,user);
this.user = user;
PLease let me know
what are the parameters to be passed inside the Constructor of the Event class , and the Parameters inside the super()
Waiting for your replies .
Hi Kiran
Try this
package events
import flash.events.Event;
import vo.User;
public class LoginEvent extends Event
public static const LOGIN_EVENT:String= "loginEvent";
public var userDtl:User;
public function LoginEvent(type:String,userObj:User)
//TODO: implement function
super(type);
this.userDtl = userObj;
override public function clone():Event{
return new LoginEvent(type,userDtl);
Thanks
Ram
Similar Messages
-
Custom event class vs metadata event
Custom event class vs metadata event. Which one is prefered?
I personally think class is more flexible but take more time to
write. What do you think and can you share your opinions?newShape will not dispatch your event because it is not one
that the Shape
class dispatches by default. But you can dispatch any event
through any
EventDispatcher, i.e.
private function functionOne():void
trace("Function One");
newShape.addEventListener(eventManager.ANIM_COMPLETE,
functionTwo);
newShape.dispatchEvent(new
eventManager("EventManagerFired"));
newShape.dispatchEvent(new eventManager("Some other
important
message."));
private function functionTwo(event:eventManager):void
trace("Function Two");
// trace(event.theMessage) // would need to declare
theMessage public
// output 1: EventManagerFired
// output 2: Some other important message.
// trace output:
Function Two
EventManagerFired
Function Two
Some other important message. -
Query regarding creating a Custom Event and Firing.
I have created a custom event,a custom listener and a custom button.
But when I click on custom button,my event is not being fired.
When and how do I need to invoke the fireEvent() ?
Please can any body tell me if I have overlooked any thing ?
Thanks,
// 1 Custom Event
import java.util.EventObject;
public class MyActionEvent extends EventObject{
public MyActionEvent(Object arg0) {
super(arg0);
// 2 Custom Listener
import java.util.EventListener;
public interface MyActionListener extends EventListener {
public void myActionPerformed(MyActionEvent myEvent);
// 3 Custom Button
public class MyButton extends JButton {
// Create the listener list
protected javax.swing.event.EventListenerList listenerList = new javax.swing.event.EventListenerList();
public MyButton(String str){
super(str);
public void addMyActionEventListener(MyActionListener listener) {
listenerList.add(MyActionListener.class, listener);
protected void fireMyActionEvent() {
MyActionEvent evt = new MyActionEvent(this);
Object[] listeners = listenerList.getListenerList();
for (int i = 0; i < listeners.length; i = i+2) {
if (listeners[i] == MyActionListener.class) {
((MyActionListener) listeners[i+1]).myActionPerformed(evt);
} // end of class MyButton.
// 4 Test my Custom Event,Listener and Button
public class MyButtonDemo extends JPanel {
protected MyButton b1;
public MyButtonDemo() {
b1 = new MyButton("Disable Button");
b1.setToolTipText("Click this button to disable the middle button.");
b1.addMyActionEventListener(new MyActionListener() {
@Override
public void myActionPerformed(MyActionEvent myEvent) {
System.out.println("My ActionEvent....");
add(b1);
private static void createAndShowGUI() {
JFrame frame = new JFrame("ButtonDemo");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
MyButtonDemo newContentPane = new MyButtonDemo();
newContentPane.setOpaque(true);
frame.setContentPane(newContentPane);
//Display the window.
frame.pack();
frame.setVisible(true);
public static void main(String[] args) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}Hi Stan,
I would like to use my custom action listener rather that using the the normal actionPerformed(ActionEvent e)
But some how this event is not being fired.
Any suggestions to fire this?
b1.addMyActionEventListener(new MyActionListener() {
@Override
public void myActionPerformed(MyActionEvent myEvent) {
System.out.println("My ActionEvent triggered....");
}); -
Writing a custom event for mouseenter in ActionScript 2.0
Hi All,
I am trying to implemetn one functionality based on the mouseenter
Unlike the mouseover() event, the mouseenter() event only triggers when the the mouse pointer enters the selected element. The mouseover() event is triggered if a mouse pointer enters any child elements as well.
In jquery latest they added support for mouseenter , i want to do the same in Flash AS2.0
There are only RollOver,RollOut, mousedown, so i want to add mouseEnter event Just like Jquery which is done below
Checks if an event happened on an element within another element
// Used in jQuery.event.special.mouseenter and mouseleave handlers
var withinElement = function( event ) {
// Check if mouse(over|out) are still within the same parent element
var parent = event.relatedTarget;
// Firefox sometimes assigns relatedTarget a XUL element
// which we cannot access the parentNode property of
try {
// Traverse up the tree
while ( parent && parent !== this ) {
parent = parent.parentNode;
if ( parent !== this ) {
// set the correct event type
event.type = event.data;
// handle event if we actually just moused on to a non sub-element
jQuery.event.handle.apply( this, arguments );
// assuming we've left the element since we most likely mousedover a xul element
} catch(e) { }
// In case of event delegation, we only need to rename the event.type,
// liveHandler will take care of the rest.
delegate = function( event ) {
event.type = event.data;
jQuery.event.handle.apply( this, arguments );
// Create mouseenter and mouseleave events
jQuery.each({
mouseenter: "mouseover",
mouseleave: "mouseout"
}, function( orig, fix ) {
jQuery.event.special[ orig ] = {
setup: function( data ) {
jQuery.event.add( this, fix, data && data.selector ? delegate : withinElement, orig );
teardown: function( data ) {
jQuery.event.remove( this, fix, data && data.selector ? delegate : withinElement );
So please help me in implemeting the customevent mouseenter I am using AS2.0
Regards
Ramakrishna
[email protected]remove the stop() from frame 1. and use tl.play() in the onRelease
and yes, you can use another loop (enterframe) to update the drag_mc position as the timeline plays. that new code would look like:
var tl:MovieClip = this;
tl.onEnterFrame = playF;
paramF(tl,1,0,tl._totalframes,sb_mc._width-sb_mc.drag_mc._width);
paramF(sb_mc.drag_mc,0,1,sb_mc._width-sb_mc.drag_mc._width,tl._totalframes);
sb_mc.drag_mc.onPress = function(){
this.startDrag(false,0,this._y,sb_mc._width-sb_mc.drag_mc._width,this._y);
this.onEnterFrame = scrollTL;
delete tl.onEnterFrame;
sb_mc.drag_mc.onRelease = sb_mc.drag_mc.onReleaseOutside = function(){
this.stopDrag();
delete this.onEnterFrame;
tl.onEnterFrame = playF;
tl.play();
function playF():Void{
sb_mc.drag_mc._x = this._currentframe*this.m+this.b;
function scrollTL():Void{
tl.gotoAndStop(Math.round(this._x*this.m+this.b));
function paramF(mc:MovieClip,x1:Number,y1:Number,x2:Number,y2:Number):Void{
mc.m = (y1-y2)/(x1-x2);
mc.b = y1-mc.m*x1;
p.s. please mark helpful/correct responses. -
Custom Events and Listeners between classes
I've got a project I've been working on for weeks that I'm
having yet another problem with. I'm trying to learn AS3 which is
why it's taking so long but that's not important for this post.
I wanted to create a custom event class so that I could make
sure the event does not interfere with other "COMPLETE" events that
are being passed between classes. In other words, I have a few
things that need to complete prior to a function being called...
one is some XML being loaded and another is a font loaded. So, I
thought I would create a custom FontLoaded class that extends Event
and make the type something like "FontLoadedEvent.LOADED". That way
I could listen for the XML "Event.COMPLETE" and this font event
also.
Please tell me if I'm going down the wrong path here but I
don't seem to be getting the dispatched event for my new custom
event. Also, how does one detect if it's being dispatched other
than if the eventListener is fired? Any other ways to test
this?You can trace the event to see if it dispatched.
Also, this is not a good case to create a new event. Custom
events are used to store additional information. MouseEvent exists
because Event doesn't have localX, localY, etc. properties. Since
you don't seem to be throwing additional properties, you can use a
regular event.
trace(dispatchEvent(new Event("panelFontsLoaded"));
addEventListener("panelFontsLoaded", onFontsLoaded);
Static consts are used to help debug typos. The event type is
just a string, often stored in a const. -
How to implement custom Model Class in Oracle ADF?
I am using Oracle ADF for one of my project and i am using Query component of ADF. For given tables the query component creates view objects and maps the relations. ADF uses its own custom model class for this component and it should understand the DB tables. But for my project i have no access to database. All i can do is pass a string or object/query to the existing (custom) Java class/object, and this model class formulates query and queries the database and returns the value to my Java class. I have to display these results using ADF to the front end. Is There a way to achieve this? Can i replace/override the existing Model class of ADF. If so how?
Thanks in advance for your help.Hi, there:
Best thing to do is to start with the default login.html page, and then modify it. The login screen is fairly complex and it's easy to just miss a JS function you need to call. To get to default page, you would need to do one deploy (to simulator or whatever), and then look for login.html page in the temporary Xcode or Android project generated from the deployment. It should be under the "deploy" directory in your JDev workspace.
You can also see all the framework JS files and CSS files that way as well.
We have had customers implementing custom login screen so we know it can work, but they all had to start with the default login screen and then modify it.
Thanks,
Joe Huang -
Hi,
I wrote a Custome Event class and a Listner to support my Event. They
compile fine as I extended com.bea.p13n.events.Event and implemented
EventListener. However, from the docs
(http://edocs.bea.com/wlp/docs40/events/custmevt.htm), I am not sure
where to drop my custom Event and Listner class so that they can be
used from my portal within a portlet.
Should I place the classes inside a particular directory of the Portal
product? Should I add them to the Event and Listener JARs? Any help is
appreciated.
Thanks in advance.
-nHello,
The problem appears to be that you are trying to determine if the portlet was targeted and to send events in preRender()-- this should be done in your backing file's handlePostbackData() method. Some of the earlier links and examples on this discussion thread mixed up "campaign events" with "interportlet events"-- they are two different things. The information about inter-portlet events is located at http://edocs.bea.com/wlp/docs81/ipcguide/overview.html .
Interportlet events can only be sent during the handlePostbackData() backing file lifecycle phase, or when handling another incoming event. If an event is sent during preRender() it may not be delivered to any other portlets, and in later versions of WLP it will actually result in an error being logged.
So your backing file should probably look something like this:
import com.bea.netuix.servlets.controls.content.backing.AbstractJspBacking;
import com.bea.netuix.servlets.controls.portlet.backing.PortletBackingContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
* Sample backing file for sending an event when the portlet
* is clicked.
public class SampleBacking extends AbstractJspBacking
public boolean handlePostbackData(HttpServletRequest request,
HttpServletResponse response)
// Determine if this request originated due to an action
// on our portlet
if(isRequestTargeted(request))
PortletBackingContext context = PortletBackingContext.getPortletBackingContext(request);
context.fireCustomEvent("portletClicked", "my portlet was clicked");
return false;
} -
Hello everybody,
Task: I want to enter a message in input text field and
write it in the dynamic using a custom event dispatching.
Solution: I have 2 textfields on the stage.
One textfield is an input text field the other is a dynamic
text field which will server just to display text.
on the flash in the first frame I made this code:
// mb is the instance name of the dynamic text field already
placed on the stage
var messageBoard:MsgBoard = new MsgBoard(mb);
// u1 is the input text field placed on the stage
var user1:UserInput = new UserInput(u1);
Also I wrote 3 very simple classes.
1. UserInput.as // input textfield class that listens to
input and dispatches a custom event
2. MsgEvnt.as // custom event class the instance of which is
dispatched
3. MsgBoard.as // class that listens to the new event and
once it occurs adding event message to the textfield
Problem: Somehow it doesn't work. I actually made it work by
making a listener the same object that dispatches the event. But I
want to understand why it doesn't works the way I showed above. I
browsed a lot of forums and found that all the people use to listen
by the same object that is dispatching. I think it's like talking
with yourself isn't it?
Thanks everybody who will reply and I hope it will help
someone who will read!your event is dispatched within UserInput scope and MsgBoard
is not within UserInput scope so it's not going to receive that
event. ie, a UserInput instance is not accessible to MsgBoard.
you may have a basic misunderstanding: events that are
dispatched are not like radio signals that are transmitted and
anyone with a listener (radio) can hear them.
when you dispatch an event using actionscript, it is
dispatched by an object (or sometimes by a class) and that event
can only be detected by the dispatching object (or class). -
How to acknowledge custom event?
Helllo All
I did a custom event class, imported it in main application,
added event metatags in it, and dispatched this event along with my
custom data !
Works fine till above point
now my question is
how can i acknowledge that event in a nested component?
Main Application - TileList Component - [Item renderer
Component]
Thanks in advanceHi,
Try setting the bubbles property of your custom event to true
and then register a listener for the custom event on the parent of
the component.
Hope this helps. -
Custom Event with multiple EventTypes
Hello All, First thanks for all those who tryied to help me and apologize for my approximative english.
I would like to create the more properly as possible a Custom Event with multiple EventTypes, like the MouseEvent typicaly.
With Some EventType which permit to acces to some attributes and other not. But I'm totaly lost, The second solution if someone knows how, is to explain to me how to do to acces to the code of the MouseEvent.as
Thanks!
Ps: you will find below the basis of the code i have begin.
package fr.flashProject
import flash.events.Event;
* @author
public class SWFAddressManagerEvent extends Event
public static const CHANGE_PAGE:String = "change_page";
public static const ERROR_404:String = "error_404";
public static const HOME_PAGE:String = "home_page";
private var _page:String;
private var _params:Object;
public function SWFAddressManagerEvent(type:String, pPage:String = null, pParams:Object = null, bubbles:Boolean=false, cancelable:Boolean=false)
super(type, bubbles, cancelable);
_page = pPage;
_params = _params;
public override function clone():Event
return new SWFAddressManagerEvent(_type, _page, _params, bubbles, cancelable);
public override function toString():String
return formatToString("SWFAddressManagerEvent", "type", "page", "params", "bubbles", "cancelable", "eventPhase");
public function get page():String { return _page; }
public function get params():Object { return _params; }I am not sure what you are trying to accomplish but event can have only single type. Event type is just a string that is typically a constant - exactly like your constants.
When dispatched, each event INSTANCE has only one type. Again, these types are described in a type parameter by a string. Each dispatched MouseEvent DOES NOT have multiple types but ONLY ONE. It does have multiple constants that are used to assign type at runtime as does your event.
If you are talking about multiple parameters, you already do that in your custom event class. You have _page and _params. Nothing stops you from adding more parameters.
Also I am not sure why you need getters for _page and _params. -
Need help with custom event from Main class to an unrelated class.
Hey guys,
I'm new to Flash and not great with OOP. I've made it pretty far with google and lurking, but I've been pulling my hair out on this problem for a day and everything I try throws an error or simply doesn't hit the listener.
I'm trying to get my Main class to send a custom event to an unrelated class called BigIcon. The rest of the code works fine, it's just the addEventListener and dispatchEvent that isn't working.
I've put in the relevant code in below. Let me know if anything else is needed to troubleshoot. Thank you!
Main.as
package
import flash.display.MovieClip;
import flash.events.MouseEvent;
public class Main extends MovieClip
var iconLayer_mc:MovieClip = new MovieClip();
public function Main()
Spin_btn.addEventListener(MouseEvent.CLICK,fl_MouseClickHandler);
addChildAt(iconLayer_mc,0);
placeIcons();
function placeIcons():void
var i:int;
var j:int;
for (i = 0; i < 4; i++)
for (j = 0; j < 5; j++)
//iconString_array has the names of illustrator objects that have been converted to MovieClips and are in the library.
var placedIcon_mc:BigIcon = new BigIcon(iconString_array[i][j],i,j);
iconLayer_mc.addChild(placedIcon_mc);
function fl_MouseClickHandler(event:MouseEvent):void
dispatchEvent(new Event("twitchupEvent",true));
BigIcon.as
package
import flash.display.MovieClip;
import flash.events.Event;
import flash.utils.getDefinitionByName;
public class BigIcon extends MovieClip
private var iconImage_str:String;
private var iconRow_int:int;
private var iconColumn_int:int;
public function BigIcon(iconImage_arg:String, iconRow_arg:int, iconColumn_arg:int)
iconImage_str = iconImage_arg;
iconRow_int = iconRow_arg;
iconColumn_int = iconColumn_arg;
this.addEventListener(Event.ADDED_TO_STAGE, Setup);
function Setup(e:Event)
this.y = iconRow_int;
this.x = iconColumn_int;
var ClassReference:Class = getDefinitionByName(iconImage_str) as Class;
var thisIcon_mc:MovieClip = new ClassReference;
this.addChild(thisIcon_mc);
addEventListener("twitchupEvent", twitchUp);
function twitchUp(e:Event)
this.y += 10;Ned Murphy wrote:
You should be getting an error for the Main.as class due to missing a line to import the Event class...
import flash.events.Event;
My apologies, I should attempt to compile my example code before I ask for help...
Alright, this compiles, gives me no errors, shows my 'book' and 'flowers' icons perfectly when ran, and prints 'addEventListener' to the output window as expected. I get no errors when I press the button, 'dispatchEvent' is output (good), but the 'twitchUp' function is never called and 'EventTriggered' is never output.
How do I get the 'twitchUp' event to trigger?
Main.as
package
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.events.*;
public class Main extends MovieClip
var iconLayer_mc:MovieClip = new MovieClip();
var iconString_array:Array = new Array(2);
public function Main()
Spin_btn.addEventListener(MouseEvent.CLICK,fl_MouseClickHandler);
addChildAt(iconLayer_mc,0);
buildStringArray();
placeIcons();
function buildStringArray():void
var i:int;
var j:int;
for (i = 0; i < 2; i++)
iconString_array[i] = new Array(3);
for (j = 0; j < 3; j++)
if (Math.random() > .5)
//'flowers' is the name of an illustrator object that has been converted to a MovieClip and is in the library
iconString_array[i][j] = "flowers";
else
//'book' is the name of an illustrator object that has been converted to a MovieClip and is in the library
iconString_array[i][j] = "book";
function placeIcons():void
var i:int;
var j:int;
for (i = 0; i < 2; i++)
for (j = 0; j < 3; j++)
//iconString_array has the names of illustrator objects that have been converted to MovieClips and are in the library.
var placedIcon_mc:BigIcon = new BigIcon(iconString_array[i][j],i*50,j*50);
iconLayer_mc.addChild(placedIcon_mc);
function fl_MouseClickHandler(event:MouseEvent):void
dispatchEvent(new Event("twitchupEvent",true));
trace("dispatchEvent");
BigIcon.as
package
import flash.display.MovieClip;
import flash.events.*;
import flash.utils.getDefinitionByName;
public class BigIcon extends MovieClip
private var iconImage_str:String;
private var iconRow_int:int;
private var iconColumn_int:int;
public function BigIcon(iconImage_arg:String, iconRow_arg:int, iconColumn_arg:int)
iconImage_str = iconImage_arg;
iconRow_int = iconRow_arg;
iconColumn_int = iconColumn_arg;
this.addEventListener(Event.ADDED_TO_STAGE, Setup);
function Setup(e:Event)
this.y = iconRow_int;
this.x = iconColumn_int;
var ClassReference:Class = getDefinitionByName(iconImage_str) as Class;
var thisIcon_mc:MovieClip = new ClassReference;
this.addChild(thisIcon_mc);
addEventListener("twitchupEvent", twitchUp);
trace("addEventListener");
function twitchUp(e:Event)
this.y += 10;
trace("EventTriggered");
Output:
[SWF] Untitled-1.swf - 40457 bytes after decompression
addEventListener
addEventListener
addEventListener
addEventListener
addEventListener
addEventListener
dispatchEvent
[UnloadSWF] Untitled-1.swf
Test Movie terminated. -
Sql Query in Custom Java Class in OIM 9x
Hi All,
I m having requirement where I need to execute SQL Select Query in custom java class.
The class is a action class ,in a method I m trying to execute SQL Query as below
sdkDataSet = new tcDataSet();
dataprovider =sdkDataSet.getDataBase();
//sdkDataSet = new tcDataSet();
sdkDataSet.setQuery(dataprovider, sdkQuery);
sdkDataSet.executeQuery();
logger.debug(CLASSNAME + methodName + "Query Executed");
if (sdkDataSet.getRowCount() > 0)
sdkName = sdkDataSet.getString(0);
logger.debug(CLASSNAME + methodName+ "The sdkName is " + sdkName);
Error is returned in logs
tcDataSetException Must set a query before executing
I hope issue is coming due to dataprovider dbrefence.
Kindly let me know how to execute sql query in a action class.
Regards,
KrishHi Pallavi,
Thanks for your reply...
OOTB class Name is com.thortech.xl.webclient.actions.ApprovalsAction
This class will display the pending Approvals for a user.On pending approval page, I need to add one more attribute let say email of the beneficiary user.I have a query which will fetch email value based on RequestID.
select usr.usr_email from rqu rqu, usr usr, act act where rqu.usr_key=usr.usr_key and usr.act_key=act.act_key and rqu.req_key=1234*
Pls let me know if there is any way to get email with or with out executing Query.
Regards,
Krish -
How to dispatch events from custom AS3 classes to MXML
Hello,
I introduce some custom classes inside my SCRIPT tag in MXML.
These classes should dispatch custom Events (or any events for that
matter) and the listeners should be defined inside the SCRIPT tag.
In the custom class I have:
quote:
dispatchEvent(new Event("customEvent"));
And inside the script tag:
quote:
addEventListener("customEvent", testListener);
quote:
public function testListener(evt:Event):void{
Alert("Event fired successfully.");
However, this event is not handled in the listener (the alert
is not shown). What could be wrong?<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute" creationComplete="init();">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
private function init():void
addEventListener("customEvent", testListener);
dispatchEvent(new Event("customEvent"));
private function testListener(evt:Event):void{
Alert.show("Event fired successfully.");
Do like this
Alert is the Class Object. This is not the Function. -
How to create custom events in OIM
Hi
We have a requirement to create new notification templates with custom events to send email notifications.
How should I create a custom event, any pointers are highly appreciated.
Thanks
NagendraI am still unclear about the relationship between this report and OIM; as stated OIM allows you to create [url http://docs.oracle.com/cd/E27559_01/dev.1112/e27150/notevents.htm#BEIBDIAA]Custom Notification Events however generally the invocation of them is tied to the [url http://docs.oracle.com/cd/E27559_01/dev.1112/e27150/oper.htm#CCHFBGAA]custom event handler which in turn are tied to OIM operations. In this case AFAIK there is no OIM operation rather the HCM application is querying user data combined with data from HCM. Is the requirement to use the OIM notification feature or can you use other alternatives e.g. [url http://fmwdocs.us.oracle.com/doclibs/fmw/E10285_01/dev.1111/e10224/ns_ws_api.htm#SOASE87208]UMS ?
I think you could invoke a custom OIM event using the [url http://docs.oracle.com/cd/E27559_01/dev.1112/e27150/apis.htm]OIM APIs specifically using the [url http://docs.oracle.com/cd/E21764_01/apirefs.1111/e17334/oracle/iam/notification/api/NotificationService.html]notification service (for details of related classes refer to the [url http://docs.oracle.com/cd/E21764_01/apirefs.1111/e17334/toc.htm]javadoc).
However I have not tested this and was unable to find a concrete example from the documentation. Pseudo logic should be something like this:
Hashtable env = new Hashtable();
env.put(OIMClient.JAVA_NAMING_FACTORY_INITIAL, "weblogic.jndi.WLInitialContextFactory");
env.put(OIMClient.JAVA_NAMING_PROVIDER_URL, http://OIM_HOSTNAME:OIM_PORT);
OIMClient oimClient = new OIMClient(env);
oimClient.login(OIM_USERNAME, OIM_PASSWORD);
NotificationEvent event = new NotificationEvent();
event.setUserIds(new String[]{"receiverUserId"});
event.setTemplateName("Template Name");
event.setSender(null);
NotificationService notificationService = oimClient.getService(NotificationService.class);
notificationService.notify(event);Do note that this is provided as illustration and if adopted you will need to implement proper exception handling, store credentials in [url http://docs.oracle.com/cd/E29505_01/core.1111/e10043/devcsf.htm]CSF etc.
Jani Rautiainen
Fusion Applications Developer Relations
https://blogs.oracle.com/fadevrel/ -
Could some one explain to me how Custom Events work?
I tried looking in the live docs and still it confused me, so
then I went searching on the net and found this very lovely
tutorial
http://www.tink.ws/blog/custom-events-in-as-30-dont-forget-to-override-the-clone-method/
but still it confused me. The part I am puzzled on the most is that
when you create like a event that listens for when your mouse
clicks something is setup like addEventListener(MouseEvent.CLICK,
eventHandler) etc, etc. And when a mouse is clicked the event is
triggered! but if the CLICK constant is just a a string value what
is going on behind the scenes that tells it (lets say Flex is
talking -->) "okay he/she specified the 'CLICK' constant so I
guess this means I will make this event happen only when the mouse
clicks on that particular object" and same with
MouseEvent.DOUBLE_CLICK how does it know to trigger this event only
when the mouse double clicks on a item. I want to make my own
custom events that trigger a particular event based on what a
object does, but I just don't understand how to set it up and
implement it.HI,
The hole concept of event dispatcher is that events get fired
all the time, if there is someone listening to the event or not. In
your own example, the CLICK event gets fired each time someone
clicks on the object.
When you add an event listener basically what you are doing
is adding a function to a queue of functions that get executed each
time a specific event is fired. This is very important to keep in
mind from the object disposal point of view, since for the garbage
collector to actually kill an object all reference to it must be
eliminated, and this include the reference in this queue for the
listening function.
The reason that an event name is simply a String is so you
can actually define any event you might like. Still is good
practice to define constants for your events names since it will
avoid a lot of errors when writing code.
Now to fire an event all you need to do is dispatch a
specific event using the "dispatchEvent" function. This is what
happens each time you click on an object, the dispatchEvent(new
Event(Event.CLICK))) function is called.
If you are using custom events it's a good idea to extend the
Event class so you can add some extra information to the event, for
example, in the MouseEvent the x and y coordinates of the mouse are
added. To dispatch a custom event all you do is call the event
dispatcher with the custom event:
dispatchEvent(new CustomEventClass(Some Data));
Maybe you are looking for
-
I got a earpods with remote and mic for my iPod touch quite while ago, it stopped working a couple of months ago, how can I fix this!
-
Customer exit for calweek is not working
Hi, I have written a customer exit to derive calweek from a calday. But its not displaying the correct value. Can u please let me know if there is any error in the code. The return value for calweek is a single value. CASE I_VNAM. WHEN 'zfclweek'. D
-
Where are jar files downloaded to with Applet?
I have an Applet and am using archive attribute in my applet tag to specify jar files needed by the applet. eg: "archive=myclassfiles.jar, foo.jar". Assume that myclassesfiles.jar has classes needed by the Applet and Foo.jar has some text files or xm
-
Iphone 5 not working in usb socket of 2011 nissan navara teckna
My vehicle is 1 year old and worked very well with my iphone 4. Since upgrading to an iphone 5 I cannot get the usb socket to accept it. It does not recognise it, or indeed charge the phone. is it my phone or a problem with the vehicle not recognis
-
Restricted Backflush Authorisation Object C_BFLS_L is NOT working!
Hi, We are using the IS-MILL version of SAP 4.7. We are trying to restrict the authorisation of users for Tcode MFBF only to a few. As suggested in the SPRO help files we tried useing the 'Authorisation Object' [bC_BFLS_L]</b> Restricted Backflush bu