all groups > flash actionscript > december 2005 >
You're in the

flash actionscript

group:

scrollpane


scrollpane stepsi
12/15/2005 6:21:52 PM
flash actionscript:
Hi,

My problem is simple but I don't have any solution.

I create a scrollpane and I attach a movie inside named test1:

mc_scrollPane.spContentHolder.attachMovie("test", "test1", 3);

It's working, I see the scrollbar.

After that I move the MovieClip test1:

mc_scrollPane.spContentHolder.test1._y = 300;

I'd like to update the vertical scroll, How can I do it ?

The swf (click on the button to move the movieClip and see my problem):
http://www.soundstep.com/temp/menu2.swf

Thanks for your help.

Stepsi
Re: scrollpane stepsi
12/15/2005 10:31:07 PM
no idea or didn't you understand my problem?

Re: scrollpane micia
12/16/2005 8:51:15 AM
Hi
I had the same problem and the solution is to reset the pan size after the
content change
like this:

pan_mc.setSize(pan_mc._height , pan_mc._width)

this istruction seems to be unusefull but it works, because it reset the
scrolling pane on its new height
it must be executed after the content change

bye
Linda



Re: scrollpane micia
12/16/2005 9:00:20 AM
sorry:

Re: scrollpane stepsi
12/16/2005 11:14:19 AM
It doesn't work for me because it resizes the whole scrollpane and I can't do
it.

I have a solution but I don't like very much: change the height of a invisible
movie inside the scrollpane to change the vertical scroll.

I'd prefer find a better solution with a listener and another instruction.
Re: scrollpane rlc5611
12/16/2005 2:38:12 PM
If all you want to do is move within the pane (Flash 7 or 8), have you tried
looking into

mc_scrollPane.vPosition = 300;

I don't think this is what you are asking but I will mention it.

if you change the contents of the container clip so that it is a different
size than what the pane started with, you need to redraw the pane

mc_scrollPane.redraw(true);

so that the scrollbars can recalculate themselves according to the new size
Re: scrollpane stepsi
12/16/2005 3:38:14 PM
yes I tried, this information doesn't solve my problem but thank you for the precision :)

Re: scrollpane rlc5611
12/16/2005 4:35:22 PM
You should not use refreshPane in Flash 7 or Flash 8 scrollpane. That method
only works for the Flash 6 scrollpane. For Flash 7 or 8, its equivalent is
redraw(true);

I tried this based on what you wrote and it seems to work fine:

mc_scrollPane.spContentHolder.attachMovie("test1", "test1", 3);
mc_scrollPane.spContentHolder.test1._y = 300;
mc_scrollPane.redraw(true);
mc_scrollPane.vPosition = 300;
Re: scrollpane stepsi
12/16/2005 5:51:33 PM
Oh yes it's working perfectly, you find the solution but there's something very
strange. Now it's working without use redraw or whatever. I don't understand,
loot at this code (only the level change):

working:

mc_scrollPane.spContentHolder.attachMovie("languages", "tit_languages", 3); //
only a movie with a texte inside
mc_scrollPane.spContentHolder.attachMovie("test", "test1", 4);
mc_scrollPane.spContentHolder.test1._y = 1000;

not working:

mc_scrollPane.spContentHolder.attachMovie("test", "test1", 3);
mc_scrollPane.spContentHolder.test1._y = 1000;

not working:

mc_scrollPane.spContentHolder.attachMovie("test", "test1", 4);
mc_scrollPane.spContentHolder.test1._y = 1000;

I think the scrollpane need a reference movie at the top of the scrollpane and
after that you can move all the things you want, the scrollpane will be upadted
without do nothing.

nothing special in the precedent levels:
attachMovie("background", "mc_background", 1);
mc_scrollPane = createClassObject(mx.containers.ScrollPane, "mc_scrollPane1",
2);

what do you think ? Is there something I didn't understand with the scrollpane
?

Re: scrollpane stepsi
12/16/2005 8:34:41 PM
Now I have a problem with a mask, I use "setMask" on a movie (the scrollpane is
inside) and after the mask I don't see the vertical scroll anymore :/ any
solution for me ?

