# Help with scripting HTML "asfunction" plz

**URL:** https://forum.kirupa.com/t/help-with-scripting-html-asfunction-plz/164863
**Category:** Uncategorized
**Created:** [October 5, 2005, 4:12pm UTC](https://forum.kirupa.com/t/help-with-scripting-html-asfunction-plz/164863 "2005-10-05T16:12:39Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![cmart](https://avatars.discourse-cdn.com/v4/letter/c/977dab/32.png) [@cmart](https://forum.kirupa.com/u/cmart)
#### Post date: [October 5, 2005, 4:12pm UTC](https://forum.kirupa.com/t/help-with-scripting-html-asfunction-plz/164863/1 "2005-10-05T16:12:39Z")

</div>

**EDIT: PLease scroll down for simplified question:::::**

Hi, I’m trying to use this generic function in an HTML-enabled dynamically loaded text box (.txt file):

```auto
<a href="asfunction:my_mc.loadMovie,file.swf">Load Movie!</a>

```

…to load a new .swf (“artist.swf”) into this mc: “\_root.content”

Here’s the problem…I used the kirupa tutorial to create a flash movie with transitions. So i have a transition mc and here’s an example of the actionscript that I’ve been using on each navigation button (this example is on the button that leads to the releases section).

```auto
releasesbutton.onRelease = function() {
	if (_root.section != "releases.swf") {
		_root.section = "releases.swf";
		_root.transition.gotoAndPlay("closing");
	}
};

```

because the asfunction command in HTML is limited in scope, how can I craft a function to replace

```auto
asfunction:_root.content.loadMovie,artist.swf

```

(BTW this works in that it loads the .swf but it doesn’t engage the transition or preloader)

…with this:

```auto
 ???.onRelease = function() {
	if (_root.section != "artist.swf") {
		_root.section = "artist.swf";
		_root.transition.gotoAndPlay("closing");
	}
};

```

my apologies for such a round-about post but I really need to get this to work.

THANKS!

EDIT: and it would be best if the function is not specific to the .swf being loaded:

e.g.

```auto
<a href="asfunction: **myNewLoadingKirupaFunction** ,whateverIwant.swf"></a>

```
