Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash








Determining The Height A Text Box Will Need To Be Dynamically


I want to populate a dynamic text box and then scroll this.
Is there anyway of determining how large the text area's height needs to be given the width and the text I want to populate it with?

Hope that makes sense. If not please shout!

Many Thanks,
Daf




KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 04-26-2006, 12:24 PM


View Complete Forum Thread with Replies

Sponsored Links:

Determining Text Height
hi there,

i need to show different (variably loaded) answer-possibilities to a question which the user has to answer (somehow like a poll). the answers may be longer than one line and are auto-word-wrapped. to re-position the duplicates of the answer-template-mc, i need to know the height of the previous anwers. of course the _height-property does only store a constant value, so it doesn't help me at all. any idea how to find out how high a text will be displayed (how many lines it'll need)?

bye and thx, stevie.

View Replies !    View Related
Determining Height Of A Text Box
Hey everyone!

Im trying to find an actionscript 2 function that determines the height of a textbox.

I tried treating the textbox as a MC, by

trace(text._height);

but it was undefined.

How do I find the height of a textbox?

thanks

View Replies !    View Related
Determining Text Height Of Dynamic Textbox After Font Size Has Changed?
Hi all

I have a dynamic textbox where the font size for that box is set for 12pt

I can calculate the height of that textbox by doing the following:
myText.textHeight;

Now, on pressing a button i've created, I can change the size of the font within that textbox.

however the textHeight value for the dynamic textbox doesn't change.
Any ideas how I can get the textHeight to change when I change the size of the font within the dynamic textbox?

Cheers

View Replies !    View Related
Is It Possible To Dynamically Set The Height Of A Textfield According To Text Amount?
is it possible to dynamically set the height of a textfield according to the amount of text that's been externally loaded?
say if I only have a line of text to load in to a textfield, then that textfield could adjust is height to only the height of a line of text.
and if it is a paragraph, then the textfield will load the text with lenthened height.
is it possible to achieve that? to have a text field adjust its height according to amount of text loaded?

View Replies !    View Related
Changing The Height Dynamically Of A Dynamic Text Box
I'm trying to load text from a text file into a dynamic text box that's inside a ScrollPane component. If the text in the file exceeds the size of the dynamic text box, the text box doesn't change it's height automatically, so I'm trying to do that dynamically. This is the code I have right now.

events.html=true;
eventsLoadVar = new LoadVars ();
eventsLoadVar.load("documents/events.txt");
eventsLoadVar.onLoad = function (success){
if (success == true) {
events._height=eventsLoadVar.eventsheight;
events.htmlText=eventsLoadVar.eventstext;
}
}

It seems to be working properly, but not on the first time the page loads. I have to refresh the page for the height to actually take effect.

Does anyone know how I can get the height to change on the first load, or is there a better way to be doing all of this?

View Replies !    View Related
Getting And Setting The Width And Height Of Text Tool Dynamically
What I am trying to do is set the text of a text tool at runtime, which I was able to do. The problem is how can I determine if the text exceeds the size of the text tool and how to resize it at runtime.

View Replies !    View Related
Dynamically Generated Text Fields - Height/Spacing
Could some kind soul point me in the right direction - I know I must be missing something simple -

- I am generating a list of clips in a scrollPane, each clip displays some text via an array which has extracted the data from a loaded XML file, so far so good, my problem is I cannot seem to generate the right code that records the _height of the previous clip and then asigns the new clips _y axis based on that value - at the moment I have a static value, var spacing - which I'd like to be fluid based on how high the prev text field was, in order that each of the clips display their text in full - have tried various variables such as newY = (this.post_mc._height * 20) but no joy. Would someone mind clearing the air for me please?! been going great guns so far for a simple designer but this bit has me stumped


Here's my code;


ActionScript Code:
function makeThread(posts, userPost, userID, maxPosts){
threadList_sp.vScrollPolicy = "off";
var spacing:Number = 100;
// Loop through each post
    var name_str:String = "post" + (posts) + "_mc";
    var depth:Number = posts * 10;
// Create post clip
    var post_mc:MovieClip = threadList_sp.content.attachMovie("post_mc", name_str, depth);
// Format clip
    post_mc._y = (posts * spacing);
    post_mc.userName_txt.text = "Posted by " + (userID);
    post_mc.userName_txt.autoSize = "left";
    post_mc.userPost_txt.text = userPost;
    post_mc.userPost_txt.autoSize = "left";
// Check if this is the last clip
    if((posts + 1) == maxPosts){
        //trace("function Fired");
        threadList_sp.vScrollPolicy = "on";
    }
}
function init(){
    var threadArray:Array = new Array();
    //Loop through each post
    for(var posts:Number = 0; posts < this.firstChild.childNodes.length; posts++){
    threadArray[posts] = new Object();
    threadArray[posts].userID = this.firstChild.childNodes[posts].attributes.userID;
    threadArray[posts].postDate = this.firstChild.childNodes[posts].attributes.postDate;
    threadArray[posts].userPost = this.firstChild.childNodes[posts].childNodes[0];
    //trace(this.firstChild.childNodes.length);
    //trace(userID);
    //trace(maxPosts);
    //trace(userPost);
    trace(posts);
    var maxPosts:Number = this.firstChild.childNodes.length;
    var userID:String = threadArray[posts].userID;
    var postDate:String = threadArray[posts].postDate;
    var userPost:String = threadArray[posts].userPost;
    makeThread(posts, userPost, userID, maxPosts);
    }
}
var threadListXML:XML = new XML();
threadListXML.ignoreWhite = true;
threadListXML.onLoad = init;
threadListXML.load("threadlist.xml")

View Replies !    View Related
Finding Line Height Of Dynamically Generated Text Into A Variable ?
Hello,

I made a site with news flashes that are dynamically pulled from text files. They are placed about an inch apart from each other. The problem is that when a news flash is only one sentence long, there is a large gap between it and the news flash under it. Also, different browsers and platforms display fonts differently... the same 12pt font fills the area differently depending upon your browser/platform.

Is there any way to figure out information about not only how many characters is being pulled into a variable, but also the line height... or maybe the overall height of the text field. If I could find that information, then I could dynamically place another news flash under it always keeping the distance between the flashes consistent no matter what browser/platform is used.

Any suggestions would be appreciated

thanks,
Janet

View Replies !    View Related
Change Height Of Swf Dynamically ?
I have a problem with my main .swf file resizing the width AND height when I call the js named "flash_resize.js" when I really am only interested in changing the height attribute. Hmmmmmmm . . .

Here is my code in my HTML page for reference:

<div align="left">
<div id="flashid" style="width:800px; height:400px;">
<script type="text/javascript" language="JavaScript">
e = canResizeFlash();
document.write('<object data="#flash_choice#.swf" width="800" height="100%" type="application/x-shockwave-flash">');
document.write('<param name="movie" value="#flash_choice#.swf" />');
document.write('<param name="FlashVars" value="allowResize='+e+'" />');
document.write('Flash Movie With Resizing Content');
document.write('</object>');
</script>
<noscript>Javascript must be enabled to view Flash movie</noscript>
</div>
</div>