I show you my code:
////////////////////////////////////////////////////////
// menu2 - Computer Skills /////////////////////////////
////////////////////////////////////////////////////////

var text_format:TextFormat = new TextFormat();
text_format.font = "arial";

///////////////////////////////////
// skin scrollPane ////////////////
///////////////////////////////////

mx.controls.scrollClasses.ScrollBar.prototype.upArrowUpName =
"scrollbar_arrowup_mc";
mx.controls.scrollClasses.ScrollBar.prototype.upArrowOverName
="scrollbar_arrowup_mc";
mx.controls.scrollClasses.ScrollBar.prototype.upArrowDownName =
"scrollbar_arrowup_mc";

mx.controls.scrollClasses.ScrollBar.prototype.downArrowUpName =
"scrollbar_arrowdown_mc";
mx.controls.scrollClasses.ScrollBar.prototype.downArrowOverName =
"scrollbar_arrowdown_mc";
mx.controls.scrollClasses.ScrollBar.prototype.downArrowDownName =
"scrollbar_arrowdown_mc";

mx.controls.scrollClasses.ScrollBar.prototype.scrollTrackName =
"scrollbar_fond_mc";
mx.controls.scrollClasses.ScrollBar.prototype.scrollTrackDownName =
"scrollbar_fond_mc";
mx.controls.scrollClasses.ScrollBar.prototype.scrollTrackUpName =
"scrollbar_fond_mc";

mx.controls.scrollClasses.ScrollBar.prototype.thumbGripName = "";
mx.controls.scrollClasses.ScrollBar.prototype.thumbTopName = "scrollbar_mc";
mx.controls.scrollClasses.ScrollBar.prototype.thumbMiddleName = "scrollbar_mc";
mx.controls.scrollClasses.ScrollBar.prototype.thumbBottomName = "scrollbar_mc";

///////////////////////////////////
// function start menu2 ///////////
///////////////////////////////////
start_menu2();

function start_menu2() {

createEmptyMovieClip("fond", 0);

// I start to build
fond.attachMovie("background", "mc_background", 1);
fond.mc_background._x = 375;
fond.mc_background._y = 260;

// scrollPane
fond.mc_scrollPane = createClassObject(mx.containers.ScrollPane,
"mc_scrollPane1", 2);

fond.mc_scrollPane.contentPath = "mc_content";
fond.mc_scrollPane.move(65,80);
fond.mc_scrollPane.setSize(620,360);
fond.mc_scrollPane.hScrollPolicy = "off";
fond.mc_scrollPane.vScrollPolicy = "Auto";
fond.mc_scrollPane.setStyle("borderStyle", "none");

// next step: I build the content
build_content();
}

