# MX code needs converted to v5

**URL:** <https://forum.kirupa.com/t/mx-code-needs-converted-to-v5/18358>\
**Category:** flash\
**Created:** [April 15, 2003, 9:20pm UTC](https://forum.kirupa.com/t/mx-code-needs-converted-to-v5/18358 "2003-04-15T21:20:39Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![dshallenberger](https://avatars.discourse-cdn.com/v4/letter/d/ecccb3/32.png) [@dshallenberger](https://forum.kirupa.com/u/dshallenberger)\
**Post date:** [April 15, 2003, 9:20pm UTC](https://forum.kirupa.com/t/mx-code-needs-converted-to-v5/18358/1 "2003-04-15T21:20:39Z")

</div>

My client changed his mind about v6 and wants the swf compatible with v5. Maybe I should have been more prepared for this, but I’m not. I’ve barely chugged along with a tutorial and figuring this out, and I’m completely lost with converting it to v5 code. Can anyone help get me started?

Here’s my code so far:

```php
onClipEvent (load) {
	_global.ratio = 0;
	_global.popup = 0;
	imagehalf = -1668;
	xcenter = 2000;
	xspeed = 1/5;
	speedratio = 0;
	accel = 0;
	accel_amount = .1;
	setProperty("_root.button_left_ON", _visible, "0");
	setProperty("_root.button_right_ON", _visible, "0");
	setProperty("_root.popup_01", _visible, "0");
}
onClipEvent (enterFrame) {
	if (_global.ratio == 0) { // slider is NOT being used
		accel = accel-accel_amount; // create a deceleration value
		if (accel<0) { // keep the deceleration value at 0 so the movement doesn't reverse
			accel = 0;
		}
	} else { // slider IS being used
		speedratio = _global.ratio; // use the slider position to calculate the speed of the scroll
		accel = 1; // set acceleration to full
	}
	var xdistance = speedratio*accel;	// determine how far to move the movie clip based on how far the slider is moved
	_x -= (xdistance*xspeed);	// actually reposition the movie clip
	if (_x>0) { // test if the movie clip needs to loop from the left
		_x = imagehalf;
	}
	if (_x<imagehalf) { // test if the movie clip needs to loop from the right
		_x = 0;
	}
	if (_global.ratio<0) { // light up the buttons appropriately
		setProperty("_root.button_left_ON", _visible, "1");
		setProperty("_root.button_stop_ON", _visible, "0");
		setProperty("_root.button_right_ON", _visible, "0");
	}
	if (_global.ratio == 0) {
		setProperty("_root.button_left_ON", _visible, "0");
		setProperty("_root.button_stop_ON", _visible, "1");
		setProperty("_root.button_right_ON", _visible, "0");
	}
	if (_global.ratio>0) {
		setProperty("_root.button_left_ON", _visible, "0");
		setProperty("_root.button_stop_ON", _visible, "0");
		setProperty("_root.button_right_ON", _visible, "1");
	}
}

```

It’s for a scrolling image controlled with a slider. You can see my MX swf [here](http://www.popdesignworks.com/flash/).

I hope someone can help with this because I am so lost.

Thanks,  
Dan

---

<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:** [April 16, 2003, 2:05am UTC](https://forum.kirupa.com/t/mx-code-needs-converted-to-v5/18358/2 "2003-04-16T02:05:16Z")

</div>

I think the code works okay on Flash 5! Try exporting you SWF to Flash 5 and see if it works ok.

---

<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:** [April 16, 2003, 2:18am UTC](https://forum.kirupa.com/t/mx-code-needs-converted-to-v5/18358/3 "2003-04-16T02:18:02Z")

</div>

that’s good stuff right there! works in flash 5 or not. =)

good luck with it. =)

---

<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:** [April 16, 2003, 2:30am UTC](https://forum.kirupa.com/t/mx-code-needs-converted-to-v5/18358/4 "2003-04-16T02:30:53Z")

</div>

> \*Originally posted by comicGeek \*  
> \*\*I think the code works okay on Flash 5! Try exporting you SWF to Flash 5 and see if it works ok. \*\*  
> Flash 5 had no ‘\_global’ as far as i can remember…

---

<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:** [April 16, 2003, 2:50am UTC](https://forum.kirupa.com/t/mx-code-needs-converted-to-v5/18358/5 "2003-04-16T02:50:20Z")

</div>

Yeah, \_global is Flash 6 only.

setProperty is Flash 4 sintax… so thats way behind date anyway.

To fix the \_global thing just put the variables in the \_root timeline and target them with \_root.variable instead of \_global.variable 🙂

Thats all you should need.

But having never used Flash 5 I can’t really say for sure 😛

---

<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:** [April 16, 2003, 3:05pm UTC](https://forum.kirupa.com/t/mx-code-needs-converted-to-v5/18358/6 "2003-04-16T15:05:33Z")

</div>

Thanks everyone for the replies!

I did get it all working. You were right…this code was all v5 compliant, except for the \_global parts. I ended up using local variables to this mc, and referencing them from other mc’s with \_root.mcname.varname and it worked perfect!

As far as the setProperty being old…what’s the current v6 syntax? Would \_root.instancename.\_visible = 0; work?

Thanks again…

Dan

---

<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:** [April 16, 2003, 4:49pm UTC](https://forum.kirupa.com/t/mx-code-needs-converted-to-v5/18358/7 "2003-04-16T16:49:21Z")

</div>

Yes… \_root.instancename.\_visible = 0 will work, and that is the Flash 5 and Flash 6 syntax 🙂
