Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

converting from actionscript 1.0 to 2.0 1

Status
Not open for further replies.

artguy

Technical User
Feb 2, 2001
117
0
0
US
I have a script that I would like to use that worked with Actionscript 1.0 but if I export using settings for Flash Player 8 (using either AS1.0 or AS2.0), it no longer works. It's a very simple script that has 5 lines in the main timeline and another 4 or 5 on one of the movie clips.

I export it as Flash player 5 it works and I change it over to Flash player 8, it doesn't do anything.

Is there a way to easily find out where my problem lies in Flash?

Thank your for your time.

Bob
 
I got some old code off of Fl*shk*t(now that I read your sig, guess I won't go there again. seems dead anyways) for an idea and was making some changes to it so it would do what I wanted it to do and my code didn't work. So I went back to the bare basics and it didn't work either after I had pasted it in my file. That's when I realized the version difference.

here's the code on the main timeline:
Code:
MovieClip.prototype.elasticScale = function(target, accel, convert) {
	xScale = xScale * accel + (target - this._xscale) * convert;
	yScale = yScale * accel + (target - this._yscale) * convert;
	this._xscale += xScale;
	this._yscale += yScale;
}

Here's the code on each movieclip:
Code:
onClipEvent (enterFrame) {
	if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
		elasticScale(150, 0.9, 0.1);
	} else {
		elasticScale(100, 0.9, 0.1);
	}
}

All I wanted to do was do the elastic scaling of a movie clip and be able to display some text and a link in the item after it expands. So I was attempting to use this for the elastic logic.

Any help you can provide in just making the code above work in Flash 8 would be fantastic.

Thank you for your time.

Bob
 
Is it "MovieClip.prototype" that no longer works on AS 2.0? That's the only thing I can question since everything else looks pretty normal.
 
I would assume that your xScale & yScale variables need to be casted...

Add a trace line in the prototype...

trace(xScale+" - "+yScale);

If you get undefined, then those 2 variables need to be casted (outside of the prototype) before this will work...

var xScale:Number = 0;
var yScale:Number = 0;

Regards. Web Hosting - Web Design
03/13/05 -> OLDNEWBIE VS FLASHKIT
 
That was it! I'm ordering a book from Friends of Ed to understand Flash more. Probably Foundation ActionScript for Flash 8 -- to cover the basics and get into some deeper stuff...well, deeper for me.

Thanks for your help and your time!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top