This content has been marked as final. Show 5 replies
you are declaring class public iconNormal:Class; in child where this class is already declared in parent class, redeclaring same variable is not allowed,
since you already hav public iconNormal:Class in parent Class just use that you done have to redeclare it , maybe like this ? :
[Embed (source="/assets/icons/normal/iconAdd.png")] iconNormal;
Thanks for your reply levancho.
However, following your advice gives me another error:
"Metadata requires an associated definition"
It there another way I can redeclare the class public using the embedding meta data?
I solved the inital problem by doing the following on the inherited classes:
<icons:AbstractIcon xmlns:icons="com.my.icons.*" creationComplete="doInit()" xmlns:mx=" http://www.adobe.com/2006/mxml" >
private var _iconNormal:Class;
private var _iconHot:Class;
private function doInit(): void
this.iconHot = _iconHot;
this.iconNormal = _iconNormal
However, now I reveice a new error:
Type Coercion failed: cannot convert flash.events::MouseEvent@4294609 to com.my.events.ClickEvent
This error occurs when the mouseUp handler(event) is invoked.
What do I need to do to get around this coercion problem?
change event parameter for function that listens to click/mouseUp events from concrete MouseEvent or ClickEvent to just Event,
later you can check its real type and cast it if you need to ,this way you can reuse function for both events mouse click and mouseUp.
Thanks Levancho, that was key:
In my abstract class I made the following changes and now it works comme il faut.
Event name="click", type="flash.events.Event")]
private function handler(event:Event):void
theImage.source = iconHot;