# Syntax Questions

**URL:** <https://forum.kirupa.com/t/syntax-questions/166846>\
**Category:** flash\
**Created:** [October 23, 2005, 6:51am UTC](https://forum.kirupa.com/t/syntax-questions/166846 "2005-10-23T06:51:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dae](https://avatars.discourse-cdn.com/v4/letter/d/47e85d/32.png) [@Dae](https://forum.kirupa.com/u/Dae)\
**Post date:** [October 23, 2005, 6:51am UTC](https://forum.kirupa.com/t/syntax-questions/166846/1 "2005-10-23T06:51:56Z")

</div>

I just wanted to make sure I’m using AS right. I sort of skipped a lot of reading about syntax (although I couldn’t find many sources) because I know other languages.

1)---------------------------------------------------

Is there any way to tell a function that I’m allowed to omit a parameter, so if its not given - not to freak out and give me an error… or must I use if/else statements manually (ie. pass “null” as parameter - if(parameter == “null”) //do this)

2)---------------------------------------------------

When I pass an instance as a parameter to a function, it is only passing a reference to the object right? (eg. I can change anything in that parameter, and it changes where it came from too, aka not a copy). I thought I saw somewhere that AS usually only references the instance, and I wanted to make sure.

ie. this example shows how a function copies it over to \_global.fileName, \_global.fileName doesnt point to p\_fileName.

[AS]\_global.fileName = “yes.swf”;  
trace(\_global.fileName); //returns “yes.swf”

function something(p\_fileName:String):Void {  
\_global.fileName = p\_fileName;  
}

var m\_fileName:String = “no.swf”;  
something(m\_fileName); //returns “no.swf”  
trace(\_global.fileName);

m\_fileName = “both.swf”;  
trace(\_global.fileName); //returns “no.swf” !![/AS]

BTW, is there any way to explicitly say \_global.fileName should point to p\_fileName (aka. pointer or reference in C++), no matter what its changed to, it will equal that. Assuming of course p\_fileName is pointing to m\_fileName, hence \_global.fileName is pointing to m\_fileName, and they will both always equal the same thing.

* * *

Thanks, I appreciate any help I can get!