Here is my code in my Flash project on a button instance calling this javascript function:

on(press){
gotoAndPlay("body_ir",1);
getURL("javascript:setFlashSize('flashid', 800, 200)");
}

Here is the javascript code for "setFlashSize":

function setFlashSize(divid, newW, newH){
setFlashWidth(divid, newW);
setFlashHeight(divid, newH);
}

The problem is that when this button is pressed, by entire flash project is scaled by half (in this instance I want to reduce the height from 400px to 200px). This project has a main container movie clip holding all other movie clips. When I change the height on the main container clip, (i don't know why . . . but) the width is also change accordingly and therefore all internal sub_files are changed too for width and height. I only want to have the height changed. On the main container movie clip, in certain instances there is content filling the entire height, but there are other situations where the visible height of the clip is only about 200px high, therefore leaving a 200px white blank space underneath the visible clip and the HTML content immediately preceding the SWF file. What I am wanting to achieve is to have this HTML content below the SWF to butt up against the bottom of the SWF file when it is either at normal size or reduced in height by pressing a button. How can I achieve this? All help is appreciated. Thank you.

View Replies !    View Related
Dynamically Grow In Height
What I would liek to do is on clicking a + button, the box as in a box on a graph, grows by x (one click), but rather than it jumping from say 0 pixels to 10 pixels, I was wondering if there was a way that it could slide from 0 to 10 smoothly?

Cheers

lee

View Replies !    View Related
Determining Number Of Lines Of Text In A Dynamic Text Field
I'm working on a movie that has a large number of dynamic text fields in it, which are being fed data from .xml sources.

The width of the dynamic text fields are set and cannot be changed, and I need is to find a way to determine how many lines tall each text field will need to be to fit it's data. If I were using a monospaced font this could be done pretty easily, but it has to use a non-monospaced font since the look of the piece is critical.

So.. is there any way to determine when Flash uses a linefeed within a dynamic text field? Or any way to find out how many lines have been filled with text after it's been populated with data?

Thank you.

View Replies !    View Related
Determining The Name Of A Dynamically Loaded Movieclip From A Child Movieclip
I had posted earlier on this topic, but I don't think I was clear enough in my title, or description.

Here's a more detailed explaination of what I I'm trying to do:

I have a .swf file that dynamically generates container movieclips (giving them dynamically generated instance names) and then dynamically loads external .swf files into it.

In my main time line I have a series of objects.

I would like to be able to, from the loaded .swf files, make a call to the objects in the _root timeline (which I can do without a problem) letting these objects know, the name of it's dynamically generated container movieclip that contains my loaded .swf.

1. Parent SWF:
|
2. Dynamically Generated MovieClip Instance:
|
3. Dynamically loaded external SWF File:
. Script needs to know the name of the instance
of #2.

In 3. I tried using the _parent and _parent._parent to get a reference to #2. but all I was able to get was "_level0".

I've also tried using _lockroot (which somone else kindly suggested) to no avail.

Any help is greatly appreciated

View Replies !    View Related
Height For Graph Controlled Dynamically
Hey everyone,

I am trying to create a thermometer bar graph that consists of one bar. This bar represents the amount of money needed for a certain event (goal). I have an animation that goes from 0 - 100 and is 100 frames long. How would I code this so that the variable I load (current_amount) is represented in the bar graph.

For example if my 'current_amount' variable is equal to 54, I would want my movie clip to play frames 1 to 54 and then stop.

Any help would be huge. Peace.

View Replies !    View Related
The Height Of A Dynamically Created Textfield
Hi, hello and everything else...

If I'd have a variable with some html-text and I'd want to put it into a textfield created by actionscript, how can I find out what the height of the textfield should be?

I was thinking of roughly counting the text with a for-loop, like increasing some variable a lot when a "<br>" is detected and ignoring other brackets and stuff, but I figured there might be an easier way to achieve this...right??

Thanks for all your time - Ruben

View Replies !    View Related
LoadMovie And Dynamically Set It's Width And Height
Hi,

I want to loadMovie function to load an external SWF file into stage and set it's width and height on the fly.
Everything works, but I can't set it's height/width automatically. I can set _xscale, _yscale, _x, _y.. but not _Height and _Width.
How come?

I have attached my code to this post.

Even when I trace "_root[whichTarget]._Width" and "_root[whichTarget]._Height" it outputs 0 to me.

Please help me!








Attach Code

function startLoading(whichImage, left, top, w, h, angle, color) {
myCount++;
whichTarget = "mcNew"+myCount;
duplicateMovieClip("movieLoader", whichTarget, myCount);
loadMovie(whichImage, _root[whichTarget]);
_root[whichTarget]._rotation = angle;
_root[whichTarget]._x = left;
_root[whichTarget]._y = top;
_root[whichTarget]._xscale = w;
_root[whichTarget]._yscale = h;
myColor = new Color(_root[whichTarget]);
if (color == "green") {
myColor.setTint(0,255,0,100);
}
if (color == "red") {
myColor.setTint(255,0,0,100);
}
if (color == "blue") {
myColor.setTint(0,0,255,100);
}
}

View Replies !    View Related
FMX- Changing Stage Height Dynamically
Hello!

I'd like to know if anyone knows how to change the height of the stage dynamically, with ActionScript.
Is there a way to change the height of the stage with a pixel value?
I don't want to scale down the whole movie just make the stage bigger, just like when you change it manually in Modify-Document.
Thanks!

View Replies !    View Related
Changing Stage Height Dynamically
Hi,
I couldn't find anything in the documentation, but is it possible to dynamically change the height of the stage?

I am using 'dimensions: pixels', and 'noscale' as publish settings. What I would like to do is, when the height of a movieclip gets bigger (because of its dynamically loaded content), to make the 'stage.height' bigger too, so you can scroll more downwards.

I know stage.height is read-only, but it would be nice to have just the right amount of space at the bottom of the page, depending on how high the movieclips are. Reading back, I wonder if i state my question clear, hopefully I use the right terminology.

so if stage.height would work i would like to do something like:


ActionScript Code:
stage.height= MC._y+ MC._height +30;


thank you,

Jerryj.

View Replies !    View Related
Dynamically Changing Height And Width
I want to change the height and width of an object (specifically doubling it) after an interval of 2 seconds until the height and width of the object reach over 100. I've made two different scripts to try to make this possible.

Script 1

Code:
function hw2(){
this.test._height *= 2;
this.test._width *= 2;
}

this.test._height = 1;
this.test._width = 1;

while ( this.test._height <= 100 && this.test._width <= 100 ){
setInterval(hw2(), 2000);
}
Script 2

Code:
function hw2(){
if(this.test._height > 100 && this.test._width > 100){
clearInterval(myInterval);
}
else{
this.test._height *= 2;
this.test._width *= 2;
}

}

this.test._height = 1;
this.test._width = 1;

myInterval = setInterval(myObj, "hw", 2000);
The problem with the first script is that the movie will wait and then display only the final height and width. The problem with the second script is that it doesn't show any height or width from the function, it only resizes for the this.test._height = 1; and this.test._width = 1; . Thanks in advance.

EDIT:
I just read the "Read this First" sticky and now I'm going to post that I'm using Flash MX Professional 2004.

View Replies !    View Related
Adjust Stage Height Dynamically
Hey, I'm working on this charting thing and it duplicates MCs vertically and I need to be able to adjust my stage to accomadate more or less MC's. Can somebody help me out a bit?

View Replies !    View Related
FMX- Changing Stage Height Dynamically
Hello!

I'd like to know if anyone knows how to change the height of the stage dynamically, with ActionScript.
Is there a way to change the height of the stage with a pixel value?
I don't want to scale down the whole movie just make the stage bigger, just like when you change it manually in Modify-Document.
Thanks!

View Replies !    View Related
Dynamically Change The Height Of An Element
Hi there,

I have an animated graph in flash and I would like to set the values (heights of the bars) using data imported via an XML file.

I can successfully import the data, but I have no idea how I change the height of the bars!

Can anyone point me in the right direction?

Thanks in advance!

Andy

View Replies !    View Related
Detecting And Adjusting Textbox Height Dynamically
Is there a way to detect how many text lines are in a dynamic text box and then, once that value has been detected, is there a way to adjust the text box's height or at least determine the location (in pixels) of the bottom of the text? When dynamically changing text in the box, I need to be able to move the clips below the text so that there's no extra space between the bottom of the text and the clip below it.

I am familiar with the "scroll" and "maxscroll" properties, but am having trouble finding any way to detect the number of lines in a dynamic text box and adjust its height accordingly.

View Replies !    View Related
Height And Width Of Dynamically Loaded Image
I'm dynamically loading images that are portraits and landscapes, and would like to be able to deal with them differently.

Currently, I create an empty movie clip and then dynamically load the image into it, but using _height and _width on the movie clip returns 0 for both.

Is there a way to dynamically load images and then to find the height and width of the loaded image?

Nick

View Replies !    View Related
Dynamically Created Circles & The .height Property
Is there some trick to finding out the height of a dynamically created circle? I just decided to make the jump to AS3 about 8 hours ago and I'm having some trouble. Basically, I made a bouncing ball, and I needed the ball to bounce up after the bottom of the ball reached the bottom of the stage. If I use stage.stageHeight - ball.height, it's way off and the ball falls off screen completely before bouncing back up. If I use (stage.stageHeight - (ball.height * 2.33)) though, it works fine. So why do I need to multiply the height by 2.33 for it to work right? I tried this with a rectangle and it worked fine without multiplying. Here's the code I'm using:


PHP Code:



stop();

var gravity:Number = new Number();
var bounce:Number = new Number(15);
var bounceCounter:int = new int(1);
var ball:Sprite = new Sprite();

ball.graphics.beginFill(0xFF0000);
ball.graphics.drawCircle(50,50,15);
ball.graphics.endFill();

var dropShadow:DropShadowFilter = new DropShadowFilter(3,90);
ball.filters = [dropShadow];

stage.addChild(ball);

stage.addEventListener(Event.ENTER_FRAME, moveBall);

function moveBall(evt:Event):void {
    var fallSpeed:Number = gravity + 2;
    gravity += (.25);
    if (ball.y >= (stage.stageHeight - (ball.height * 2.33))) {
        ball.y = (stage.stageHeight - (ball.height * 2.33));
        bounceCounter++;
        gravity = (bounceCounter/2)-15;
        if (gravity >= 2) {
            gravity = 2;
        }
    }
    ball.y += fallSpeed;

    if (bounceCounter > 30) {
        stage.removeEventListener(Event.ENTER_FRAME, moveBall);
    }
    trace(bounceCounter);
}




I never got into physics in AS2, so I'm sure there are more than a few different ways this could be done better. I wanted to see if I could code this entirely off the top of my head, though, instead of just copying someone else's code. Also, I noticed that bounceCounter is incremented twice every time the ball hits the ground. Can someone explain to me why that's happening?

View Replies !    View Related
Can't Change The Height Of Dynamically Loading Image
I want to change the height and width of images which is loading from an XML file. I tried.... the images is loading and it is working fine.... All the other properties except the height and width is working.

Please help how to change the height and width of an image which is loading from the XML file


_root.createEmptyMovieClip(movieclip, levels);//working
loadMovie("images/" + filename, movieclip); //working
setProperty(movieclip, _x, posx); //working
setProperty(movieclip, _rotation, 45);//working

setProperty(movieclip, _height, 45);//not working

View Replies !    View Related
Seting Stage And/or Browser Height Dynamically
hi, folks,

I have this website. There are 3 pages with different heights. I am loading external swf in a main movie to save loading time.
But i ran into a issue. One page has the height of 1900px and the other 2 have 650px (give-or-take), in other words, 3 times the size of the first one.

I read in Flash/ActionScript specs that we cannot set the height of the stage thru AS or alike. So i had to set the main stage height based on the bigger which gives me a massive scroll bar on the other ones.

Does anyone know how to solve this? I heard you could do it with JavaScript, but how? Any tutorials, comments, light, insight? Anything?

thanks for your time and help,

mr_n00

View Replies !    View Related
Reading The Height And Width Of Dynamically Loaded .png's
hi everyone.


i'm doing an infopicture in which hotspots will react on ROLL_OVER and show a .png.

the result so far can be seen here:http://campjohn.dk/temp/infofoto/BigaInfofoto.html

data being loaded can be seen here:
http://campjohn.dk/temp/infofoto/BigaInfofoto.xml

the code so far in the frst frame can be seen here:

Code:
stop();

//CONTEXT MENU
//-----------------------------------------------------------------------
var menuData:Array = [];
menuData.push( {caption:"© 2008 Co3", url:"http://www.co3.dk"} );

//IMPORTS
//-----------------------------------------------------------------------
import caurina.transitions.Tweener;
import NewCustomContextMenu;
import PreloadProgressBar;

//VARS & INITS
//-----------------------------------------------------------------------
var ncm:NewCustomContextMenu = new NewCustomContextMenu(menuData, this);
var _preloadProgressBar:PreloadProgressBar = new PreloadProgressBar();
var _xmlfromURL:String = "BigaInfofoto.xml";
var _xml:XML;
var _xmlloader:URLLoader = new URLLoader();
_xmlloader.addEventListener(Event.COMPLETE, onXMLLoaded);
_xmlloader.load(new URLRequest(_xmlfromURL));
var _numOfLoops:Number;
var _arrayPictures:Array = new Array();
var _arrayX:Array = new Array();
var _arrayY:Array = new Array();
var _arrayP:Array = new Array();
var _arrayLoadedInfo:Array = new Array();
var _backgroundPicture:Loader = new Loader();
var _progressColor:uint;



function onXMLLoaded(e:Event):void {
_xml = new XML(e.target.data);
trace("_xml = "+_xml);

//RED DOTS AND PNG ARE GENERATED IN HOLDERS
_numOfLoops = _xml.infospecs.length();

for (var i=0; i<_numOfLoops; i++) {

_arrayP.push(_xml.infospecs[i].position);

//RED DOTS
var _reddot:RedDot = new RedDot();
addChild(_reddot);
_reddot.name = "_reddot"+i;
_reddot.x = _xml.infospecs[i].xpos;
_reddot.y = _xml.infospecs[i].ypos;
trace(_xml.infospecs[i].position);
_reddot.addEventListener(MouseEvent.ROLL_OVER, rollOverReddot, false, 0, true);
_reddot.addEventListener(MouseEvent.ROLL_OUT, rollOutReddot, false, 0, true);
_reddot.mouseChildren = false;
_reddot.buttonMode = true;

//THE .PNG'S
var pictureHolder:Sprite = new Sprite();
var pictureLoader:Loader = new Loader();
pictureLoader.name = "pictureLoader"+i;
pictureLoader.load(new URLRequest(_xml.infospecs[i].billede));
pictureLoader.x = _xml.infospecs[i].xpos;
pictureLoader.y = _xml.infospecs[i].ypos;
pictureHolder.alpha = 0;
addChild(pictureHolder);
pictureHolder.addChild(pictureLoader);
this.setChildIndex(pictureHolder, 0);
pictureLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadedInfoPicture, false, 0, true);

_arrayLoadedInfo.push(pictureHolder);
}

//THE BIG PICTURE IN THE BACKGROUND
_backgroundPicture.load(new URLRequest(_xml.stortBillede));
_backgroundPicture.contentLoaderInfo.addEventListener(Event.OPEN, handleOpen, false, 0, true);
_backgroundPicture.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, showProgress, false, 0, true);
_backgroundPicture.contentLoaderInfo.addEventListener(Event.COMPLETE, loadedBackgroundPicture, false, 0, true);
}

