5 to MX code conversion

I’ve been trying to convert some flash 5 code to MX but have failed in getting it to work in MX. I’ve been on trying to convert the sticky button code from mjau-mjau but with no success.

You can download from

http://www.mjau-mjau.com
http://www.sintax321.com/sticky.zip

If some one could please convert this code to work in MX it would be greatly apprecitated.

–>BUMP<–

Any body out there?

its in MX for me…

i try to expoet it in MX and it stops working for me. Are your publish settings for MX or 5?

the only thing I can suggest is changing the variable number to nNumber or something else because it could cause a conflict. Also wherever you have Movieclip change it to MovieClip with a Capital C.

K ya i caought the Numkber thing but not the MC thing. I’ll play some more

ahhh i see… ok, i’ll take a look…

nah, I have no idea. the code looks fine to me… I’ll keep at it, but I can’t promise anything…

Ya i thought it looked good to. I changed the Number and the MovieClip thing and still it does nothing. I can’t notice muc hthat would cause it not to work. I was hoping a code monkey like LIB or POM would take a look at it but they are no where to be found so far. I’ll keep looking to. thanks for trying so far.:slight_smile:

Hmm… this is what I got out of it.

playamarz :player:

same thing playamarz… change the version to flash 6 in the publish settings and it doesn’t work :-\

Yeah, it doesn’t work for me either, but all the coding looks A OK in my book.

Hmm, interesting.

it may have something to do with using all of those _parent and such. I’m sure the problem is that one single thing is being called incorrectly and that caused everything not to work…

yeah… it’s an addresing problem =)

accel = .8;
convert = .2;
MovieClip.prototype.sticky_load = function(menunumber) {
	mysound = new Sound(this);
	this._parent.released = 0;
	somenumber = menunumber;
	iterations = 5;
	xstart = this._x;
	drag = 0;
	ystart = this._y;
	targetx = xstart;
	targety = ystart;
	r = 5;
	x = (2*Math.PI)*(somenumber/iterations);
	t = Math.tan(x);
	mycol = new Color(this.internal);
	this._parent.drag = 0;
};
MovieClip.prototype.sticky_update = function() {
	if (this.hitTest(_root._xmouse, _root._ymouse, true) && this._parent.drag<2 && this._parent.released == 0) {
		if (!Math.floor(Math.random()*5)) {
			counter++;
			addcol = Math.round(Math.random()*151);
			mycol.setTransform({rb:addcol, gb:addcol, bb:addcol});
			duplicateMovieClip(this.line0, "line"+counter, counter);
		}
		deltax = this._parent._xmouse-xstart;
		deltay = this._parent._ymouse-ystart;
		targetx = (_root._xmouse-deltax/r);
		targety = (_root._ymouse-deltay/r);
		if (!drag) {
			mysound.attachSound("sound7");
			mysound.start();
			this.swapDepths(2);
			drag = 1;
			this._parent.drag++;
		}
	} else if (!this._parent.released) {
		this._parent["inhead"+(somenumber+1)]._visible = 1;
		mycol.setTransform({ra:100, ga:100, ba:100, rb:0, gb:0, bb:0});
		targetx = xstart;
		targety = ystart;
		if (drag == 1) {
			this.swapDepths(0);
			drag = 0;
			this._parent.drag--;
		}
	} else {
		targety = -170;
		targetx = (t*85)-56;
		if (this._parent.trigger == 1) {
			this.removeMovieClip();
		}
	}
	xpos = xpos*this._parent.accel+(targetx-this._x)*this._parent.convert;
	this._x += xpos;
	ypos = ypos*this._parent.accel+(targety-this._y)*this._parent.convert;
	this._y += ypos;
};
MovieClip.prototype.sticky_press = function() {
	if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
		r = 10;
	}
};
MovieClip.prototype.sticky_release = function(subname) {
	if (!_root.pause) {
		if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
			this._parent.atext = subname.toUpperCase();
			this._parent.released = 1;
			this._parent.label = subname;
			this._parent.atext = subname.toUpperCase();
			this._parent.gotoAndPlay(this._parent._currentframe+1);
		}
	}
};

figures…

so if i just re address it like kax has done it should work?

ok so i tried out kax’s code and it kind of worked but not. The icon moved a little but then went still. any ideas?

LIB, POM SOME ONE PLEASE HELP. I have no clue how to change this code. i never worked with AS really untill i got MX any body i’m dying here:*(

Im trying buddy, but I just don’t see whats wrong. Perhaps its something right in front of me, but all of the syntax, addressing, and coding look correct to me, I dont understand why it won’t work.

I got it working correctly with my system… I erased some ;'s Which caused some problems but that’s it…

Hmm… I dunno… it did everything fine for me guys…

playamarz :player: