Copy link to clipboard
Copied
there is a TLF text(sourceText) , converted to movieclip(mc_Source), used as the Source for my scrollPane(scrollPane1).
I need to match the width of TLF text to the scrollPane. looks simple? But it just does not work!!!
Here is my complete code:
---------------------------------------------------------
var appBG:BG= new BG();
addChild(appBG);
/*****SET POSITION*********/
//Make sure the stage does not scale automatically since I want to do it manually
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
function setPosition():void
{
//Position Background
appBG.height = stage.stageHeight;
appBG.width = appBG.height;
//Position scrollPane1 to fit properly in center.
//Bring scrollPane1 in top of Background (appBG)
this.setChildIndex(scrollPane1, this.numChildren - 1);
//Fit the scrollPane1 in middle of screen
scrollPane1.width = stage.stageWidth * 0.9;
scrollPane1.height = stage.stageHeight * 0.8;
scrollPane1.x = stage.stageWidth * 0.05;
scrollPane1.y = stage.stageHeight * 0.1;
//Fit the text inside source movieclip (sourceText) to scrollPane size
mc_Source.width = scrollPane1.width;
mc_Source.height = scrollPane1.height;
mc_Source.x = scrollPane1.x;
mc_Source.y = scrollPane1.y;
//Fit the source movieclip for ScrollPane (mc_Source) to scrollPane size
mc_Source.sourceText.width = scrollPane1.width;
mc_Source.sourceText.height = scrollPane1.height;
mc_Source.sourceText.x = scrollPane1.x;
mc_Source.sourceText.y = scrollPane1.y;
if (stage.stageWidth > stage.stageHeight)
{
appBG.width = stage.stageWidth;
appBG.height = appBG.width;
}
appBG.x = stage.stageWidth / 2;
appBG.y = stage.stageHeight / 2;
}
stage.addEventListener(Event.RESIZE, resizeLayout);
function resizeLayout(e:Event):void
{
setPosition();
}
setPosition();
---------------------------------------------------------
What am I doing wrong?
- I get no errors.
- When i change the width and hight of swf file, the BG match perfectly, also the scrollPane reposition perfectly, and it scrolls the text.
BUT the text is not located in the proper place and also the text does not grow in width (like BG and scrollPane) when I enlarge the swf window, to fit the scrollPane area.
Copy link to clipboard
Copied
No answers?
Find more inspiration, events, and resources on the new Adobe Community
Explore Now