//ADD PRELOADPROGRESSBAR
//-----------------------------------------------------------------------
function handleOpen(e:Event):void {
addChild(_preloadProgressBar);
trace("loading has started");
}

//CONTROL THE PRELOADPROGRESSBAREN
//-----------------------------------------------------------------------
function showProgress(e:ProgressEvent):void {
trace("loading picture");
_preloadProgressBar.init(e.bytesTotal, e.bytesLoaded, _progressColor);
_preloadProgressBar.doTheGraphics();
}

//WHEN THE BACKGROUNDPICTURE IS LOADED
//-----------------------------------------------------------------------
function loadedBackgroundPicture(e:Event):void {
removeChild(_preloadProgressBar);
addChild(_backgroundPicture);
this.setChildIndex(_backgroundPicture, 0);
}

function loadedInfoPicture(e:Event):void {
}

//ON ROLL_OVER ON A RED DOT; SHOW THE PNG
//-----------------------------------------------------------------------
function rollOverReddot(e:Event):void {
var tempName:String = e.target.name;
trace("tempName = "+tempName);
tempName = tempName.substr(7);
trace("tempName = "+tempName);

var tempMC:Sprite = Sprite(_arrayLoadedInfo[tempName]);
Tweener.addTween(tempMC, {alpha:1, time:0.4, delay:0.2, transition:"linear"});
}

