Articles Tagged 'Event'

How to create your own protocol with delegated

Even in the most simple tutorial you can find the use of protocols. It will certainly happen to many in your view controller to use a protocol, inputting, next to the definition of the interface, a statement similar to:

1
2
3
UIViewController <uiwebviewdelegate> { @ Interface myViewController: UIViewController {<uiwebviewdelegate>
...
}

Continued ...

Apple Event: Live Radiopodcast

Wednesday, January 27, 2010 at 18:30

Continued ...

Prevent the spread of events with jQuery

Two overlapping elements of the HTML DOM, both sensitive to an event click , suffer the age-old problem of the propagation degi events between the layers of the DOM itself: the so-called event bubbling. This behavior (which is also found in other development environments: See Actionscript 3.0: MovieClip MovieClip over ) is in itself useful in many cases.

Continued ...

Very short trick: addEventListener () AS3, a handler more events

In Actionscript 3.0 you must use addEventListener() to intercept any event:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/ **
* Given a MovieClip mc, you set events and handlers
* /
( MouseEvent . CLICK , on_click ) ; mc. addEventListener ( MouseEvent . CLICK, on_click);
( MouseEvent . ROLL_OVER , on_roll_over ) ; mc. addEventListener ( MouseEvent . ROLL_OVER, on_roll_over);
( MouseEvent . ROLL_OUT , on_roll_out ) ; mc. addEventListener ( MouseEvent . ROLL_OUT, on_roll_out);
/ **
* Functions hander for the above events
* /
e : MouseEvent ) : void { on_click function (e: MouseEvent ): void {
/ / Click
}
e : MouseEvent ) : void { on_roll_over function (e: MouseEvent ): void {
/ / Roll over
}
e : MouseEvent ) : void { on_roll_out function (e: MouseEvent ): void {
/ / Roll-out
}

Continued ...

Actionscript 3.0: MovieClip MovieClip over

Just a Flash Developer / Actionscript is preparing to write a function similar to a tooltip, clashes immediately with the problem of the propagation of events between overlapping MovieClips. In fact, if a MovieClip (B) is superimposed to a MovieClip (A), which responds, for example, an event MouseEvent.Mouse_OVER , by hovering on the MovieClip (B) no event be higher than intercepted by the MovieClip (A):

MovieClip MovieClip over

Continued ...

Adobe Creative Suite 4: Rome 21 October 2008

Adobe Creative Suite 4: Rome 21 October 2008

Adobe is pleased to invite you to the launch events of the Adobe Creative Suite 4. See you in Rome and Milan October 21 October 30. For full details go to the meeting dedicated mini-site events CS4! As a tribute to all participants t-shirts CS4!

I will try to be there ... especially for the T-shirt :)

Continued ...

Live Now, Radiopodcast

radiopodcast

Tonight, at 21:40, with live DJ Frank and Thomas Tessarolo ! We discuss Current.TV and more! No more surprises ahead! :)

Continued ...

The new event handling in Flash CS3

I had already spoken in Flash CS3: The new event handling . I'll be back on the issue sublists for the difference of this new approach compared to previous versions of ActionScript. Schematically we have a general situation of this type:

addEventListener

Any object that supports events, ultimately exposing itself the addEventListener (). In the documentation, among other things, we read:

What's new for event listeners in ActionScript 3.0

[...] To add event listeners in ActionScript 2.0 is sometimes uses addListener () and sometimes addEventListener (), whereas in ActionScript 3.0 using addEventListener () in all situations.
[..]

Event management, then, is standardized at the level of real listeners. All the "features" of listening, in fact, have the following structure:

1
2
3
eventObject : EventType ) : void { eventResponse function (eventObject: EventType): void {
/ / The actions in response to the events are defined here.
}

o una sua sottoclasse. EvenType is always an object of class Event or a subclass. . This allows for more informations specific to the particular event in addition to handling standard properties such as target or currentTarget .

An important difference with previous versions of ActionScript, with respect to the listener, is that:

In ActionScript 2.0, event listeners can be either functions, methods or objects, whereas in ActionScript 3.0, event listeners can be only functions or methods.

In short, having used for some 'time to event structure from earlier versions of Flash, I must say that this new approach is really nice. It's a bit 'that development with Actionscript 3.0 and, after a small initial loss (just to regain what was taken for granted) now I can not understand how could I bear the "old" method of the events of the previous versions.

Continued ...

Event management: similarities between Flash and Javascript

One of the strengths of Adobe Flash lies in the choice of the ECMAScript (ECMA-products - E uropean C omputer A ssociation anufacturers M) as the standard scripting. ActionScript and JavaScript, in fact, both stem from a higher standard as they are extremely similar. This is one of the reasons for which many ActionScript programmers develop very easily in JavaScript and vice versa.

ActionScript has always had a management "double" of events that often has confused some developers. In MovieClip, for example, you can set an event by simply declaring a function to the properties of the event, for example:

Method 1

1
2
3
( ) { mio_mc. onRelease = function () {
"Click sul MovieClip" ) ; trace ("Click on the MovieClip");
}

Other objects, in contrast, require a different handling of the event that you want to monitor, requiring the classical listener, an object designed for this task. For example, the Mouse object can be controlled in this way:

Method 2

1
2
3
4
5
Object = new Obejct ( ) ; MouseListener var: Object = new Obejct ();
( ) { MouseListener. onMouseMove = function () {
"Mouse in moto" ) ; trace ("Mouse in motion");
}
addListener ( mouseListener ) ; Mouse . addListener (MouseListener);

The components have a further variant, as the Loader component:

Method 3

1
2
3
4
5
Object = new Object ( ) ; loaderListener var: Object = new Object ();
= function ( evt : Object ) { loaderListener. complete = function (evt: Object ) {
"Caricamento completato" ) ; trace ("Upload completed");
};
( "complete" , loaderListener ) ; myLoader_ldr. addEventListener ("complete", loaderListener);

Why these differences? The reason, indeed, is very simple. Method 1, the most immediate, is used when the event to "intercept" is unique, that is when it makes no sense to "take" several functions one after all ' other. Methods 2 and 3, however, create the "lists" of "listeners" and are extremely useful and powerful because they allow you to attach virtually infinite number of functions to a particular event.

The same thing happens in JavaScript and can be seen in libraries as a prototype . The convenient observe () method, available from the event, allows you to fit a function to an event object. For example:

1
window , 'load' , function ( ) { alert ( "Finestra caricata" ) ; } ) ; Event. Observe (window, 'load', function () {alert ("Window loaded");});

In this case we have attached our function that displays an alert to the load event of the window object. We could only repeat the statement and attach additional event:

1
2
window , 'load' , function ( ) { alert ( "Finestra caricata - 1" ) ; } ) ; Event. Observe (window, 'load', function () {alert ("Window loaded - 1");});
window , 'load' , function ( ) { alert ( "Finestra caricata - 2" ) ; } ) ; Event. Observe (window, 'load', function () {alert ("Window loaded - 2");});

This feature, also common in ActionScript, it is extremely versatile, especially in JavaScript, is the key to the creation of many "widgets" and extensions (see the classic snap ) now proliferating on the Web The ability to tag along, in fact , for events that are already controlled by other functions, can be non-intrusive (Unobtrusive) and then, in practice, to add functions to those already present.

Continued ...