# Function automatically executing on load

**URL:** https://forum.kirupa.com/t/function-automatically-executing-on-load/175867
**Category:** Uncategorized
**Created:** [January 18, 2006, 1:32pm UTC](https://forum.kirupa.com/t/function-automatically-executing-on-load/175867 "2006-01-18T13:32:23Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![hat\_rack](https://avatars.discourse-cdn.com/v4/letter/h/a5b964/32.png) [@hat\_rack](https://forum.kirupa.com/u/hat_rack)
#### Post date: [January 18, 2006, 1:32pm UTC](https://forum.kirupa.com/t/function-automatically-executing-on-load/175867/1 "2006-01-18T13:32:23Z")

</div>

I have some actionscript:

```auto

this.menuSelect.b3.dynTextHolder.dynText.text = "OTHER";
this.menuSelect.b3.dynTextHolder.onRelease = Vidd("other");

function Vidd(whichVideo) {	
	var nc:NetConnection = new NetConnection();
	nc.connect(null);
	var ns:NetStream = new NetStream(nc);
	videoHolder.theVideo.attachVideo(ns);
	ns.play("tm"+whichVideo+".flv");
	trace ("function exec also "+whichVideo);

}

```

ok, now when the flash movie loads, the trace in the function is automatically run when the flash clip loads, and doesn’t execute again. Even when I click on b3. It’s quite simple code, I can’t figure out why it isnt running only when b3 is released.

b3 is a button with an .AS file attached to it so that the object knows how to animate when I drag out an instance. Would that make a difference?

Thanks!