//WHEN THE RED DOT IS NO LONGER ACTIVE HIDE THE PNG
//-----------------------------------------------------------------------
function rollOutReddot(e:Event):void {
var tempName:String = e.target.name;
trace("tempName = "+tempName);
tempName = tempName.substr(7);
trace("tempName = "+tempName);

var tempMC:Sprite = Sprite(_arrayLoadedInfo[tempName]);
Tweener.addTween(tempMC, {alpha:0, time:0.4, delay:0.2, transition:"linear"});
}
in the xml each picture has a position which shall be used to place it around the red dot.
right now all pictures are placed at 0,0 which equals south east of the red dot.

but, if a red dot is placed in the lower right corner of the flash, it would be nice to be able to place its png in north west instead..

well, enough explanation, I guess

to place the pngs around the red dots I need to be able to read the height and width of each png.

can anyone help me in telling how I can read the sizes of the png, with the actionscript I have so far.. I've prepared an empty function that is ready to read the size of each png: loadedInfoPicture.

but if the function is not useable any other solution is welcome...

hope anyone can help


thanks
felisan

View Replies !    View Related
Finding Height And Width Of Dynamically Created MCs
So, I'm using createEmptyMovieClip() to generate a number of MCs, then loading external .jpgs into each MC. Having done this, however, I need to be able to manipulate the created MCs according to the heights and/or widths of the images they now contain. But the height and width of the MCs seems always to register as 0.

Can someone enlighten me as to how I can dynamically determine the heights/widths of my dynamically loaded .jpgs?

View Replies !    View Related
Can't Change The Height Of Dynamically Loading Image
I want to change the height and width of images which is loading from an XML file. I tried.... the images is loading and it is working fine.... All the other properties except the height and width is working.

Please help how to change the height and width of an image which is loading from the XML file


_root.createEmptyMovieClip(movieclip, levels);//working
loadMovie("images/" + filename, movieclip); //working
setProperty(movieclip, _x, posx); //working
setProperty(movieclip, _rotation, 45); //working

setProperty(movieclip, _height, 45); //not working

View Replies !    View Related
Change Stage And/or Browser Height Dynamically
hi, folks,

I have this website. There are 3 pages with different heights. I am loading external swf in a main movie to save loading time.
But i ran into a issue. One page has the height of 1900px and the other 2 have 650px (give-or-take), in other words, 3 times the size of the first one.

I read in Flash/ActionScript specs that we cannot set the height of the stage thru AS or alike. So i had to set the main stage height based on the bigger which gives me a massive scroll bar on the other ones.

Does anyone know how to solve this? I heard you could do it with JavaScript, but how? Any tutorials, comments, light, insight? Anything?

thanks for your time and help,

mr_n00

View Replies !    View Related
AS3 - Reading The Height And Width Of Dynamically Loaded .png's
Last edited by Anik : 2008-08-15 at 08:59.
























hi everyone.


i'm doing an infopicture in which hotspots will react on ROLL_OVER and show a .png.

the result so far can be seen here:http://campjohn.dk/temp/infofoto/BigaInfofoto.html

data being loaded can be seen here:
http://campjohn.dk/temp/infofoto/BigaInfofoto.xml

the code so far in the frst frame can be seen here:

ActionScript Code:
stop();
 
//CONTEXT MENU
//-----------------------------------------------------------------------
var menuData:Array = [];
menuData.push( {caption:"© 2008 Co3", url:"http://www.co3.dk"} );
 
//IMPORTS
//-----------------------------------------------------------------------
import caurina.transitions.Tweener;
import NewCustomContextMenu;
import PreloadProgressBar;
 
//VARS & INITS
//-----------------------------------------------------------------------
var ncm:NewCustomContextMenu = new NewCustomContextMenu(menuData, this);
var _preloadProgressBar:PreloadProgressBar = new PreloadProgressBar();
var _xmlfromURL:String = "BigaInfofoto.xml";
var _xml:XML;
var _xmlloader:URLLoader = new URLLoader();
_xmlloader.addEventListener(Event.COMPLETE, onXMLLoaded);
_xmlloader.load(new URLRequest(_xmlfromURL));
var _numOfLoops:Number;
var _arrayPictures:Array = new Array();
var _arrayX:Array = new Array();
var _arrayY:Array = new Array();
var _arrayP:Array = new Array();
var _arrayLoadedInfo:Array = new Array();
var _backgroundPicture:Loader = new Loader();
var _progressColor:uint;
 
 
 
