# With() doesn

**URL:** <https://forum.kirupa.com/t/with-doesn/29869>\
**Category:** Uncategorized\
**Created:** [September 1, 2003, 8:30am UTC](https://forum.kirupa.com/t/with-doesn/29869 "2003-09-01T08:30:11Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![oscar\_alexander](https://avatars.discourse-cdn.com/v4/letter/o/e5b9ba/32.png) [@oscar\_alexander](https://forum.kirupa.com/u/oscar_alexander)\
**Post date:** [September 1, 2003, 8:30am UTC](https://forum.kirupa.com/t/with-doesn/29869/1 "2003-09-01T08:30:11Z")

</div>

(crap, hit return to soon… topic doesn’t make sense now :P)

Why won’t this work?

[AS]  
\_global.MyObject = new Object();

with(MyObject) {  
FirstName = “Oscar”;  
LastName = “Griffioen”;  
}  
[/AS]

For some reason the WITH clause doesn’t seem to work on my newly created object. How come?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 1, 2003, 10:12am UTC](https://forum.kirupa.com/t/with-doesn/29869/2 "2003-09-01T10:12:52Z")

</div>

try with(\_global.MyObject)

🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 1, 2003, 10:53am UTC](https://forum.kirupa.com/t/with-doesn/29869/3 "2003-09-01T10:53:13Z")

</div>

> \*Originally posted by Syko \*  
> **try with(\_global.MyObject)**

This is why: When you define a \_global object, you need to use \_global everytime you refer to it, I thought. Not 100% sure though. 🙂 [http://www.macromedia.com/support/flash/action\_scripts/actionscript\_dictionary/actionscript\_dictionary379.html](http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary379.html)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 1, 2003, 12:27pm UTC](https://forum.kirupa.com/t/with-doesn/29869/4 "2003-09-01T12:27:45Z")

</div>

you should also look up with.  
[http://www.macromedia.com/support/flash/action\_scripts/actionscript\_dictionary/actionscript\_dictionary826.html](http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary826.html)

note the phrase

> To set a variable inside a with action, the variable must have been declared outside the with action or you must enter the full path to the Timeline on which you want the variable to live.

and yes, _setting_ or changing \_global properties requires the \_global identifier. _Referencing_ global values does not.

also see:  
[http://proto.layer51.com/d.aspx?f=1034](http://proto.layer51.com/d.aspx?f=1034)  
[http://proto.layer51.com/d.aspx?f=885](http://proto.layer51.com/d.aspx?f=885)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 1, 2003, 1:13pm UTC](https://forum.kirupa.com/t/with-doesn/29869/5 "2003-09-01T13:13:49Z")

</div>

> \*Originally posted by senocular \*  
> \*\*and yes, _setting_ or changing \_global properties requires the \_global identifier. _Referencing_ global values does not. \*\*

… Right. Thanks for clearing that up for me sen =)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 1, 2003, 1:24pm UTC](https://forum.kirupa.com/t/with-doesn/29869/6 "2003-09-01T13:24:28Z")

</div>

🙂

theres also a couple of \_globl links in the Best of Senocular sticky in the actionscript forum
