The Enchanted Cave 2
Delve into a strange cave with a seemingly endless supply of treasure, strategically choos
4.38 / 5.00 36,385 ViewsGhostbusters B.I.P.
COMPLETE edition of the interactive "choose next panel" comic
4.07 / 5.00 13,902 ViewsI know you guys here are experts. I have moderate knowledge...
But I have one problem I dont know... I converted a flash 5 file to flash 8.... and now get these errors:
**Error** E:\Yamodo\ASDRecorder.as: Line 36: ActionScript 2.0 class scripts may only define class or interface constructs.
ASDRecorder.prototype.setMovieClip = function(mc){
**Error** E:\Yamodo\ASDRecorder.as: Line 39: ActionScript 2.0 class scripts may only define class or interface constructs.
ASDRecorder.prototype.supressDrawing = function(supress_drawing){
**Error** E:\Yamodo\ASDRecorder.as: Line 42: ActionScript 2.0 class scripts may only define class or interface constructs.
ASDRecorder.prototype.setCommands = function(command_str, parse){
**Error** E:\Yamodo\ASDRecorder.as: Line 50: ActionScript 2.0 class scripts may only define class or interface constructs.
ASDRecorder.prototype.addCommands = function(command_str, parse){
**Error** E:\Yamodo\ASDRecorder.as: Line 57: ActionScript 2.0 class scripts may only define class or interface constructs.
ASDRecorder.prototype.getCommands = function(){
**Error** E:\Yamodo\ASDRecorder.as: Line 61: ActionScript 2.0 class scripts may only define class or interface constructs.
ASDRecorder.prototype.command_hash = {
**Error** E:\Yamodo\ASDRecorder.as: Line 70: ActionScript 2.0 class scripts may only define class or interface constructs.
ASDRecorder.prototype.parse = function(){
**Error** E:\Yamodo\ASDRecorder.as: Line 85: ActionScript 2.0 class scripts may only define class or interface constructs.
ASDRecorder.prototype.__parseBGF = function(s){
**Error** E:\Yamodo\ASDRecorder.as: Line 102: ActionScript 2.0 class scripts may only define class or interface constructs.
ASDRecorder.prototype.__stripPipes = function(s){
**Error** E:\Yamodo\ASDRecorder.as: Line 107: ActionScript 2.0 class scripts may only define class or interface constructs.
ASDRecorder.prototype.lineStyle = function(t,c,a){
**Error** E:\Yamodo\ASDRecorder.as: Line 111: ActionScript 2.0 class scripts may only define class or interface constructs.
ASDRecorder.prototype.moveTo = function(x,y){
**Error** E:\Yamodo\ASDRecorder.as: Line 115: ActionScript 2.0 class scripts may only define class or interface constructs.
ASDRecorder.prototype.lineTo = function(x,y){
**Error** E:\Yamodo\ASDRecorder.as: Line 119: ActionScript 2.0 class scripts may only define class or interface constructs.
ASDRecorder.prototype.curveTo = function(x,y,x2,y2){
**Error** E:\Yamodo\ASDRecorder.as: Line 123: ActionScript 2.0 class scripts may only define class or interface constructs.
ASDRecorder.prototype.beginFill = function(c,a){
**Error** E:\Yamodo\ASDRecorder.as: Line 127: ActionScript 2.0 class scripts may only define class or interface constructs.
ASDRecorder.prototype.beginGradientFill = function(f,c,a,r,m){
**Error** E:\Yamodo\ASDRecorder.as: Line 136: ActionScript 2.0 class scripts may only define class or interface constructs.
ASDRecorder.prototype.endFill = function(){
**Error** E:\Yamodo\ASDRecorder.as: Line 140: ActionScript 2.0 class scripts may only define class or interface constructs.
ASDRecorder.prototype.clear = function(){
**Error** E:\Yamodo\ASDRecorder.as: Line 144: ActionScript 2.0 class scripts may only define class or interface constructs.
ASDRecorder.prototype.draw = function(mc){
**Error** E:\Yamodo\ASDRecorder.as: Line 150: ActionScript 2.0 class scripts may only define class or interface constructs.
ASDRecorder.prototype.drawNextLine = function(mc){
**Error** E:\Yamodo\ASDRecorder.as: Line 163: ActionScript 2.0 class scripts may only define class or interface constructs.
ASDRecorder.prototype.getLinePosition = function(){
**Error** E:\Yamodo\ASDRecorder.as: Line 166: ActionScript 2.0 class scripts may only define class or interface constructs.
ASDRecorder.prototype.resetLinePosition = function(){
**Error** E:\Yamodo\ASDRecorder.as: Line 168: ActionScript 2.0 class scripts may only define class or interface constructs.
}
Total ActionScript Errors: 22 Reported Errors: 22
the Code I am talking about is here(http://www.senocular.com/demo/ASDRe corder/ASDRecorder.as)
I'll take a wild guess -
Are you publishing it in the right AS?
(File > Publish Settings > 'Flash' tab.)
At 8/10/07 11:56 PM, Kuoke wrote: I'll take a wild guess -
Are you publishing it in the right AS?
(File > Publish Settings > 'Flash' tab.)
its a .as page... the .as page doesnt give me the option... but yes, it does say AS2
?? which should be AS1 no?
file -> publish settings -> flash tab.
Change the AS version from 2.0 to 1.0
AS version is set by the FLA, not the .as file
Really? You sure. Try again lol. If it worked in 5 which has action script 1 it shoudl work..
It's not much good giving us your errors, if you give us the actual code we can help you turn it into AS2 syntax.
My bad, just noticed you did post the code.
Anyway it looks like you are trying to use the .as file as a class, when it doesn't contain a class. So try using #include instead of how you are linking it now. Or turn it into a class.
It is a class, but it's written without the AS2 constructs. When you use an undefined class name in Flash it looks for the corresponding AS file and tries to read it like the AS2 'class' statement. All you have to do is put a #include "ASDRecorder.as" before you use it since it'll define the value.
At 8/11/07 06:58 AM, GustTheASGuy wrote: All you have to do is put a #include "ASDRecorder.as" before you use it since it'll define the value.
What do you mean? like right before? or in the same frame? or what?
I started to convert and now I get these Errors....
**Error** Line 21: Identifier expected
var this.command_str;
**Error** Line 22: ActionScript 2.0 class scripts may only define class or interface constructs.
var this.command_array = [];
Total ActionScript Errors: 2 Reported Errors: 2
Code is
/*
pipe ("|") separated commands
"s,t,c,a" - lineStyle(thickness, color, alpha)
"m,x,y" - moveTo(x,y)
"l,x,y" - lineTo(x,y)
"c,x,y,x2,x2" - curveTo(x,y,x2,y2)
"f,c,a" - beginFill(color, alpha)
"g,f,c,a,r,m" - beginGradientFill(fillType, colors, alphas, ratios, matrix)
"e" - endFill()
"x" - clear() (? unimplemented ?)
*/
class ASDRecorder
{
// ==Acceptable Argument Arrangements:==
// ASDRecorder(command_str)
// ASDRecorder(mc)
// ASDRecorder(mc, supress_drawing)
// ASDRecorder(command_str, mc, supress_drawing)
// variables (all pretty much "private")
var this.command_str;
var this.command_array = [];
var this.mc;
var this.supress_drawing;
var this._parsed = false;
var this._position = 0;
if (arguments[0] instanceof MovieClip) {
command_str = "";
mc = arguments[0];
supress_drawing = (arguments.length >= 2) ? arguments[1] : false;
}
this.setCommands(command_str);
this.setMovieClip(mc);
this.supressDrawing(supress_drawing);
}
public function setMovieClip (mc){
this.mc = mc;
}
public function supressDrawing(supress_drawing){
this.supress_drawing = supress_drawing;
}
public function setCommands(command_str, parse){
if (command_str == undefined){
command_str = "";
this.command_array = [];
}else this.command_str = command_str;
if (parse) this.parse();
else this._parsed = false;
}
public function addCommands(command_str, parse){
command_str = this.__stripPipes(command_str);
this.command_str = this.__stripPipes(this.command_str);
this.command_str += "|"+command_str;
if (parse) this.parse();
else this._parsed = false;
}
public function getCommands(){
this.command_str = this.__stripPipes(this.command_str);
return this.command_str;
}
public function command_hash() {
s: this.lineStyle,
m: this.moveTo,
l: this.lineTo,
c: this.curveTo,
f: this.beginFill,
g: this.beginGradientFill,
e: this.endFill
}
public function parse(){
this.command_array = this.command_str.split("|");
var cs, c = this.command_array;
var L = this.command_array.length;
var ch, h = this.command_hash;
var a = [];
for (var i=0; i<L; i++){
cs = c[i].split(",");
ch = cs.shift();
if (ch == "g") a[i] = [h[ch], this.__parseBGF(c[i].substr(2))]; // for gradient fill
else a[i] = [h[ch], cs]; // for all other commands
}
this.command_array = a;
this._parsed = true;
}
public function __parseBGF(s){
var t, a = [s.substring(0,s.indexOf(","))]; // type
for (var j,i=0;i<3;i++){ // colors, alphas, ratios
s = s.substring(s.indexOf("[")+1);
t = s.substring(0, s.indexOf("]")).split(",");
for (j=0;j<t.length;j++) t[j] = Number(t[j]);
a[a.length] = t;
}
s = s.substring(s.indexOf("{")+1, s.indexOf("}")).split(","); // matrix
var p,o = {}
for (var i=0; i<s.length; i++){
p = s[i].split(":");
o[p[0]] = (!i) ? p[1] : Number(p[1]);
}
a[a.length] = o;
return a;
}
public function __stripPipes(s){
while(s.charAt(0) == "|") s = s.substring(1);
while(s.charAt(s.length-1) == "|") s = s.substring(0,s.length-1);
return s;
}
public function lineStyle(t,c,a){
if (!this.supress_drawing) this.mc.lineStyle.apply(this.mc, arguments);
this.addCommands("s,"+arguments.join(","
));
}
public function moveTo(x,y){
if (!this.supress_drawing) this.mc.moveTo.apply(this.mc, arguments);
this.addCommands("m,"+arguments.join(","
));
}
public function lineTo(x,y){
if (!this.supress_drawing) this.mc.lineTo.apply(this.mc, arguments);
this.addCommands("l,"+arguments.join(","
));
}
public function curveTo(x,y,x2,y2){
if (!this.supress_drawing) this.mc.curveTo.apply(this.mc, arguments);
this.addCommands("c,"+arguments.join(","
));
}
public function beginFill(c,a){
if (!this.supress_drawing) this.mc.beginFill.apply(this.mc, arguments);
this.addCommands("f,"+arguments.join(","
));
}
public function beginGradientFill(f,c,a,r,m){
if (!this.supress_drawing) this.mc.beginGradientFill.apply(this.mc, arguments);
var o = "", bak = m.__proto__;
m.__proto__ = null;
for (var p in m) o += p+":"+m[p]+",";
o = o.substr(0, o.length-1);
m.__proto__ = bak;
this.addCommands("g,"+f+",["+c.toString(
)+"],["+a.toString()+"],["+r.toString()+
"],{"+o+"}");
}
public function endFill(){
if (!this.supress_drawing) this.mc.endFill();
this.addCommands("e");
}
public function clear(){
if (!this.supress_drawing) this.mc.clear();
this.command_str = "";
}
public function draw(mc){
if (mc == undefined) mc = this.mc;
if (!this._parsed) this.parse();
var a = this.command_array, L = this.command_array.length;
for (var i=0; i<L; i++) a[i][0].apply(mc, a[i][1]);
}
public function drawNextLine(mc){
if (!this._parsed) this.parse();
var m;
do {
if (this._position >= this.command_array.length) this._position = -1;
if (this._position < 0) return false;
if (mc == undefined) mc = this.mc;
m = this.command_array[this._position][0];
m.apply(mc, this.command_array[this._position][1]);
this._position++;
} while (m != MovieClip.prototype.lineTo && m != MovieClip.prototype.curveTo);
return true;
}
public function getLinePosition(){
return this._position;
}
public function resetLinePosition(){
this._position = 0;
}