function onXMLLoaded(e:Event):void {
    _xml = new XML(e.target.data);
    trace("_xml = "+_xml);
   
    //RED DOTS AND PNG ARE GENERATED IN HOLDERS
    _numOfLoops = _xml.infospecs.length();
 
    for (var i=0; i<_numOfLoops; i++) {
       
        _arrayP.push(_xml.infospecs[i].position);
       
        //RED DOTS
        var _reddot:RedDot = new RedDot();
        addChild(_reddot);
        _reddot.name = "_reddot"+i;
        _reddot.x = _xml.infospecs[i].xpos;
        _reddot.y = _xml.infospecs[i].ypos;
        trace(_xml.infospecs[i].position);
        _reddot.addEventListener(MouseEvent.ROLL_OVER, rollOverReddot, false, 0, true);
        _reddot.addEventListener(MouseEvent.ROLL_OUT, rollOutReddot, false, 0, true);
        _reddot.mouseChildren = false;
        _reddot.buttonMode = true; 
   
        //THE .PNG'S
        var pictureHolder:Sprite = new Sprite();
        var pictureLoader:Loader = new Loader();
        pictureLoader.name = "pictureLoader"+i;
        pictureLoader.load(new URLRequest(_xml.infospecs[i].billede));
        pictureLoader.x = _xml.infospecs[i].xpos;
        pictureLoader.y = _xml.infospecs[i].ypos;
        pictureHolder.alpha = 0;
        addChild(pictureHolder);
        pictureHolder.addChild(pictureLoader);
        this.setChildIndex(pictureHolder, 0);
        pictureLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadedInfoPicture, false, 0, true);
       
        _arrayLoadedInfo.push(pictureHolder);
    }
   
    //THE BIG PICTURE IN THE BACKGROUND
    _backgroundPicture.load(new URLRequest(_xml.stortBillede));
    _backgroundPicture.contentLoaderInfo.addEventListener(Event.OPEN, handleOpen, false, 0, true);
    _backgroundPicture.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, showProgress, false, 0, true);
    _backgroundPicture.contentLoaderInfo.addEventListener(Event.COMPLETE, loadedBackgroundPicture, false, 0, true);
}
 
//ADD PRELOADPROGRESSBAR
//-----------------------------------------------------------------------
function handleOpen(e:Event):void {
    addChild(_preloadProgressBar);
    trace("loading has started");
}
 
//CONTROL THE PRELOADPROGRESSBAREN
//-----------------------------------------------------------------------
function showProgress(e:ProgressEvent):void {
    trace("loading picture");
    _preloadProgressBar.init(e.bytesTotal, e.bytesLoaded, _progressColor);
    _preloadProgressBar.doTheGraphics();
}
 
//WHEN THE BACKGROUNDPICTURE IS LOADED
//-----------------------------------------------------------------------
function loadedBackgroundPicture(e:Event):void {
    removeChild(_preloadProgressBar);
    addChild(_backgroundPicture);
    this.setChildIndex(_backgroundPicture, 0);
}
 
function loadedInfoPicture(e:Event):void {
}
 
//ON ROLL_OVER ON A RED DOT; SHOW THE PNG
//-----------------------------------------------------------------------
function rollOverReddot(e:Event):void {
    var tempName:String = e.target.name;
    trace("tempName = "+tempName);
    tempName = tempName.substr(7);
    trace("tempName = "+tempName);
   
    var tempMC:Sprite = Sprite(_arrayLoadedInfo[tempName]);
    Tweener.addTween(tempMC, {alpha:1, time:0.4, delay:0.2, transition:"linear"});
}
 
//WHEN THE RED DOT IS NO LONGER ACTIVE HIDE THE PNG
//-----------------------------------------------------------------------
function rollOutReddot(e:Event):void {
    var tempName:String = e.target.name;
    trace("tempName = "+tempName);
    tempName = tempName.substr(7);
    trace("tempName = "+tempName);
   
    var tempMC:Sprite = Sprite(_arrayLoadedInfo[tempName]);
    Tweener.addTween(tempMC, {alpha:0, time:0.4, delay:0.2, transition:"linear"});
}


in the xml each picture has a position which shall be used to place it around the red dot.
right now all pictures are placed at 0,0 which equals south east of the red dot.

but, if a red dot is placed in the lower right corner of the flash, it would be nice to be able to place its png in north west instead..

well, enough explanation, I guess

to place the pngs around the red dots I need to be able to read the height and width of each png.

can anyone help me in telling how I can read the sizes of the png, with the actionscript I have so far.. I've prepared an empty function that is ready to read the size of each png: loadedInfoPicture.

but if the function is not useable any other solution is welcome...

hope anyone can help


thanks
felisan

View Replies !    View Related
Reading The Height And Width Of Dynamically Loaded .png's
hi everyone.


i'm doing an infopicture in which hotspots will react on ROLL_OVER and show a .png.

the result so far can be seen here:http://campjohn.dk/temp/infofoto/BigaInfofoto.html

data being loaded can be seen here:
http://campjohn.dk/temp/infofoto/BigaInfofoto.xml

the code so far in the frst frame can be seen here:
Code:

stop();

//CONTEXT MENU
//-----------------------------------------------------------------------
var menuData:Array = [];
menuData.push( {caption:"© 2008 Co3", url:"http://www.co3.dk"} );

//IMPORTS
//-----------------------------------------------------------------------
import caurina.transitions.Tweener;
import NewCustomContextMenu;
import PreloadProgressBar;

//VARS & INITS
//-----------------------------------------------------------------------
var ncm:NewCustomContextMenu = new NewCustomContextMenu(menuData, this);
var _preloadProgressBar:PreloadProgressBar = new PreloadProgressBar();
var _xmlfromURL:String = "BigaInfofoto.xml";
var _xml:XML;
var _xmlloader:URLLoader = new URLLoader();
_xmlloader.addEventListener(Event.COMPLETE, onXMLLoaded);
_xmlloader.load(new URLRequest(_xmlfromURL));
var _numOfLoops:Number;
var _arrayPictures:Array = new Array();
var _arrayX:Array = new Array();
var _arrayY:Array = new Array();
var _arrayP:Array = new Array();
var _arrayLoadedInfo:Array = new Array();
var _backgroundPicture:Loader = new Loader();
var _progressColor:uint;