///////////////////////////////////
// function build content /////////
///////////////////////////////////
function build_content() {
// title
fond.mc_scrollPane.spContentHolder.attachMovie("languages", "tit_languages",
3);
fond.mc_scrollPane.spContentHolder.tit_languages._x = 100;
fond.mc_scrollPane.spContentHolder.tit_languages._y = 15;
// content

fond.mc_scrollPane.spContentHolder.createTextField("con_languages",4,0,20,200,2
00);
fond.mc_scrollPane.spContentHolder.con_languages.html = true;
fond.mc_scrollPane.spContentHolder.con_languages.multiline = true;
fond.mc_scrollPane.spContentHolder.con_languages.wordWrap = true;
fond.mc_scrollPane.spContentHolder.con_languages.selectable = true;
fond.mc_scrollPane.spContentHolder.con_languages.styleSheet = styles;
fond.mc_scrollPane.spContentHolder.con_languages.htmlText += '<span
class="st_content_skills">HTML, XHTML (6 years)</span><br>';
fond.mc_scrollPane.spContentHolder.con_languages.htmlText += '<span
class="st_content_skills">DHTML (6 years)</span><br/>';
fond.mc_scrollPane.spContentHolder.con_languages.htmlText += '<span
class="st_content_skills">CSS 2 (6 years)</span><br/>';
fond.mc_scrollPane.spContentHolder.con_languages.htmlText += '<span
class="st_content_skills">Javascript (6 years)</span><br/>';
fond.mc_scrollPane.spContentHolder.con_languages.htmlText += '<span
class="st_content_skills">Ajax (6 years)</span><br/>';
fond.mc_scrollPane.spContentHolder.con_languages.htmlText += '<span
class="st_content_skills">ActionScript 2 (6 years)</span><br/>';
fond.mc_scrollPane.spContentHolder.con_languages.htmlText += '<span
class="st_content_skills">PHP (6 years)</span><br/>';
fond.mc_scrollPane.spContentHolder.con_languages.htmlText += '<span
class="st_content_skills">XML (6 years)</span><br/>';
fond.mc_scrollPane.spContentHolder.con_languages.htmlText += '<span
class="st_content_skills">XSLT (6 years)</span>';

fond.mc_scrollPane.spContentHolder.attachMovie("test", "test1", 5);
fond.mc_scrollPane.spContentHolder.test1._y = 400;

// I create the mask
createEmptyMovieClip('mask1', 6);
fond.setMask(mask1);

// I call the function to anim the mask
animIndex = 0;
mWidth = 620;
mHeight = 500;
animInt = setInterval(mask_animation, 30);
}

///////////////////////////////////
// function mask animation ////////
///////////////////////////////////
function mask_animation() {
var c = mask1;
if(animIndex < 15) {
var f = animIndex/15;
f = (Math.sin(f*Math.PI/2) + 0.2*Math.sin(f*3*Math.PI/2))*1.25;
with(c) {
clear();
beginFill(0x000000);
lineTo(mWidth,0);
lineTo(mWidth,f*20);
curveTo(mWidth/2,f*(mHeight/2),0,f*10);
endFill();
}
}

else if (animIndex < 40) {
var f = (animIndex-15)/25;
f = (Math.sin(f*Math.PI/2) + 0.2*Math.sin(f*3*Math.PI/2))*1.25;
with(c) {
clear();
beginFill(0x000000);
lineTo(mWidth,0);
lineTo(mWidth,f*(mHeight/3*2));
curveTo(mWidth/2,125-f*50,0,f*mHeight);
endFill();
}
}
else if (animIndex <= 55) {
var f = (animIndex-40)/15;
f = (Math.sin(f*Math.PI/2) + 0.2*Math.sin(f*3*Math.PI/2))*1.25;
with(c) {
clear();
beginFill(0x000000);
lineTo(mWidth,0);
lineTo(mWidth,(mHeight-40)+40*f);
curveTo(mWidth/2,100+(mHeight-100)*f,0,(mHeight-30)+30*f);
endFill();
}
}
if(animIndex > 60) {
animIndex = 0;
clearInterval(animInt);
}
animIndex++;
}


Re: scrollpane catapop
12/21/2005 5:48:47 PM
Originally posted by: rlc5611
You should not use refreshPane in Flash 7 or Flash 8 scrollpane. That method
only works for the Flash 6 scrollpane. For Flash 7 or 8, its equivalent is
redraw(true);

I tried this based on what you wrote and it seems to work fine:


what is spContentHolder ????

Re: scrollpane rlc5611
12/27/2005 4:52:46 PM
[quoted text, click to view]

Sorry I have been on vacation (still am and don?t have access to Flash).

The scrollpane has/creates a movieclip that it uses to hold its content. The
scrollpane itself is a movieclip and the thing inside that is masked and
scrolls is a child clip of the pane. Normally you don?t need to know that if
all you want to do is load content into the pane. If you want to modify that
content with AS, you need to know its name in order to target it. The child
clip that holds the pane?s content for Flash 6 is "tmp_mc" and for Flash 7 & 8,
its name is "spContentHolder". No matter what you load into the pane, it will
get the name of the child clip mentioned above and that name needs to be
included in the path in order to target your content.
AddThis Social Bookmark Button