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

**URL:** <https://forum.kirupa.com/t/my-actionscript-not-working-when-published-works-in-flash-6-not-in-flash-8/184405>\
**Category:** Uncategorized\
**Created:** [April 4, 2006, 10:36pm UTC](https://forum.kirupa.com/t/my-actionscript-not-working-when-published-works-in-flash-6-not-in-flash-8/184405 "2006-04-04T22:36:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Flash\_Boi](https://avatars.discourse-cdn.com/v4/letter/f/b5ac83/32.png) [@Flash\_Boi](https://forum.kirupa.com/u/Flash_Boi)\
**Post date:** [April 4, 2006, 10:36pm UTC](https://forum.kirupa.com/t/my-actionscript-not-working-when-published-works-in-flash-6-not-in-flash-8/184405/1 "2006-04-04T22:36:25Z")

</div>

Hi,

I have this file which I created from [http://www.tutorialized.com/tutorial...entation/11499](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?

---

<div class="post-metadata">

**Author:** ![jonybigude](https://avatars.discourse-cdn.com/v4/letter/j/fbc32d/32.png) [@jonybigude](https://forum.kirupa.com/u/jonybigude)\
**Post date:** [April 5, 2006, 10:22am UTC](https://forum.kirupa.com/t/my-actionscript-not-working-when-published-works-in-flash-6-not-in-flash-8/184405/2 "2006-04-05T10:22:50Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![Flash\_Boi](https://avatars.discourse-cdn.com/v4/letter/f/b5ac83/32.png) [@Flash\_Boi](https://forum.kirupa.com/u/Flash_Boi)\
**Post date:** [April 5, 2006, 4:55pm UTC](https://forum.kirupa.com/t/my-actionscript-not-working-when-published-works-in-flash-6-not-in-flash-8/184405/3 "2006-04-05T16:55:21Z")

</div>

> [@jonybigude](#):
>
> 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!

---

<div class="post-metadata">

**Author:** ![JoshuaJonah](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joshuajonah/32/1775_2.png) [@JoshuaJonah](https://forum.kirupa.com/u/JoshuaJonah)\
**Post date:** [April 5, 2006, 5:09pm UTC](https://forum.kirupa.com/t/my-actionscript-not-working-when-published-works-in-flash-6-not-in-flash-8/184405/4 "2006-04-05T17:09:33Z")

</div>

```auto
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](http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary698.html)

---

<div class="post-metadata">

**Author:** ![TheCanadian](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@TheCanadian](https://forum.kirupa.com/u/TheCanadian)\
**Post date:** [April 5, 2006, 6:22pm UTC](https://forum.kirupa.com/t/my-actionscript-not-working-when-published-works-in-flash-6-not-in-flash-8/184405/5 "2006-04-05T18:22:17Z")

</div>

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 _number **o** fTabs_ isn’t the same as _number **O** fTabs_. Thus the condition for the loop never evaluates to false and the loop runs forever.

:+)

---

<div class="post-metadata">

**Author:** ![JoshuaJonah](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joshuajonah/32/1775_2.png) [@JoshuaJonah](https://forum.kirupa.com/u/JoshuaJonah)\
**Post date:** [April 5, 2006, 6:36pm UTC](https://forum.kirupa.com/t/my-actionscript-not-working-when-published-works-in-flash-6-not-in-flash-8/184405/6 "2006-04-05T18:36:39Z")

</div>

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)
