Issue Details (XML | Word | Printable)

Key: FDT-621
Type: Featurerequest Featurerequest
Status: Closed Closed
Resolution: Incomplete
Priority: Trivial Trivial
Assignee: FDT Team
Reporter: Arne Deutsch
Votes: 2
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
FDT

Additional warning if I try to register to an event that is never dispatched

Created: 06/Aug/09 12:04 PM   Updated: 22/Jun/12 06:42 PM
Component/s: Core (Deprecated)
Affects Version/s: FDT 4.5.2
Fix Version/s: FDT
Security Level: public

Time Tracking:
Not Specified

Review Type: Review by Product Owner


 Description  « Hide
Adding an Event listener looks like this:
model.addEventListener(ModelEvent.SELECTED, handleSelected);

The "ModelEvent.SELECTED" is a string. The compiler will not complain if you provide an constant that is never thrown. If I register an event to the wrong class this is hard to detect.

For example, I'm in an "Sprite" and forget the "model."

addEventListener(ModelEvent.SELECTED, handleSelected);

All compiles well, but nothing works. FDT could help here with an warning "Event is never dispatched" by checking the metadata tags defined for the class and all it's super classes.

[Event(name="ModelEvent.SELECTED", type="my.model.ModelEvent")]
package my.model
{
	import flash.events.Event;

	public class ModelEvent extends Event 
	{
		public static const SELECTED : String = "ModelEvent.SELECTED";

		public function SceneModelEvent(type : String)
		{
			super(type);
		}
	}
}


 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
No work has yet been logged on this issue.