# Code not working in AS2

**URL:** https://forum.kirupa.com/t/code-not-working-in-as2/166902
**Category:** Uncategorized
**Created:** [October 23, 2005, 10:27pm UTC](https://forum.kirupa.com/t/code-not-working-in-as2/166902 "2005-10-23T22:27:09Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![superprg](https://avatars.discourse-cdn.com/v4/letter/s/858c86/32.png) [@superprg](https://forum.kirupa.com/u/superprg)
#### Post date: [October 23, 2005, 10:27pm UTC](https://forum.kirupa.com/t/code-not-working-in-as2/166902/1 "2005-10-23T22:27:09Z")

</div>

Hi  
I have this code from  
[http://www.negatyve.net/EE/FScrollPaneForm/FScrollPaneForm.zip](http://www.negatyve.net/EE/FScrollPaneForm/FScrollPaneForm.zip)

[AS]  
pane\_sp.setScrollContent(“form”);  
h = pane\_sp.getScrollContent().\_height;  
trace(pane\_sp.getScrollContent().\_height);  
w = pane\_sp.getScrollContent().\_width;  
//trace("hPosition = " + pane\_sp.hPosition + ", vPosition = " + pane\_sp.vPosition);  
trace(h);  
elementCount = 1;  
morecheck\_pb.setClickHandler(“addCheckBox”);  
moreradio\_pb.setClickHandler(“addRadioButton”);  
moretext\_pb.setClickHandler(“addTextArea”);  
//myTimer=SetInterval(draw\_chart,200);  
//Call Draw Chart 50 times  
for(p=1;p\<50;p++)  
{  
draw\_chart();  
}  
function addCheckBox()  
{  
var sp = pane\_sp.getScrollContent();  
var mc = sp.attachMovie(“FCheckBoxSymbol”, “item” + elementCount, elementCount, {label:“new checkbox”});

mc.\_y = (h += mc.\_height + 10);  
mc.\_x = 10;

pane\_sp.refreshPane();  
elementCount++;  
}  
function addRadioButton()  
{  
var sp = pane\_sp.getScrollContent();  
var mc = sp.attachMovie(“FRadioButtonSymbol”, “item” + elementCount, elementCount, {label:“new radiobutton”});

mc.\_y = (h += mc.\_height + 10);  
mc.\_x = 10;

pane\_sp.refreshPane();  
elementCount++;

}  
function addTextArea()  
{  
var sp = pane\_sp.getScrollContent();  
var txt = [“item” + elementCount];  
sp.createTextField(txt, elementCount, 10, h += 10, 200, 100);  
h += 100;

sp[txt].border = true;  
sp[txt].background = true;  
sp[txt].text = “Some new Text”;  
sp[txt].type = “input”;

pane\_sp.refreshPane();  
elementCount++;  
}  
function draw\_chart()  
{  
w=w+40;  
var sp = pane\_sp.getScrollContent();  
// pane\_sp.hPageScrollSize = 2000;  
// pane\_sp.setScrollPosition(200+x,100+y)  
// sp.createEmptyMovieClip(“lines”, 1000);  
//var mc = sp.attachMovie(“FRadioButtonSymbol”, “item” + elementCount, elementCount, {label:“new radiobutton”});  
//trace("hPosition = " + pane\_sp.hPosition + ", vPosition = " + pane\_sp.vPosition);  
with(sp)  
{  
lineStyle(4, “0x000000”,100);  
moveTo(x,350);  
lineTo(x+20,350+30);  
lineTo(x+40,350);  
x=x+40;  
// y=10+y;  
}  
pane\_sp.refreshPane();  
}  
[/AS]  
This code is in AS1 from the original source. It doesnt works in AS2  
My application is in AS2  
When I changed the settings to AS1, this code works but most of the buttons got their text vanished and other strange things happened.  
Can anyone tell me what to do?
