Simple Instatiate Question
Regarding these declarations:
ActionScript Code:
[LEFT][COLOR=#993300]var[/COLOR] songList_XML:[COLOR=#993300]XML[/COLOR]; [COLOR=#993300]var[/COLOR] xmlLoader:URLLoader = [COLOR=#993300]new[/COLOR] URLLoader[COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
[/LEFT]
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:
ActionScript Code:
[LEFT][COLOR=#993300]var[/COLOR] songList_XML: [COLOR=#993300]new[/COLOR] = [COLOR=#993300]XML[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR]; [COLOR=#993300]var[/COLOR] xmlLoader:URLLoader = [COLOR=#993300]new[/COLOR] URLLoader[COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
[/LEFT]
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