Using Blixt Scrollbar With Auto Height Textfield
Can anyone help me figure out what I'm doing wrong here? I want to use a Blixt's scrollbar to scroll a dynamic textfield that's is set to a autosizing height....And I'm having problems. I though I had finally found my perfect scrollbar.... it's so close!sorry about the filename, I was really frustrated...If you've used Blixt's scrollbar before...help me out!
KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 06-21-2007, 10:58 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Loading Img From Xml, Textfield.height, Scrollbar
Hi,
I am loading xml and using Colin Moock's scrollbar as he desrcibes it in Essential Actionscript 3.0. It all worked fine until I tried to put a link to a jpg inside the xml.
Where other html tags give no problem, the img seems to mess with the textfield height. I gave the textfield a fixed height but when I try to scroll the field with the image, and trace the textfield height, it increases more and more when I scroll down, messing up the scrollbar.
the img tag looks like this (and it loads fine into the textfield):
Code:
<IMG ALIGN= "left" SRC='pics/portret.jpg' WIDTH="200" HEIGHT="207" HSPACE='0' VSPACE='10' />
The slightly adapted scrollbar class looks like this (I gave the scrolltrack a fixed height and tried to give t.height a fixed height too within this class but tracing t.height keeps showing that it is increasing while scrolling down):
Code:
package {
import flash.display.*;
import flash.text.*;
import flash.events.*;
import flash.utils.*;
import flash.geom.*;
public class ScrollBar extends Sprite {
private var t:TextField;
private var tHeight:Number;
private var scrollTrack:ScrollTrack;
private var scrollThumb:ScrollThumb;
private var dragging:Boolean = false;
// A flag indicating whether the scrollbar should be redrawn at the next
// scheduled screen update
private var changed:Boolean = false;
private static const SPACING: uint=3;
private var scrollThumbMaxY:Number;
private var scrollThumbY:Number;
private static const SCROLLTRACK_HEIGHT=395;
public function ScrollBar (textfield:TextField,page:uint) {
t = textfield;
tHeight = t.height;
scrollTrack = new ScrollTrack();
addChild(scrollTrack);
scrollThumb = new ScrollThumb();
addChild(scrollThumb);
scrollThumb.buttonMode=true;
t.addEventListener(Event.SCROLL, scrollListener);
scrollThumb.addEventListener(MouseEvent.MOUSE_DOWN,mouseDownListener);
var stageDetector:StageDetector = new StageDetector(this);
stageDetector.addEventListener(StageDetector.ADDED_TO_STAGE,
addedToStageListener);
stageDetector.addEventListener(StageDetector.REMOVED_FROM_STAGE,
removedFromStageListener);
addEventListener(Event.ENTER_FRAME, enterFrameListener);
changed = true;
}
private function addedToStageListener (e:Event):void {
stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpListener);
stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveListener);
}
private function removedFromStageListener (e:Event):void {
stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpListener);
stage.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveListener);
}
private function enterFrameListener (e:Event):void {
if (t.height != tHeight) {
changed = true;
tHeight = t.height;
if (dragging) {
scrollThumb.stopDrag();
dragging = false;
}
}
if (changed) {
updateScrollbar();
changed = false;
}
}
private function scrollListener (e:Event):void {
if (t.scrollV > t.maxScrollV) {
return;
}
if (!dragging) {
changed = true;
}
}
public function updateScrollbar ():void {
scrollTrack.x = t.x + t.width+SPACING;
scrollTrack.y = t.y;
scrollTrack.height =395;
var numVisibleLines:int = t.bottomScrollV - (t.scrollV-1);
if (numVisibleLines < t.numLines) {
scrollThumb.visible = true;
scrollTrack.visible = true;
scrollThumb.x = t.x + t.width+SPACING-0.6;
scrollThumb.y = t.y + (scrollTrack.height-scrollThumb.height)
* ((t.scrollV-1)/(t.maxScrollV-1));
} else {
scrollThumb.visible = false;
scrollTrack.visible = false;
}
}
public function synchTextToScrollThumb ():void {
scrollThumbMaxY = t.height-scrollThumb.height -15;
scrollThumbY = scrollThumb.y-t.y;
t.scrollV = Math.round(t.maxScrollV
* (scrollThumbY/scrollThumbMaxY));
trace(tHeight);
}
private function mouseDownListener (e:MouseEvent):void {
var bounds:Rectangle = new Rectangle(t.x + t.width+SPACING-0.6,
t.y,
0,
t.height-scrollThumb.height-15);
scrollThumb.startDrag(false, bounds);
//MainMenu.MainMenuRoot._symbolHolder.updatePosition();
dragging = true;
}
private function mouseUpListener (e:MouseEvent):void {
if (dragging) {
synchTextToScrollThumb();
scrollThumb.stopDrag();
//MainMenu.MainMenuRoot._symbolHolder.pauseTweener();
dragging = false;
}
}
private function mouseMoveListener (e:MouseEvent):void {
if (dragging) {
synchTextToScrollThumb();
}
}
}
}
So I think that the code or flash doesn't handle the img very well, but i could be on the wrong (scroll)track. Getting pretty desperate here :confused: , so any iseas are very welcome!
Thanks,
Jerryj.
[textfield] How To Check If Input Text Is More Than Textfield Height?
Hi guys, Is there a way to check if the text that has been input into the textfield is more than the height of the textfield.
I have set the scrollbar hidden and it will become unhidden once the text is greater the the textfield height.
I did try to count the input text and set the visiblity of the scrollbar against that count. Unfortunatly this is unreliable.
Anyone got a better idea?
Cheers
Paul
[textfield] How To Check If Input Text Is More Than Textfield Height?
Hi guys, Is there a way to check if the text that has been input into the textfield is more than the height of the textfield.
I have set the scrollbar hidden and it will become unhidden once the text is greater the the textfield height.
I did try to count the input text and set the visiblity of the scrollbar against that count. Unfortunatly this is unreliable.
Anyone got a better idea?
Cheers
Paul
Auto Height On Embedded Swf
Hi. I am building a dynamic flash form, with lots of dropdowns.
The number of dropdowns come from the database. It could be 2. It could be 20.
Is there a way that the embedded flash movie is whatever height it needs to be.
So the scroll bar on the brower would keep getting bigger, rather than needing to make it a fixed size and have a scroll bar in the flash movie?
M@)
Auto Height A Text Box
I am after knowing where I can add or how I can add an auto height to a dynamic text box.
Can any one help me on this
Auto Height On Embedded Swf
Hi. I am building a dynamic flash form, with lots of dropdowns.
The number of dropdowns come from the database. It could be 2. It could be 20.
Is there a way that the embedded flash movie is whatever height it needs to be.
So the scroll bar on the brower would keep getting bigger, rather than needing to make it a fixed size and have a scroll bar in the flash movie?
M@)
Cant Get Textfield Height From AutoSized Textfield
Afternoon guys.
I am creating a new nwe3s blogger. Instead of relying on a scrollbar to scroll the news story i thought i would use
code: textField.autosize="left"
This works fine...
At present i am loading x amount of news into flash at any one time. I am placing the news story underneath each other using
code:
holder.attachMovie ("newsMc", "news" + i, i);
holder['news' + i]._y = nextY;
nextY += Math.ceil (holder['news' + i]._height) + 2;
this is fine...
But when i use
code: textField.autosize="left"
nextY retains it's orginal height even though some of the news stories have made for higher textfields.
I thought i could pull the height from the previuosly created news holder
code:
if (i > 0) {
j = i - 1;
trace (j + " text height=" + holder['news' + j].newsStory._height);
if (holder['news' + j].newsStory._height > 184) {
nextY += Math.ceil (holder['news' + j]._height) + 2;
} else {
nextY += Math.ceil (holder['news' + j]._height) + 2;
trace ("nextY=" + nextY);
}
But this still returns the intial height
Here is the complete code
code:
for (i = 0; i < this.newsCount; i++) {
holder.attachMovie ("newsMc", "news" + i, i);
holder['news' + i]._y = nextY;
holder['news' + i].newsTitle.text = this['news' + i + 'newsTitle'];
holder['news' + i].newsDate.text = "Submitted: " + this['news' + i + 'newsDate'];
holder['news' + i].newsStory.htmlText = this['news' + i + 'newsStory'];
nextY += Math.ceil (holder['news' + i]._height) + 2;
if (i > 0) {
j = i - 1;
trace (j + " text height=" + holder['news' + j].newsStory._height);
if (holder['news' + j].newsStory._height > 184) {
nextY += Math.ceil (holder['news' + j]._height) + 2;
} else {
nextY += Math.ceil (holder['news' + j]._height) + 2;
trace ("nextY=" + nextY);
}
}
unloadMovie (dtLoader);
viser._visible = 0;
}
Cant Get Textfield Height From AutoSized Textfield
Afternoon guys.
I am creating a new nwe3s blogger. Instead of relying on a scrollbar to scroll the news story i thought i would use
ActionScript Code:
textField.autosize="left"
This works fine...
At present i am loading x amount of news into flash at any one time. I am placing the news story underneath each other using
ActionScript Code:
holder.attachMovie ("newsMc", "news" + i, i);
holder['news' + i]._y = nextY;
nextY += Math.ceil (holder['news' + i]._height) + 2;
this is fine...
But when i use
ActionScript Code:
textField.autosize="left"
nextY retains it's orginal height even though some of the news stories have made for higher textfields.
I thought i could pull the height from the previuosly created news holder
ActionScript Code:
if (i > 0) {
j = i - 1;
trace (j + " text height=" + holder['news' + j].newsStory._height);
if (holder['news' + j].newsStory._height > 184) {
nextY += Math.ceil (holder['news' + j]._height) + 2;
} else {
nextY += Math.ceil (holder['news' + j]._height) + 2;
trace ("nextY=" + nextY);
}
But this still returns the intial height
Here is the complete code
ActionScript Code:
for (i = 0; i < this.newsCount; i++) {
holder.attachMovie ("newsMc", "news" + i, i);
holder['news' + i]._y = nextY;
holder['news' + i].newsTitle.text = this['news' + i + 'newsTitle'];
holder['news' + i].newsDate.text = "Submitted: " + this['news' + i + 'newsDate'];
holder['news' + i].newsStory.htmlText = this['news' + i + 'newsStory'];
nextY += Math.ceil (holder['news' + i]._height) + 2;
if (i > 0) {
j = i - 1;
trace (j + " text height=" + holder['news' + j].newsStory._height);
if (holder['news' + j].newsStory._height > 184) {
nextY += Math.ceil (holder['news' + j]._height) + 2;
} else {
nextY += Math.ceil (holder['news' + j]._height) + 2;
trace ("nextY=" + nextY);
}
}
unloadMovie (dtLoader);
viser._visible = 0;
}
Cant Get Textfield Height From AutoSized Textfield
Afternoon guys.
I am creating a new nwe3s blogger. Instead of relying on a scrollbar to scroll the news story i thought i would use
ActionScript Code:
textField.autosize="left"
This works fine...
At present i am loading x amount of news into flash at any one time. I am placing the news story underneath each other using
ActionScript Code:
</p>
<p>holder.attachMovie ("newsMc", "news" + i, i);</p>
<p>holder['news' + i]._y = nextY;</p>
<p>nextY += Math.ceil (holder['news' + i]._height) + 2;</p>
<p>
this is fine...
But when i use
ActionScript Code:
textField.autosize="left"
nextY retains it's orginal height even though some of the news stories have made for higher textfields.
I thought i could pull the height from the previuosly created news holder
ActionScript Code:
</p>
<p>if (i > 0) {</p>
<p>j = i - 1;</p>
<p>trace (j + " text height=" + holder['news' + j].newsStory._height);</p>
<p>if (holder['news' + j].newsStory._height > 184) {</p>
<p>nextY += Math.ceil (holder['news' + j]._height) + 2;</p>
<p>} else {</p>
<p>nextY += Math.ceil (holder['news' + j]._height) + 2;</p>
<p>trace ("nextY=" + nextY);</p>
<p>}</p>
<p>
But this still returns the intial height
Here is the complete code
ActionScript Code:
</p>
<p>for (i = 0; i < this.newsCount; i++) {</p>
<p> holder.attachMovie ("newsMc", "news" + i, i);</p>
<p> holder['news' + i]._y = nextY;</p>
<p> holder['news' + i].newsTitle.text = this['news' + i + 'newsTitle'];</p>
<p> holder['news' + i].newsDate.text = "Submitted: " + this['news' + i + 'newsDate'];</p>
<p> holder['news' + i].newsStory.htmlText = this['news' + i + 'newsStory'];</p>
<p> nextY += Math.ceil (holder['news' + i]._height) + 2;</p>
<p> if (i > 0) {</p>
<p> j = i - 1;</p>
<p> trace (j + " text height=" + holder['news' + j].newsStory._height);</p>
<p> if (holder['news' + j].newsStory._height > 184) {</p>
<p> nextY += Math.ceil (holder['news' + j]._height) + 2;</p>
<p> } else {</p>
<p> nextY += Math.ceil (holder['news' + j]._height) + 2;</p>
<p> trace ("nextY=" + nextY);</p>
<p> }</p>
<p> }</p>
<p> unloadMovie (dtLoader);</p>
<p> viser._visible = 0;</p>
<p>}</p>
<p>
Cant Get Textfield Height From AutoSized Textfield
Afternoon guys.
I am creating a new nwe3s blogger. Instead of relying on a scrollbar to scroll the news story i thought i would use
ActionScript Code:
textField.autosize="left"
This works fine...
At present i am loading x amount of news into flash at any one time. I am placing the news story underneath each other using
ActionScript Code:
holder.attachMovie ("newsMc", "news" + i, i);
holder['news' + i]._y = nextY;
nextY += Math.ceil (holder['news' + i]._height) + 2;
this is fine...
But when i use
ActionScript Code:
textField.autosize="left"
nextY retains it's orginal height even though some of the news stories have made for higher textfields.
I thought i could pull the height from the previuosly created news holder
ActionScript Code:
if (i > 0) {
j = i - 1;
trace (j + " text height=" + holder['news' + j].newsStory._height);
if (holder['news' + j].newsStory._height > 184) {
nextY += Math.ceil (holder['news' + j]._height) + 2;
} else {
nextY += Math.ceil (holder['news' + j]._height) + 2;
trace ("nextY=" + nextY);
}
But this still returns the intial height
Here is the complete code
ActionScript Code:
for (i = 0; i < this.newsCount; i++) {
holder.attachMovie ("newsMc", "news" + i, i);
holder['news' + i]._y = nextY;
holder['news' + i].newsTitle.text = this['news' + i + 'newsTitle'];
holder['news' + i].newsDate.text = "Submitted: " + this['news' + i + 'newsDate'];
holder['news' + i].newsStory.htmlText = this['news' + i + 'newsStory'];
nextY += Math.ceil (holder['news' + i]._height) + 2;
if (i > 0) {
j = i - 1;
trace (j + " text height=" + holder['news' + j].newsStory._height);
if (holder['news' + j].newsStory._height > 184) {
nextY += Math.ceil (holder['news' + j]._height) + 2;
} else {
nextY += Math.ceil (holder['news' + j]._height) + 2;
trace ("nextY=" + nextY);
}
}
unloadMovie (dtLoader);
viser._visible = 0;
}
Text Box Auto Expand Height - HELP
I am trying to get a dynamic text box, with a fixed width, to automatically expand its height to accomodate the amount of content being loaded. Is this possible. It seems like it should be a really simple thing.
Please help
Thank you
Auto Stretch Dynamic TextBox Height
Hi,
How can I make a dynamic test box stretch in height to the ammount of copy that gets sucked in from the database?
Currently it just cuts of at the bottom of the box that I've manually pulled down.
This is probably something stupid, but I just can't find a sollution yet.
Thanks in advance
Auto Height On Dynamic Text Field
Hi all
I have a small SWF file which loads text for an associated loaded movie clips. The text length can vary and at the minute I am duplicating the FLA's so that each movie has its 'own' text loader file mc. The reason why I am doing it this way is because I need the scrollbar to appear or not based on the amount of text that is loaded and I am currently disabling/enabling the scrollbar manually and then savin/publishing the SWF's file.
How can I get my text loader file to display/adjust the height of the dynamic text box/scrollbar automatically?
I have posted some code below in the hop ethat it is easy enough for some guru out there to provide a solution.
Attach Code
// This is the code that is executed when the text loader swf is called
function textLoader() {
myData = new LoadVars();
myData.onLoad = function() {
scrollpane_mc.txt.myText_txt.html = true;
scrollpane_mc.txt.myText_txt.htmlText = this.details;;
};
myData.load("text/amec.txt");
}
var myCSS = new TextField.StyleSheet();
myCSS.load("css/myStyle.css");
myCSS.onLoad = function() {
scrollpane_mc.txt.myText_txt.styleSheet = myCSS;
textLoader();
};
// this is my scrolling code
txt.setMask(mask);
scrollbar.onMouseDown = function() {
if (this.hitTest(_root._xmouse, _root._ymouse) && txt._height>mask._height) {
this.startDrag(false, scrollbarBG._x, scrollbarBG._y, scrollbarBG._x, scrollbarBG._height-this._height)
txt.onEnterFrame = scrollThumbs;
dragging = true
}
};
scrollbar.onMouseUp = function() {
stopDrag();
dragging = false;
delete this.onEnterFrame;
};
function scrollThumbs() {
var funkyVar = -this._parent.scrollbar._y*(((this._height-this._parent.scrollbar._height)/(this._parent.scrollbarBG._height-this._parent.scrollbar._height))-1)
this.Y = (funkyVar-this._y)*.2;
this._y += this.Y;
if(Math.abs(funkyVar-this._y)<1 && !dragging){
delete this.onEnterFrame
}
}
Dynamic Text - Auto Sizing The Height?
Dear All
I have several dynamic text fields that are going to be in a column. I am going to use these fields with xml files for the user to update. Hence I don't really know how long the text is going to be. I can set a max size by creating a dynmaic text box that has several lines. However, if the user only inserts a few words I am gonig to be left with a lot of empty space a the bottom of the text box.
HOw do I set the text box so that its size automatically adjusts up and down to the size of the text that's going into it.
Many thanks
Edward
Flash Header: Width 100%; Height Auto
I want to make a flash header for a website. The Flash movie should be displayed at the top of the page with 100% width. The rest of the html site should appear right under the flash movie.
The problem is that I'm just not getting it to work...
Isn't it possible? I tried almost everything:
Scalemode noBorder didn't work because the size is set by the smaller side of the window but the height should only be set proportionally to the width of the browser.
I also tried noScale and setting the stage with AS:
Stage.align = "LT";
Stage.scaleMode = "noScale";
_quality = "best";
var verhaeltnis = this._height / this._width;
this._width = Stage.width;
this._height = verhaeltnis * Stage.width;
but that also didn't work. In the html I set width and height to 100%.
The problems I got: In Firefox the height always was around 200px, but I didn't set this in any place...
In IE the browser always fills up the rest of the height with nothing. When you scroll down one site the rest of the html appears...
Here is a picture of how I want the site to be: http://mitglied.lycos.de/jaykob/stuff/flash-header.jpg
Auto Height A Dynamic Text Field
I have a dynmaic text field with a set width. How do I make with an auto heigh to when I load any amount of text into it, its height chages to fit the text (without adding a scroller)
thx in advance
Set Height Of Mc Same As Textfield
Hi all,
I'm working on a dynamic menu that automaticly generate the items and is easy to customize.
Now i've got a little problem and i don't see why it won't work?!
This is my code:
Code:
//Stylesheet
css_button = new TextFormat();
css_button.bold = bold;
css_button.font = "Cottingley";
css_button.size = 12;
css_button.color = "0xFF0000";
//menu items
total = 7;
text1 = "Werken bij United Restart";
text2 = "Persberichten";
text3 = "Aanvraag financieel jaarverslag USG";
text4 = "United Service Group";
text5 = "Plaatsings-percentage en doorlooptijden";
text6 = "Downloads";
text7 = "Privacy regelement";
stop();
//initialize main menu
for (i=1; i<=_root.total; ++i) {
//duplicate movie clip
menuMC.duplicateMovieClip("menuMC"+i, i);
//create a dynamic textfield
this["menuMC"+i].createTextField("txtf", 1, 15, 0, 128, 19.6);
//Add stylesheet to button texts
this["menuMC"+i].txtf.setNewTextFormat (_root.css_button);
this["menuMC"+i].txtf.text = eval("_root.text" + i);
//Textfield specs
this["menuMC"+i].txtf.autoSize = true;
this["menuMC"+i].txtf.wordWrap = true;
this["menuMC"+i].txtf.multiline = true;
//Change Depths so hitarea is on top of the generated textField
this["menuMC"+i].hitarea.swapDepths(2);
//set Height Menu items same as height of the item's texts
this["menuMC"+i].bg_button._height = this["menuMC"+i].txtf._height;
//set Height hitarea same as height of the item's texts
this["menuMC"+i].hitarea._height = this["menuMC"+i].txtf._height;
//set new position
this["menuMC"+i]._y = this["menuMC"+(i-1)]._y + this["menuMC"+(i-1)]._height+2;
this["menuMC"+i].choice = i;
}
The bold part is what is causing me a headache. I want to set the height of the hitarea (like i did with the background of the menu items) the same as the textfield height, but somehow this doen't work?!?
I've traced it and then the output gives just all 0's (zero's).
Anybody can help me out here, because i've no idea why this is causing a problem.
Thanx in advance!
Textfield Height With Xml
Hi,
I am trying to create a Textfield, pulling the height out of an xml file:
Code:
System.useCodepage =true;
var me = this;
var my_config = new XML();
my_config.ignoreWhite = true;
my_config.onLoad = function(success) {
if (success) {
trace("data loaded");
var outputHeight:Number = this.firstChild.childNodes[0].childNodes;
trace(outputHeight);//traces 292
me.createTextField("output", 1, 7, 31, 402, outputHeight);
output.multiline = true;
output.type = "dynamic";
output.border = true;
output.borderColor = 0xFFFFFF;
output.background = true;
output.backgroundColor = 0xFFFFFF;
output.selectable = false;
output.setNewTextFormat(my_fmt1);
}
};
my_config.load("config.xml");
XML:
Code:
<?xml version='1.0' encoding='UTF-8'?>
<config>
<outputveld><292</outputveld>
</config>
or:
Code:
<?xml version='1.0' encoding='UTF-8'?>
<config>
<outputveld><![CDATA[292]]></outputveld>
</config>
but the height of the Textfield stays zero when I compile.
How come??
Thanks,
Jerryj.
Can't Get TextField Height...
Yes, I know... try textHeight... that didn't work either. I just keep getting one line worth of height. It's not registering the wordWrap as part of the height. I even tried putting a delay in it (in the hopes that a compute cycle hadn't caught up)... no luck.
Here is what the trace in the code yields:
97
112
112
Here's the code:
Attach Code
function popText(panelID){
//if moving the panels into place is done, draw the content...
if (mainPanel[panelID].isTweening() == false){
clearInterval(popPanText[panelID]);
var TextVar = "mainPanelText[" + panelID + "]";
var captVar = "mainPanelCaption[" + panelID + "]";
var headVar = "mainPanelHeader[" + i + "]";
//movie clip to contain all the text
mainPanelText[panelID] = mainPanel[panelID].createEmptyMovieClip(TextVar, mainPanel[panelID].getNextHighestDepth());
//set up the header
mainPanelHeader[panelID] = mainPanelText[panelID].createTextField(headVar, mainPanelText[panelID].getNextHighestDepth(), 10,0, 280, 0);
mainPanelHeader[panelID].multiline = true;
mainPanelHeader[panelID].wordWrap = true;
mainPanelHeader[panelID].autoSize = "left";
mainPanelHeader[panelID].text = panelHeader[panelID];
mainPanelHeader[panelID].setTextFormat(PanelHeaderStyle);
//set up the caption
mainPanelCaption[panelID] = mainPanelText[panelID].createTextField(captVar, mainPanelText[panelID].getNextHighestDepth(), 10, 0, 280, 0);
mainPanelCaption[panelID].html = true;
mainPanelCaption[panelID].wordWrap = true;
mainPanelCaption[panelID].multiline = true;
mainPanelCaption[panelID].autoSize = "left";
mainPanelCaption[panelID].htmlText = panelIntro[panelID];
mainPanelCaption[panelID].setTextFormat(PanelCaptionStyle);
//lower the caption under the header.
mainPanelCaption[panelID]._y = mainPanelHeader[panelID]._height;
trace(mainPanelText[panelID]._height);
//mainPanelCaption[panelID]._y = 320 - mainPanelCaption[panelID]._height;
//mainPanelHeader[panelID]._y = mainPanelCaption[panelID]._y - mainPanelHeader[panelID]._height;
}
}
[AS3] TextField Height
How do I predict the TextField height? When I initiate one, it comes with 100 height, but I want to set it to the fonts height.
I have tried the autoSize, but some times it shrinks the text field to a very tiny one, and some times it stays at fonts height, but I can't set its width anymore...
Is there a solution to this problem?
Thanks,
Ian Liu.
[AS] Textfield Height Bug?
I just ran into a problem with textfields and MX2k4. Has anyone noticed that the actual height of a standard, wordwrapped text field does not give the same height if you do a trace(myTXT._height)
For example take a look at this file:
temp.fla
Notice the actual height value then preview the fla. The trace will give a completely different number. 600 vs 675.
Normally this wouldnt be a problem but my scrollbar script uses the height of the textfield to calculate how much to scroll. Since the number is incorrect so is the scrolling. This can be fixed by breaking apart my textfield, but that makes updating the text a real pain.
Is there a way to get the actual value of the textfield height without using the myTXT._height? (I also used the myTXT.textHeight command, but it only works for dynamic text not static)
Any help would be greatly appreciated.
Thanks!
Textfield Height ?
Hi everybody...
Allright, i load text from a external txt file in a textfield.
I use the ' maxscroll ' function to give the number of line text there is now in my textfield.
My questions to everybody is:
can you resize a textfield (height) depending on the number of line of text that it contain.
exemple:
3 lines of text = 30 pixel
10 lines of text = 100 pixels
Thanx
Height Of A Textfield
I'm loading some text from a database into a textfield. I would like to know how I can attach a mc directly under that text.. The thing is the random text loaded is between 2 and 10 rows.
Another thing I also need help with is how to get the last value of an array. I couldn't get it to work...
Thanks!
Auto Scrollbar?
just wondering if you could do an auto scroll bar for dynamic txt in flash?
Auto ScrollBar
Hi there!
How can I make automatically appear a ScrollBar attached to a Dynamic TextField when needed if content loaded in this field exceeds the number of lines visible?
Many thanks in advance for any help!
Best regards,
Gerry
Scrollbar-(Stage Height)
Was wondering if anyone could help me find a tut. or open source for a scrollbar for a movie clip that adjusts to the stage height although its full screen vertically but the width and its horizontal position are not.
also hide the scrollbar when content fits.
thank you,
Dynamic Scrollbar Height Help
Hi Guys wonder if there is anyone out there that can lend a hand.
I have built a custom scrollbar sytem for a content MC (based around Lee Brimlows tutorial over at gotoAndLearn) But i cant figure out the logic behind resizing the scrollbar thumb based on how long the content MC is. If i knew the Math behind it im sure i'd have solved it by now but i just can't seem to figure it out.
Is it Thumb.height = (content.height / mask.height) * .... ???
Any help hugely appreciated guys!!
Dynamic Textfield Height
i have a dynamic textfield which is to load a pretty long text file. however, this dynamic textfield height appears to be not long enough for it to show the full length of the text file. is there a way where the height of the dynamic textfield will increase itself when the length of the textfield is long? this is because once i reaches 3000height, i cant increase during design time anymore as i will get an error saying invalid height.
thanks
Getting Height Of Dynamic Textfield
A rather simple problem.
The main MC duplicates the container MC which has a dynamic textfield. Each one of the container MCs must be placed under the previous one with 20px distance. The problem is that the variable of the main MC which should calculate (getProperty) the final height of the dynamic textfield is not working.
Help Me Figure Out The Height Of The TextField Please
I'm going crazy here! Can't figure out why it won't give me the height of the textField that I dynamically create.
Code:
var my_fmt:TextFormat = new TextFormat();
my_fmt.font = "Arial";
my_fmt.color = 0x000000;
my_fmt.size= 11;
my_fmt.bold = false
temp2=this._parent.getNextHighestDepth();
this._parent.createTextField("the_text", temp2, tempx+5, tempy-8, 192, undefined);
this._parent.the_text.multiline = true;
this._parent.the_text.html = false;
this._parent.the_text.wordWrap = true;
this._parent.the_text.text=this.description;
this._parent.the_text.setTextFormat(my_fmt);
this._parent.the_text.autoSize = true;
box_height=this._parent.the_text._height;
trace(box_height);
Can anyone see what's wrong?
Height Of Dynamic Textfield?
Hey everyone
Very simple: I have a dynamic textfield inside a MC. This MC is duplicated below eachother, like any other news-pages. I have to check the height of the dynamic movieclip to know where the next clip has to be, but when reading the height, it reads the height before the text is loaded inside the clip...
I have read something about this before, but I can't figure out how to make it work...
Please :-)
[F8] Can't Adjust Textfield Height
I have a dynamic text field that I want to change the height. I use text._height = new_height. But trace of the _height is a totally different number. Why is that? I have spent hours trying to make it work. I really need some help:-(
Here is the sample project.
http://www.gotomyhome.com/temp/test.fla
Thanks
Dynamic Textfield Height
Hey everyone
I have this problem again, again. I Have a loop, where I attach several movieclips to the stage, load som xml text into them, and position them under eachother according to the previous clips height.
The problem is, that the height I'm getting is the height of the movieclip BEFORE the text has loaded into it - and not the actual height that I want. This is offcourse because the text takes a little time to pe put into the clip (I have preloaded the XML, so the xml loading is not an issue).
How can I solve this?
This is my code:
Code:
/******************************************************
FIND LIVE IN XML AND PUT IN ARRAY
******************************************************/
// Make array with all XML inside root-tag
var nodes:Array = _root.xml.firstChild.childNodes;
// Loop through them
for(i=0;i < nodes.length; i++)
{
// If we have the news tag
if(nodes[i].nodeName == 'news')
{
// Put all childnodes into new array
var newsNodes:Array = nodes[i].childNodes;
}
}
/******************************************************
DUPLICATE NEWSCLIP AND PUT TEXT INTO
******************************************************/
var currY:Number = 0;
// loop through all the news
for(i=0; i<newsNodes.length; i++)
{
// Create empty MovieClip
var holder:MovieClip = textclip.createEmptyMovieClip("newsholder"+i, textclip.getNextHighestDepth());
// Attach newsclip to the new movieclip
var s:MovieClip = holder.attachMovie("newsclip", "newsclip"+i, textclip.getNextHighestDepth());
// Put text into
s.overskrift.text = newsNodes[i].attributes.overskrift;
s.date.text = newsNodes[i].attributes.date;
s.tekst.text = newsNodes[i].firstChild.firstChild.nodeValue;
// Set X & Y for the movieclip
s._x = 0;
s._y = currY;
// update variable with the Y for the next clip + distance between
currY += s._height + 5;
}
TextField AutoSize And Height
A bit perplexed about something...
I'd like to have a fixed-width, multiline textfield, but one where the height auto-adjusts.
i.e. - in the example below, where forceWidth is a Number vs. null, the TextField has the default height of a newly created TextField, rather than the else statement, where the TextField's height is the same as its content.
I want the height of the TextField to always be that of the content.
Code:
var label:TextField = new TextField();
label.background = true;
label.border = true;
if (forceWidth) {
label.width = forceWidth;
label.wordWrap = true;
} else {
label.autoSize = TextFieldAutoSize.LEFT;
}
label.defaultTextFormat = format;
label.text = txt;
Textfield Height Limit?
I am working a project that require me to pull large amounts of text onto stage and make it scrollable. So I have, but I have encountered a problem in 3 different files that when the textfield's height is more than about 1400, 1500 pixels it starts to cut off text.
I checked to see if it's a character limit and it's not that. I've made the scroller myself but I can't see how that is causing the problem. It works for all my other fields.
Is there a bug within flash, or maybe CS3? I'm working in AS2 in CS3.
Any help or insight on this problem would be much appreciated.
Can't Adjust Textfield Height
I have a dynamic text field that I want to change the height. I use text._height = new_height. But trace of the _height is a totally different number. Why is that? I have spent hours trying to make it work. I really need some help:-(
Here is the sample project.
http://www.gotomyhome.com/temp/test.fla
Thanks
Get Dynamic Textfield Height?
How do i get the height of a dynamic textfield? I need this to place the textfield relative from the bottom.
ActionScript Code:
//footer mcvar footer_mc:MovieClipvar footer:TextField;var contentWebWidth = contentWeb._width;var footerWidth:Number = contentWebWidth -50;var offSet:Number = (contentWebWidth - footerWidth) /2;var footerX:Number = -(contentWebWidth /2) + offSet ;var footerHeight = (contentWeb.footer_mc.footer._height);var footerY:Number = (contentWeb._height /2) - footerHeight;contentWeb.footer_mc.footer._width = footerWidth ;contentWeb.footer_mc.footer.wordWrap = true;contentWeb.footer_mc.footer.multiline = true;contentWeb.footer_mc.footer.autoSize = true;contentWeb.footer_mc._x = footerX;contentWeb.footer_mc._y = footerY;trace ("Height: "+footerHeight);
My footer textfield is multiline but it doesn't give me the corresponding textfield height??
Any tips?
TextField Line Height
Hi guys.
Is there anyway to get the font line height of a TextField? I can't find anything in the Flash Help docs but I may have missed something.
Cheers.
Si ++
TextField Height - Transform
Hi,
I have a textfield thats created on a canvas mc (createTextField). If i after that set the height and width of the canvas AND the textfield to say 200 they get totalt different size ... The textfields becomes much smaller. SHouldn't they both be 200 wide and high? What i'm i missing? Do the have different reference points or something? I've tried localTpGlobal a bit but that haven't helped me.
I'd love som help.
Thanks
Richard
TextField Height Not Available Initially
Hello all,
Lets say I have a dynamic text field with autoSize = true on it. and I have a MovieClip behind it that I want to be the same size as the text field.
If I fill the text field with 10 lines or whatever of text, then try and do something like myMovieClip._mc._height = myTextField._height; it will never work....it always displays the initial height of the text field (22 in this case)...I guess because it has not been drawn yet. Is there any way around this?
Cheers,
E
Auto Scroller With Scrollbar
Hello fellow Kirupians
I've been working from the simple scrollbar tutorial at
http://www.kirupa.com/developer/flash8/scrollbar.htm
and got it pretty much looking/working the way I want to.
Is there any way to add an auto-scrolling feature? I'm populating my MC with about 20-25 dynamic textfields from an XML file. The user I showed it to suggested I add autoscrolling along with the scrollbar. That way the movie would automatically start playing, and would minimize any input required from the user.
Thanks in advance
pram310
Scrollbar Auto Resize
does anyone know where i can find a scrollbar similar to the one used here:
http://www.subdisc.com/
it would be nice to impliment some easing as well, thanks!!!
Scrollbar Auto Resize
Hello everybody,
i have downloaded Simple Scrollbar : http://www.kirupa.com/developer/flash8/scrollbar.htm
Work perfectly but now i would like to make this scrollbar auto Resize... because have create an object onResize function and i would like to make mask._height = Stage._height... but scrollbar is not resizing (scrllbar._height = mask._height) !
How can i do this ? thanks
PS : sorry for my bad english... i'm french
ScrollBar Auto Resize?
Hey Guys,
I'm using leebrimelow's tutorial"Object-Oriented Scrollbar"
i need to make the height of the thumb auto resized related to the height of the content
thanks
MX 2004 Scrollbar Component - Can't Set The Height
I have a simple input text field on the stage and have attached the MX 2004 UI scrollbar component to it. I resize the scrollbar component to match the box surrounding my input text area. Everything looks great. But when I publish the file, the scrollbar contracts to the size of the text field. how can I get the scrollbar to stay a certain size? I've tried scripting it as well:
myScrollBar.setSize(200);
That doesn't do Jack. What's the deal here?
Thanks for any help!
Scrollbar - How To Edit Scroll Height?
Hi,
I've created a movie with a scroll area for text. Upon publishin the movie, the bottom few lines of the text is not displaying. The length of the scrollbar seems to be pre-set, can anyone pls advice on where goes wrong here? Tx.
Updating Scrollbar After Height Change
Hey everybody,
I'm writing a custom scrollbar for a project I'm working on, and I would like it to update the scroller size / position when the height of the scrollable object changes. All that code is already done, but without running an onEnterFrame or setInterval constantly to watch the _height of the scrollable object, I can't find a method of watching for _height change. Object.watch() apparently doesn't work with actionscript properties, so is there any other way, some other property that I can watch which gets updated whenever _height gets updated?
For now I just have it using onEnterFrame, but if anybody knows a better way please help a guy out.
Thanks,
--EP
Dynamic Scrollbar (scrollbutton) Height
I am currently trying to adapt a scrollbar to change the size of the scroll button depending on the size of the area its trying to scroll. The scroll bar is a full screen scrollbar which scrolls a movie clip.
Ive tried a variety of different ways to achieve this but have gotten myself stuck.
ActionScript Code:
resizer.onResize = function() {
var contentHeight = contentMain._height;
var stageHeight = Stage.height;
scrollbar.scrollbutton._height = Math.round((contentHeight/stageHeight)*100);
};
So far its changing the size but not correctly... Does anyone know of a tutorial around somewhere that explains this type of scrollbar or know where I'm going wrong here?
David
Scrollbar Component Thumb Height
Hey All,
I'm running into a small problem. I have a dynamic text box with a scrollbar component. Depending on how much text i have in the text box, the height of the scrollbar thumb slider/scroller will shift. if there is more text, the thumb slider/scroller will decrease and vice versa. Any ideas on how I can make it one size regardless of how much text is added?
|