Copy link to clipboard
Copied
I don't know what i just miss here, I think I do this for a thousand time but it's just didn't work!
as you can see when i use...
PCButton(event.target); // i get null, but...
var pcButton:PCButton = event.target as PCButton; // i get what i want
and fyi when i cast type
var pcButton:PCButton = new PCButton(id);
trace(PCButton(pcButton).id);
this work too! never get null before, so i'm confuse now
what so wrong with my code or it's bug?
Copy link to clipboard
Copied
try
var pcButton:PCButton=event.target as PCButton
switch(pcButton.id);
or
switch(event.target.id)
Copy link to clipboard
Copied
yes, i know i can do that, but i just want to know why PCButton(event.target); didn't work
Find more inspiration, events, and resources on the new Adobe Community
Explore Now