function onXMLLoaded(e:Event):void {
   _xml = new XML(e.target.data);
   trace("_xml = "+_xml);
   
   //RED DOTS AND PNG ARE GENERATED IN HOLDERS
   _numOfLoops = _xml.infospecs.length();

   for (var i=0; i<_numOfLoops; i++) {
      
      _arrayP.push(_xml.infospecs[i].position);
      
      //RED DOTS
      var _reddot:RedDot = new RedDot();
      addChild(_reddot);
      _reddot.name = "_reddot"+i;
      _reddot.x = _xml.infospecs[i].xpos;
      _reddot.y = _xml.infospecs[i].ypos;
      trace(_xml.infospecs[i].position);
      _reddot.addEventListener(MouseEvent.ROLL_OVER, rollOverReddot, false, 0, true);
      _reddot.addEventListener(MouseEvent.ROLL_OUT, rollOutReddot, false, 0, true);
      _reddot.mouseChildren = false;
      _reddot.buttonMode = true;   
   
      //THE .PNG'S
      var pictureHolder:Sprite = new Sprite();
      var pictureLoader:Loader = new Loader();
      pictureLoader.name = "pictureLoader"+i;
      pictureLoader.load(new URLRequest(_xml.infospecs[i].billede));
      pictureLoader.x = _xml.infospecs[i].xpos;
      pictureLoader.y = _xml.infospecs[i].ypos;
      pictureHolder.alpha = 0;
      addChild(pictureHolder);
      pictureHolder.addChild(pictureLoader);
      this.setChildIndex(pictureHolder, 0);
      pictureLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadedInfoPicture, false, 0, true);
      
      _arrayLoadedInfo.push(pictureHolder);
   }
   
   //THE BIG PICTURE IN THE BACKGROUND
   _backgroundPicture.load(new URLRequest(_xml.stortBillede));
   _backgroundPicture.contentLoaderInfo.addEventListener(Event.OPEN, handleOpen, false, 0, true);
   _backgroundPicture.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, showProgress, false, 0, true);
   _backgroundPicture.contentLoaderInfo.addEventListener(Event.COMPLETE, loadedBackgroundPicture, false, 0, true);
}

//ADD PRELOADPROGRESSBAR
//-----------------------------------------------------------------------
function handleOpen(e:Event):void {
   addChild(_preloadProgressBar);
   trace("loading has started");
}

//CONTROL THE PRELOADPROGRESSBAREN
//-----------------------------------------------------------------------
function showProgress(e:ProgressEvent):void {
   trace("loading picture");
   _preloadProgressBar.init(e.bytesTotal, e.bytesLoaded, _progressColor);
   _preloadProgressBar.doTheGraphics();
}

//WHEN THE BACKGROUNDPICTURE IS LOADED
//-----------------------------------------------------------------------
function loadedBackgroundPicture(e:Event):void {
   removeChild(_preloadProgressBar);
   addChild(_backgroundPicture);
   this.setChildIndex(_backgroundPicture, 0);
}

function loadedInfoPicture(e:Event):void {
}

//ON ROLL_OVER ON A RED DOT; SHOW THE PNG
//-----------------------------------------------------------------------
function rollOverReddot(e:Event):void {
   var tempName:String = e.target.name;
   trace("tempName = "+tempName);
   tempName = tempName.substr(7);
   trace("tempName = "+tempName);
   
   var tempMC:Sprite = Sprite(_arrayLoadedInfo[tempName]);
   Tweener.addTween(tempMC, {alpha:1, time:0.4, delay:0.2, transition:"linear"});
}

//WHEN THE RED DOT IS NO LONGER ACTIVE HIDE THE PNG
//-----------------------------------------------------------------------
function rollOutReddot(e:Event):void {
   var tempName:String = e.target.name;
   trace("tempName = "+tempName);
   tempName = tempName.substr(7);
   trace("tempName = "+tempName);
   
   var tempMC:Sprite = Sprite(_arrayLoadedInfo[tempName]);
   Tweener.addTween(tempMC, {alpha:0, time:0.4, delay:0.2, transition:"linear"});
}

in the xml each picture has a position which shall be used to place it around the red dot.
right now all pictures are placed at 0,0 which equals south east of the red dot.

but, if a red dot is placed in the lower right corner of the flash, it would be nice to be able to place its png in north west instead..

well, enough explanation, I guess

to place the pngs around the red dots I need to be able to read the height and width of each png.

can anyone help me in telling how I can read the sizes of the png, with the actionscript I have so far.. I've prepared an empty function that is ready to read the size of each png: loadedInfoPicture.

but if the function is not useable any other solution is welcome...

hope anyone can help


thanks
felisan

View Replies !    View Related
Dynamically Changing Movie Height Parameter?
I'm trying to make an expandable/collapsible tree menu in flash, but do not want to leave all the white space at the bottom when the tree is completely collapsed. I'm looking for a way to change a SWF's height dynamically, so that only when the tree is expanded does the flash movie actually take up all the extra space on the page.

Any clue how to accomplish this? There is an example here:
http://www.mustardlab.com/developer/flash/objectresize/index.php

that does pretty much what I want, but it is a bit complicated for my needs and doesn't work on some of the systems I'm designing for.

Thanks in advance!

View Replies !    View Related
[F8] Determining Selected Text
I need to return a substring that is selected from an dynamic or input text box. i.e. I have a textbox containing "FlashKit is the best forum ever" that is selectable, if I highlight "best forum" and click a button (or use the contex menu, as clicking a button might make the text box lose focus) I need to return the string "best forum".

I've looked into the textsnapshot class and the replaceSel function, but I am not sure if those can help.

One possible way would be if I could somehow add html tags around the text, then I could easily extract the text out.

Any ideas or solutions would be much appriciated,

jtnw

View Replies !    View Related
Help Determining Text Width
I am trying to right-justify some text in a progress bar that only shows up when the progress bar width is big enough to display the entire text. Otherwise, the text shows up outside of the progress bar.

After tinkering with textFormat.getExtent() and _width properties for about an hour, I figured I'd write a little script to test the _width property if the textField's autosize parameter was set to true:


ActionScript Code:
button.onPress = function () {
    this._parent.SimpleText.text="";
    this._parent.SimpleText.autoSize=true;
    var t=Math.random()*20;
    for (var i=1;i<t;i++) {
        this._parent.SimpleText.text+="a";
    }
    trace (this._parent.SimpleText._width);
}


it worked just fine where I got the variable width each time I pressed the button.


So I thought I was doing the same thing when I wrote this script for my preloader bar:


ActionScript Code:
onClipEvent(enterFrame) {
        this.percentLoaded.autoSize=true;
    this.percentLoaded.text=this._xscale+ "%";
var offset:Number =this.percentLoaded._width;
    this.percentLoaded.text._x=(this._x+this._width)-offset-5;
    this.percentLoaded._visible=(this._width>=offset);
}


and for now I just wrote a loop to increment _xscale oft he mc above to loop from 0 to 100;

The funny thing is that when I trace the values of this.percentLoaded._width, I get the craziest values:




45
37687.2
2287.85
1145.9
773.05
579.3
463.55
386.55
333.1
291.65
259.5
323.7
295.25
270.8
250.15
232.45
217.15
204.1
192.25
181.7
172.3
164.1
156.4
149.45
143.05

What is going on here?

Thanks in advance for any input,

best wishes,

jase

View Replies !    View Related
Dynamically Changing Height Of Movieclips - A Slight Prob
Hi Guys

