My ActionScript not working! When published works in Flash 6 not in Flash 8~

Hi,

I have this file which I created from http://www.tutorialized.com/tutorial...entation/11499 where the actionscript works in Flash Player 6 but when I publish into Flash player 7 or 8 it does not seem to want to play.

It gets a pop up message stating:
“A script in this movie is causing Flash Player to run slowly. If it continues to run, your computer may become unresponsive. Do you want to abort?”

My purpose to get this working in Flash 8 is because I need to incorporate CSS Stylesheets externally.

Here is the following actionscript:

stop();
numberOfTabs = 3;
for (i=1; i<=numberOfTabs; i++) {
line = eval(“tab”+i);
line.onRelease = function() {
for (i=1; i<=numberofTabs; i++) {
otherTabs =
eval(“this._parent.tab”+i);
otherTabs.bottomLine._visible =
true;
}
this.bottomLine._visible = false;
contentFrame = Number (this._name.substr(3,
1));
this._parent.contents.gotoAndStop(contentFrame);
}
}
tab1.bottomLine._visible = false;

tab1.onPress = function() {
gotoAndStop(“tab1”);
};

tab2.onPress = function() {
gotoAndStop(“tab2”);
};

tab3.onPress = function() {
gotoAndStop(“tab3”);
};

How does it need to be changed?

I’m not an AS expert, but i guess that probably it must be the AS version. Make sure that the code you’re using is AS 2.0, the AS version that flash 8 uses…

I will verify my code and check it!

stop();
var numberOfTabs:Number = 3;
for (i=1; i<=numberOfTabs; i++) {
   var line:String = eval("tab"+i);
   line.onRelease = function() {
      for (j=1; j<=numberofTabs; j++) {
         otherTabs = eval("this._parent.tab"+i); 
         otherTabs.bottomLine._visible = true; 
      }
      this.bottomLine._visible = false;
      var contentFrame:String = this._name.substring(3,1);
      this._parent.contents.gotoAndStop(contentFrame);
   }
}
tab1.bottomLine._visible = false;

tab1.onPress = function() {
   gotoAndStop("tab1");
};

tab2.onPress = function() {
   gotoAndStop("tab2");
};

tab3.onPress = function() {
   gotoAndStop("tab3");
};

hooked up some strict datatyping and also change “substr” to “substring”. To use a start and end point you have to use “substring”. for more info read this:
http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary698.html

No he chose the right method (substr parameters are start index and length) and strict data typing is not necessary. Your main probelm is that AS2 is case-sensitive so numberofTabs isn’t the same as numberOfTabs. Thus the condition for the loop never evaluates to false and the loop runs forever.

:+)

Oh i thought he was specifying an end point.

Also, good eyes Can, i didn’t see that case issue.

(the strict typing is just in there because its good practise)