Showing posts with label as3. Show all posts
Showing posts with label as3. Show all posts

Saturday, January 3, 2009

1118: Implicit coercion of a value with static type Object to a possibly unrelated type .

var myvar:classname=e.target could result in the compiler error:
1118: Implicit coercion of a value with static type Object to a possibly unrelated type . in actionscript 3

Possible fixes / solutions:
try var myVar:classname= e.target as classname;

or

var myVar:classname=e.currentTarget;

Tuesday, March 25, 2008

TextField setFocus in Actionscript3 (flash)

In Actionscript2 (AS2), you can set focus to a textfield using setfocus();
Not anymore in AS3.
In actionscript3, instead of setfocus use code as follows:
For a text field with instance name 'mytextField' :

stage.focus=mytextField;