Whittler
03-16-2011, 08:24 PM
Regarding these declarations:
var songList_XML:XML;
var xmlLoader:URLLoader = new URLLoader();
I'm working off of the ASCS5 CIB book and ran across these statements an other like this. Why is it (or when is it) that when putting a class into a var with nothing in it, you have to preceded it with "new?" I think the term is called instantiate it? I'm having a problem understanding this logic. They're both new. Why not:
var songList_XML: new = XML();
var xmlLoader:URLLoader = new URLLoader();
Is it because of the type of classes they are? If so, how do I know which ones to instantiate with the word "new" and which ones not to use "new."
Thanks in advance,
Newb
:confused:
var songList_XML:XML;
var xmlLoader:URLLoader = new URLLoader();
I'm working off of the ASCS5 CIB book and ran across these statements an other like this. Why is it (or when is it) that when putting a class into a var with nothing in it, you have to preceded it with "new?" I think the term is called instantiate it? I'm having a problem understanding this logic. They're both new. Why not:
var songList_XML: new = XML();
var xmlLoader:URLLoader = new URLLoader();
Is it because of the type of classes they are? If so, how do I know which ones to instantiate with the word "new" and which ones not to use "new."
Thanks in advance,
Newb
:confused: