View Full Version : Can I reduce these 2 lines of code to 1 line?
12-21-2008, 08:06 PM
var cn:ClassName = new ClassName();
12-21-2008, 09:13 PM
Howdy and Welcome... :)
Well, you can simply remove a line break, but that does not really say it is a oneliner... ;)
What if you do this???
var cn:scripts.ClassName = new scripts.ClassName();
12-21-2008, 09:45 PM
I tried it, but it gave me these errors:
Type was not found or was not a compile-time constant: ClassName.
Access of undefined property scripts.
I thought import statements can be completely omitted, but maybe not.
12-21-2008, 09:52 PM
You can do this...
var cn:flash.text.TextField = new flash.text.TextField();
cn.text = "Hello";
So, my guess is that 'scripts' is not in the directory where Flash's class scope...
12-22-2008, 12:18 AM
So, I guess an import statement is necessary in order to bring a user-defined package into Flash's scope
vBulletin® v3.8.5, Copyright ©2000-2014, Jelsoft Enterprises Ltd.