I have a simple movieclip on my stage which has two vertical lines in both of which have their properties set to hairline. I can make the movieclip larger in height using actionscript which is no problem and works fine however the more you increase the height of the clip the thicker my two lines become. I didnt think this was an issue if the lines where set to hairline?

Anyone have any experience of this?

View Replies !    View Related
Moving Movieclips Dynamically Based On Eachothers Height
Hey guys,

I have a bunch of movieClips that I place on the stage one after the other vertically, they are pretty much just news posts, with the first bit of news displayed, and the rest hidden under a mask.

There is a button on each that expands the mask to display the rest of the content, and I am trying to move all of the movieClips down that are below the one expanding, to make room...and vice versa, moving them back up when they un-expand the text.

I need some help figuring out the logic on how I should do this. I am kinda stuck. The mask is moving with Tweener, and I have the data of how large the expanded news post is, but how should I go about automatically moving the news posts below based on the height of the news clip that is expanding?

Thanks so much!

View Replies !    View Related
Dynamically Loading Of JPGs, Reading Height And Width
I have made a .swf that reads in a whole load of JPGs. It draws an outline around the picture using the _height and _width properties. It works fine on my machine due to the fact that the JPGs load quickly. But when i publish it on the web the outline goes dodgy because the _height and _width values are undefined. once the JPGs have been loaded once its fine because the values are defined.

Has anyone had this problem?

I can think of a few solutions:
Wait until _height != undefined
Wait until a little of the JPG is loaded (1%) and then use the _height property

If anyone has a better way i'd be very happy

Cheers,

Matty C

www.matt.nildram.co.uk/skitrip if you want to look.

View Replies !    View Related
Dynamically Generated Movieclips Report Incorrect Height
I am developing in AS3 and FP9. My project creates dynamic movie clips and puts various UIs in them and then adds them to the stage. I was creating a routine to lay them out automatically and found that the height property reported from the dynamically created clip was twice what the actual height was. Of note is the actual height of the movie clip as displayed in the SWF is correct but somehow the property value from a get operation is double what it should be. The issue is easily resolved by dividing the reported value by 2 however i am wondering if an update to flash player will break the application. Does anyone know if this is a official bug or has run into in their development efforts? any help would be greatly appreciated

View Replies !    View Related
Positioning Dynamically Created MC's W/ Variable Height Along Y Axis
My code works fine as long as all the dynamically created MC's have the same height.

The following pulls in data from an array structured as such:


Code:
elements1= [
{file:"image1.jpg", sequence:0, header: "", description:"Text One", VRname: "Sample1" },
{file:"image2.jpg", sequence:1, header: "I'm a subheading", description:"Text Two", VRname: "Sample2" },
{file:"image3.jpg", sequence:2, header: "", description:"Text Three", VRname: "Sample3" },
{file:"image4.jpg", sequence:3, header: "", description:"Text four", VRname: "Sample4" }
];

arraySet = elements1
.... to populate dyamically created text fields through this function:

