PDA

View Full Version : scrollPane wont scroll


Viper400guitar
01-13-2008, 07:51 PM
I don't even know how to exsplain it so I attacked a copy of the flash Document in question.

I am using Flash 8.

I don't like how limited the Accordion Componet is, so I thought I would simply create my own. Not a Big problem untill I stuck a scrollPane Componet into the middle of my improvised Accordion. For some reason it wont actualy scroll. I probably made some newbie mistake because I am VERY NEW at this, I got Flash 8 two weeks ago and don't think I am doing that bad. But this scrollPane withen a "improvised Accordion" problem if very frustrating, If someone could tell me how stupid I am I would be very thankful.

Basically I have created 3 buttons, and they move up and down as they are clicked, a scrollPane, and an object that is off the stage and is needed for the onEnterFrame() function, because it doesn't seem to work with buttons.

To do this I use the following ActionScript, again I'm a beginer please dont rip me appart maybe just some pointers.

//Setting initial varriables
newButton1Y= 0;
newButton1X= 0;
newButton2Y= 327;
newButton2X= 0;
newButton3Y= 354;
newButton3X= 0;
newMyPaneY= 27;
newMyPaneX= 0;
newMyPaneContent= "content1";

//Function moving objects to variable posistions "smoothly",
//and changing contents of scrollPane instance "myPane"
onEnterObject.onEnterFrame=function(){
button1._y= button1._y-((button1._y-newButton1Y)/5);
button1._x= button1._x-((button1._x-newButton1X)/5);
button2._y= button2._y-((button2._y-newButton2Y)/5);
button2._x= button2._x-((button2._x-newButton2X)/5);
button3._y= button3._y-((button3._y-newButton3Y)/5);
button3._x= button3._x-((button3._x-newButton3X)/5);
myPane._y= myPane._y-((myPane._y-newMyPaneY)/5);
myPane._x= myPane._x-((myPane._x-newMyPaneX)/3);
myPane.contentPath= newMyPaneContent;
};

//Reassigning variables when buttons are pressed
button1.onRelease=function(){
newButton1Y= 0;
newButton2Y= 327;
newButton3Y= 354;
newMyPaneY= 27;
newMyPaneContent= "content1";
};
button2.onRelease=function(){
newButton1Y= 0;
newButton2Y= 27;
newButton3Y= 354;
newMyPaneY= 54;
newMyPaneContent= "content2";
};
button3.onRelease=function(){
newButton1Y= 0;
newButton2Y= 27;
newButton3Y= 54;
newMyPaneY= 84;
newMyPaneContent= "content3";
};

Again I would be very thankfull for any comments that could be helpfull to me, even if it is not about this problem, maybe you just want to give me pointer, 'cause I suck at this. Thanks in advance

Viper400guitar
01-13-2008, 09:39 PM
I made a newbie mistake as I thought, I had the Loaders contentPath reseting constantly, by placing it withn the function and not withen the buttons onRelease. the new code looks as such and works perfectly


//Setting initial varriables
newButton1Y= 0;
newButton1X= 0;
newButton2Y= 327;
newButton2X= 0;
newButton3Y= 354;
newButton3X= 0;
newMyPaneY= 27;
newMyPaneX= 0;
myPane.contentPath= "content1";

//Function moving objects to variable posistions "smoothly",
//and changing contents of scrollPane instance "myPane"
onEnterObject.onEnterFrame=function(){
button1._y= button1._y-((button1._y-newButton1Y)/5);
button1._x= button1._x-((button1._x-newButton1X)/5);
button2._y= button2._y-((button2._y-newButton2Y)/5);
button2._x= button2._x-((button2._x-newButton2X)/5);
button3._y= button3._y-((button3._y-newButton3Y)/5);
button3._x= button3._x-((button3._x-newButton3X)/5);
myPane._y= myPane._y-((myPane._y-newMyPaneY)/5);
myPane._x= myPane._x-((myPane._x-newMyPaneX)/3);
};

//Reassigning variables when buttons are pressed
button1.onRelease=function(){
newButton1Y= 0;
newButton2Y= 327;
newButton3Y= 354;
newMyPaneY= 27;
myPane.contentPath= "content1";
};
button2.onRelease=function(){
newButton1Y= 0;
newButton2Y= 27;
newButton3Y= 354;
newMyPaneY= 54;
myPane.contentPath= "content2";
};
button3.onRelease=function(){
newButton1Y= 0;
newButton2Y= 27;
newButton3Y= 54;
newMyPaneY= 84;
myPane.contentPath="content3";
};


Sorry for waisting 11 other people who looked at this threads time.