Code:
function pickArray(arraySet) {
for (i = 0; i < arraySet.length; i++) {
listholder.createEmptyMovieClip(["MC"+i], i*2 );
listholder["MC"+i].createTextField("vrname",this.getNextHighestDepth(),120,0,0,0);
listholder["MC"+i].vrname.embedFonts = true
listholder["MC"+i].vrname.text = arraySet[i]["VRname"]
listholder["MC"+i].vrname.autoSize = "right";
listholder["MC"+i].vrname.selectable = false;
listholder["MC"+i].vrname.setTextFormat(textAppearance);
listholder["MC"+i]._y = (i * listholder["MC"+i]._height)

}
This works fine if all dynamically created MC’s have the same height. However, the code breaks as soon as I append information from the header category of my array with the following line:

Code:
listholder["MC"+i].vrname.text = arraySet[i]["VRname"] + "
" + arraySet[i]["header"]
Only one record in the array has information contained in the header category, so the height of the MC containing those two lines of text is greater than the others.

I tried numerous combinations to add each MC's­­ height to the equation, but noting I attempt seems to work.

This:

Code:
listholder["MC"+i]._y = (i * listholder["MC"+i]._height) + listholder["MC"+i]._height
and this:

Code:
listholder["MC"+i]._y = (i * listholder["MC"+i]._height) + 44
only add values to the top of the list, pushing everything down from its initial y=0 position.

Searching the archives found an old posting from 2004 with the same issue, but seems to have gone unanswered:

http://www.kirupa.com/forum/showthre...ic+positioning

I may be going about this all wrong. I coded my app without realizing that some of my text links would require a main heading with sub links. So I'm not even sure this scenario will work. But I’ll deal with that issue later. Right now, this problem has bitten into me and I'm obsessed with finding a solution.

Hope anyone can help.

Thanks!

View Replies !    View Related
Changing The Height & Width Of A Dynamically Loaded Image
I have been working on a project for a few days now, where I am loading images dynamically. Right now I am running into the problem of getting the height and width of the image correct. Basically I'm creating a flash file that will be used as a news applet on many of the sites I maintain. It needs to call files from a database (this part will come later, once I get the main part of it working).

Right now I have done everything through actionscripting, so the stage is blank. Here is the code I am using to call in the image as well as what text is getting pulled.


Code:
//Story1Image
// Creates a movie clip to hold the container.
this.createEmptyMovieClip("image_mc", this.getNextHighestDepth());
// Loads an image into image_mc.
image_mc.loadMovie("http://www.skiltech3.com/images/seating.gif");

//Story1Text
this.createTextField("my_txt", this.getNextHighestDepth(), 5, 130, 190, 100);
my_txt.border = 1;
my_txt.html = true;
my_txt.scroll = false;
my_txt.multiline = true;
my_txt.wordWrap = true;
var my_fmt:TextFormat = new TextFormat();
my_fmt.color = 0x330099;
my_fmt.font = "Arial";
my_txt.htmlText = "<b>Test Text</b><br>If you see me I work. If you see me I work.";
my_txt.setTextFormat(my_fmt);
Basically it will have two stories being shown at a time, and then rotate through them. If anyone knows how to make that image so that it would be lets say 190 wide and 150 high, that would be a great help.

Matt

View Replies !    View Related
Dynamically Sizing Clip To Stage Width+height
so i guess what the real question is is how would make the movieclip smart enough to know when its reached the top of the stage and bottom from different positions on the stage.

i have a button that is duplicated three times one after the other. so when they resize even though they are now equal to 600 in height (my stage is 800x600) they are not positoned isnt equal to the top and bottom of the stage.

here's my code as it stands now:

sW=Stage.width;
sH=Stage.height;

fillScreen= function (clip) {
speed = 4;
clip.onEnterFrame = function() {
this._height += (sH - this._height)/speed;
if(Math.round(this._height) >= sH){
this.onEnterFrame = null;
trace(this._name+" equals null");

} else {
trace("AAA" + _parent._name + "not equal to stage");
trace("BBB" + "sH value: " + sH);
trace("CCC" + "this._height equals: " + this._height);
}
};
};
i hope that makes sense
thanks for the help

erase

View Replies !    View Related
Loading JPG Dynamically Into Movie Clip--but Can't Find Height/width
I'm loading jpgs using this:

Code:
currentClip = createEmptyMovieClip(_global.arr_fileName[cID], 100);
currentClip.loadMovie("photos/thumbnails/" + _global.arr_fileName[cID]);
But currentClip._height and currentClip._width evaluates to 0...shouldn't the movie clip have the same height and width as the jpg?

View Replies !    View Related
Resizing Photo Gallery Border Width & Height Dynamically
can anyone point me in the direction of how to make a photo gallery that can do this:

http://www.memferda.com/index2.php

The border width and height changes from link to link.

This photographer gave me all these pictures to work with for his gallery that all have different sizes!?

Thanks so much

View Replies !    View Related
Attaching Clips Dynamically And Setting _y Based On Clip Height
I'm looping through xml and attaching clips. I'm trying to find a way to attach the clips while the clips may be varying in height (dyn text box in clip set to autoSize)

i've tried several diff attempts but i'm not sure how to position the clip based on the position of the previous clip.

if i could figure out a way to reference the previously attached clip ('item' in this case...see below) i could take that previous clip's _y and subtract it's height and add any spacing and bam! but i'm not sure how to ref that previously attached clip...

yoinks!


Code:
blogXML=new XML;
blogXML.ignoreWhite=true;
blogXML.onLoad=function(success){
if(success){

trace(this.status);
//create array
menuItems = blogXML.firstChild.childNodes;
trace(menuItems);
var space = 10;
//loop through array
for (var i=0; i<menuItems.length; i++) {

item = _root.holder.attachMovie("dynClip", "dynClip" + i, i);
item.textBox.autoSize = true;
item.textBox.text = menuItems[i].attributes.description;
trace(item.textBox._height);
item.link= menuItems[i].attributes.link;
//item.backGround._height=textHolder.textBox._height+20;
var ypos = item._y+item._height+space;
item._y = ypos;
item._x=_root.holder._x;
}
}
}


//dontCache = getTimer();
//blogXML.load("blog.xml?var="+dontCache);
blogXML.load("blog.xml");

View Replies !    View Related
Dynamically Change Stage Size Depending On Content Height
Hi guys

I'm asking myself how I resize (or tween-resize) the size of a flash movie depending on its content.

Take a look at: http://www.pierinc.com
When you click on a new page, the stage size resizes depending on how large the page is.

Do I have to use javascript to do this (because I can't find the javascript on the pier website to take a look at it).
Or can I do this with actionscript?

Thanks in advance
Arcko Drazen

View Replies !    View Related
Determining The Number Of Lines Of Text In A Dynamic Textfield?
Hi folks,

Is it possible to determine the number of lines in a dynamic textfield?

I'm importing xml on the fly and want to be able to determine the size of the textfield or number of lines of text imported. If Flash can determine .scroll and .maxscroll then it must know the number of lines of text. How do I access this?

Any ideas?
Thanking you

DM

View Replies !    View Related
Determining Previous Text Field Created By A For Loop
I am looping through and XML file to create dynamic text fields that contain the name of the link, I am getting everything added to stage but i run into the problem of positioning the text field that is being created below the previous text filed.

in my for loop i tried creating a variable j = i-1 it works fine with positing the first text filed but then when i try to position the second field being created i get this error. Am I even going about this the right way? is their an easier way of getting the properties of the previous text filed that was created?



Code:
Movie Loaded, movie on
ReferenceError: Error #1069: Property 0 not found on flash.text.TextField and there is no default value.
at Landing_v2_003_fla::menu_5/buildFile()
at Landing_v2_003_fla::menu_5/onXMLComplete()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()
here is my code


Code:

stop();

var myXML:XML;
var linkList:XMLList;
var xmlLoader:URLLoader = new URLLoader();
var xmlRequest:URLRequest = new URLRequest("demoMenu.xml");

xmlLoader.load(xmlRequest);
xmlLoader.addEventListener(Event.COMPLETE, onXMLComplete);

function onXMLComplete(e:Event):void
{
myXML = new XML(e.target.data);
linkList = myXML.children();
removeEventListener(Event.COMPLETE, onXMLComplete);
buildFile();
}
function buildFile():void
{
title_txt.htmlText = "<b>" + myXML..attribute("title") + "</b>";
title_txt.selectable = false;
title_txt.multiline = false;
title_txt.autoSize = "left";
//define links format
var linksFormat:TextFormat = new TextFormat();
linksFormat.align = "left";
linksFormat.bold = true;
linksFormat.font = "Verdana";
linksFormat.color = 0xFFFFFF;
linksFormat.indent = 10;
//addlinks
for(var i:int = 0; i < linkList.length(); i++)
{
var links_txt:TextField = new TextField();
//set the properties
links_txt.name = "links_txt" + i;

links_txt.selectable = false;
links_txt.multiline = true;
links_txt.wordWrap = true;
links_txt.autoSize = "left";
links_txt.width = 130;
//links_txt.y = i*20+50;
//set the text and add it to the stage
links_txt.htmlText = "<b>" + linkList[i].attribute("linkName") + "</b>

";
var j:int = i-1;
if(j == -1)
{
links_txt.y = 50;

}else{
links_txt.y = links_txt[j].height + links_txt[j].y+15;
}

links_txt.setTextFormat(linksFormat);
addChild(links_txt);

}
}

View Replies !    View Related
Setting The Height Of The Dynamic Text To Automatically Fit The Text Inside.
Well i have a dynamic text box that loads an external text file. I want the dyn. text box to automatically re-adjust the height so that it will fit the text. Is there anyway to do this without distorting the text?

View Replies !    View Related
Text.Height For Loaded .php File Into Text Field
Hi,

I'm doing some basic linking of a Database to flash, loading text from a "content.php". Structure of php file is like:

myVar=TextGoesHere

I have a dynamic text box inside a movie clip that correctly displays the text. But the text box doesnt automatically resize. If I set it as 300 height, it'll show however much can fit in there. How can i fix this to make it resize itself?

Heres the code that is on the movieclip:


Code:
onClipEvent (load) {
loadVariables("Content.php", this, "GET");
}
And I simply have "myVar" set as the variable in the text box. I have made this work before by resizing the movieclip using the text.Height. But when I try and trace the text height from this, I just get 0.

Thanks in advance!

View Replies !    View Related
How Can I Get The Height Of A Dynamic Text Box (once Text Loaded)?
Hi,

I have an easing scroller which automatically adjusts the scrollbar to the contents of its contents clip (mc_content).

I have inserted a dynamic text box, which loads in an news.html file.

However, The text cuts off (basically stays the same as the initial dynamic text field size), and does not adjust automatically to reveal the full text.

How can I get the height value of this dynamic text box, after the text has been loaded in? I could then use this to set the height of the mc_back movie clip (an invisible mc alpha 0) so it reveals all the text...I will upload the scroller if you like...

Thanks

Jpixels

View Replies !    View Related
Copyright © 2005-08 www.BigResource.com, All rights reserved