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




Populating A Dynamic Text Area With A For Loop?



Hey there,

I am trying to output a 'for loop' to a dynamic text box so I can use the individual output as a Nav Bar. The loop is going through my XML document and is pulling out a specific node (as you'll see in my code below).


Code:
function topNav(navNode) {
for (var n = 0; n<navNode.childNodes.length; n++) {
trace(rootNode.childNodes[n].childNodes[2].childNodes[0].nodeValue);
navArea = rootNode.childNodes[n].childNodes[2].childNodes[0].nodeValue;
}
};
In the output window in Flash, I am able to see the specific childNodes displayed. However, in the Flash file itself, in the dynamic text area I have defined (navArea), I am only seeing the last childNode in the XML document.

That makes sense, since I'm asking for navArea = rootNode.childNodes[n].childNodes[2].childNodes[0].nodeValue and "n" in our case has already gone through the for loop and holds the value of the last node.

I need to know how to output to the dynamic text area each childNode that is looped through. So...if there are 10 Nodes that this function loops though, I need to be able to see 10 text items in my dynamic text box.

Any suggestions?



FlashKit > Flash Help > Flash ActionScript
Posted on: 05-27-2004, 01:50 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Populating A Dynamic Text Area With A For Loop?
Hey there,

I am trying to output a 'for loop' to a dynamic text box so I can use the individual output as a Nav Bar. The loop is going through my XML document and is pulling out a specific node (as you'll see in my code below).


Code:
function topNav(navNode) {
for (var n = 0; n<navNode.childNodes.length; n++) {
trace(rootNode.childNodes[n].childNodes[2].childNodes[0].nodeValue);
navArea = rootNode.childNodes[n].childNodes[2].childNodes[0].nodeValue;
}
};
In the output window in Flash, I am able to see the specific childNodes displayed. However, in the Flash file itself, in the dynamic text area I have defined (navArea), I am only seeing the last childNode in the XML document.

That makes sense, since I'm asking for navArea = rootNode.childNodes[n].childNodes[2].childNodes[0].nodeValue and "n" in our case has already gone through the for loop and holds the value of the last node.

I need to know how to output to the dynamic text area each childNode that is looped through. So...if there are 10 Nodes that this function loops though, I need to be able to see 10 text items in my dynamic text box.

Any suggestions?

Populating Dynamic Text Within A MC?
I'm trying to set up a dynamic text box inside a MC that is animated at the root level.

The problem is, the text box won't import the text unless it's on the root level. I tried targeting paths and everything and still no go.
Is it not possible to import text when a text box isn't on root level?

Populating Dynamic Text From XML
This post is about a project I'm working on in Flash CS3, using ActionScript 3 and an external XML file. This is my first post on the forums, and (coincidentally) my first ActionScript 3 project!

I am trying to populate dynamic text fields in a movie clip generated by ActionScript using data from XML. The line is formatted like so (leaving out the array brackets to avoid code confusion):


Code:
clip.txt = xmlList.vname
When I run the file like this, the movieclips appear but are empty. I then modify the code this way:


Code:
clip.txt.htmlText = xmlList.vname
This generates Error #1010: "A term is undefined and has no properties."

Can any of you AS gurus out there give me a hand? Thanks in advance.

Populating A Dynamic Text Box
hello people, i seem to be having a problem with populating a text box, for example: i have 4 buttons with for differant email address in, when i click on one of those buttons i want a textbox on the next frame automatically to display the email addy in the to box of my email form. this is my code:
Code:
on (release) {
_root.form.toemail.text = "david@myemail.com";
gotoAndStop(16);

}
however instead of the box contining the email it contains this - level0.form.toemail - can anyone see were im going wrong? thank you in advance.

Targeting And Populating Dynamic Text Field
To anyone who's willing to assist. I have a problem with populating a dynamic text field in a loaded movie clip with instance names of "headline" and "templateA", respectively. The loaded movie clip is in _root. Here's what I have but it doesn't work (not sure if it's possible)

loadMovie("skyShell.swf", templateA);
templateA.headline.text = "some text for the text field"

Any assistance is greatly appreciated.

Populating Dynamic Text Fields With Arrays
I'm trying to populate a dynamic text field with an array. Each element would be on a seperate line. As in:

text field:
item1
item2
item3

If anyone has any commented movies or tutorials on creating drop-down menus using arrays that would be great too.

Populating A Dynamic Text Field With Xml Information?
Heya community;

My name is Wes Burke, and I am officially dove into the world of AS3, coming from a designer, 3D modeler background. I have dabbled in code slightly, but really making an effort to nail this one down. //end soppy introduction.

I am learning how to pull data from an xml file, and the end result will be a community map with unique data per each lot on the community map, though I am still at the ground floor of this mug.

I have successfully traced the data I would like to have populated on my dynamic textfields into a movieClip.

The bump in the road I am running into is, I will have up to 100 individual buttons on the stage that have to pull unique data from the XML. What would be the best way to match them up with their correct nodes in the XML? Should I set up a search, or any suggestions would be welcome to set me on my way.

Originally i was thinking:

If objects ID == Node ID
then populate text fields with the children of that Node


Appreciate the feedback

W

[fmx] Populating Dynamic Text Fields With Arrays
I'm trying to populate a dynamic text field with an array. Each element would be on a seperate line. As in:

text field:
item1
item2
item3

If anyone has any commented movies or tutorials on creating drop-down menus using arrays that would be great too.

Populating A Dynamic Text Field With Xml Information?
Heya community;

My name is Wes Burke, and I am officially dove into the world of AS3, coming from a designer, 3D modeler background. I have dabbled in code slightly, but really making an effort to nail this one down. //end soppy introduction.

I am learning how to pull data from an xml file, and the end result will be a community map with unique data per each lot on the community map, though I am still at the ground floor of this mug.

I have successfully traced the data I would like to have populated on my dynamic textfields into a movieClip.

The bump in the road I am running into is, I will have up to 100 individual buttons on the stage that have to pull unique data from the XML. What would be the best way to match them up with their correct nodes in the XML? Should I set up a search, or any suggestions would be welcome to set me on my way.

Originally i was thinking:

If objects ID == Node ID
then populate text fields with the children of that Node


Appreciate the feedback

W

[fmx] Populating Dynamic Text Fields With Arrays
I'm trying to populate a dynamic text field with an array. Each element would be on a seperate line. As in:

text field:
item1
item2
item3

If anyone has any commented movies or tutorials on creating drop-down menus using arrays that would be great too.

LoadVars() Not Populating Dynamic Text Field...
Hello,

I have a Flash header for a site that I want to load content for from a text file, making it easier to update the header rather than editing the Flash file each time. I have my variables in a text file, but I can't seem to get the dynamic text box to update properly. Here's the code I'm using:


Code:
var load_lv = new LoadVars;
_global.load_lv = load_lv;
_global.load_lv.onLoad = function(success) {
/*if (success) {
trace (" variables loaded ");
for( var prop in this ) {
trace (" key " + prop + " = " + this[prop]);
}
} else {
trace (" Error loading variables ");
}*/
trace("Before: "+_root.main_mc.meeting_mc.nextMeeting_txt.text);
_root.main_mc.meeting_mc.nextMeeting_txt.text = this.nextMeetingDesc;
trace("LoadVars: "+this.nextMeetingDesc);
trace("After: "+_root.main_mc.meeting_mc.nextMeeting_txt.text);

}
_global.load_lv.load("./data.txt");
Because I want to use the same LoadVars object for multiple text boxes, I decided to make it a global object so it can be accessed from any object in my movie. The weird thing is that the traces come out perfectly - the traces to the nextMeeting_txt.text property show that it contains the correct text before and after the load, however the textbox in the compiled SWF ends up being blank, which means that it's been changed (because the default text I put in is no longer there), but it isn't rendering the new text.

Anybody have any idea what's going on?!?

Thanks,
Nate

Populating Dynamic Text Field From A Database
I have created a series of dynamic text fields that i want to populate from a database. I have this working without any problems. Problems arrise however when i want to embed the font which will appear in the textfield. Basically, once i set the embed command the fonts are not appearing at all. I have tried both the methods of including font via library linkage and dummy text field. Without the embed font code works fine. As soon as i put in this line of code nothing appears.

Code is as follows

this.createTextField("tfNewfield", 1, 80, 10, 150, 15);
tfNewfield.text = _global.titlo1;
tfNewfield.selectable = false;
tfNewfield.autoSize = true;
tfNewfield._highquality = 2;
tfNewfield._variable = titolo1;
tfNewfield.textColor = 0x9B603C;
tfNewfield.embedFonts = true; //this is the line which upsets things
fmtEmphasis = new TextFormat();
fmtEmphasis.size = 13;
fmtEmphasis.font = "TradeGothic BoldTwo";
tfNewfield.setTextFormat(fmtEmphasis);


any feedback would be appreciated.

[CS3] Populating Dynamic Text Field With Multiple Variables
I have a Dynamic text field that is pulling in data from an external txt file. My txt file has multiple variables. Everything is fine with the txt file and loading any one of the single variables, it works fine. My questions is...

- When the movie starts I need the dynamic field to load the first variable [txt file: text=My first variable] then...

-I have three buttons and when rolled over I want the text field to replace the current variable with whichever buttons variable is rolled over, once the user rolls out I want the original [variable 1] to reappear in the dynamic text field.

For example...
onLoad, display variable 1.
onRollOver btn1, display variable 2.
onRollOver btn2, display variable 3.
then, on any rollOut go back to variable 1.

I have been having an unusually hard time getting this to work, ANY help with this would be greatly appreciated, thanks

Best Method For XML Content, Multiple Comboboxes, Populating Dynamic Text
Hi folks,

Im looking for some input on the following project. In principle I have a good idea of what shold happen, but its the implementation i'm unsure of.

Basically I built a CDROM in Flash with a bunch of podcasts on it for an event. It went down really well and now they want to release a regular version. In order to manage the regular updates in an efficient manner, i'd like to set up the content externally using XML and do the wizardry with AS3.

The scenario is this, at the moment there are 6 business units but as this gets bigger more will be added (up to 10). Every business unit has its own podcasts, of varying numbers. The podcast CD is 2 screens - an introduction and the podcasts lists(buttons), and a second screen with the flv/mp3 player and the podcast details.

So in principle i need to do is load in the XML, and for every business unit, add a combo box to screen 1, underneath the last one, and populate it with the names of the podcast. When a podcast is selected from the drop down i need to transition to screen 2, populate the dynamic text fields with the specific podcasts details and play the movie.

The guts of the XML will look something like this i guess:

Code:
<businessunit id="">
<podcast>
<path></path>
<title></title>
<overview></overview>
<cta></cta>
</podcast>
<podcast>..........
</podcast>
</businessunit>
<businessunit id="">
<podcast>..........
</podcast>
</businessunit>
The real question for me is, what is the best way of populating multiple comboboxes and how do i track/populate the second screen from the selection on screen 1. I don't really want to ID every podcast so using their position in the XML structure would be a better means of ID for me? There are a few potential options I see for handling the XML - reading all the data into arrays, but seems a bit antequated; using the new E4X syntax; and there's potentially XMLLIST?!

So really not sure what to do for best here - any help or examples much appreciated!!!

Populating Dynamic Text Field With Form Data From Previous Frame
I've got a dynamic text field (name) and I'd like to populate it with the values from two fields in a form from a previous frame. Does anyone know how to transport user-input values from one frame to another frame?

Here's the code I'm using to capture the user-entered data:

var submitListener:Object = new Object();
submitListener.click = function(evt:Object) {
var result_lv:LoadVars = new LoadVars();
result_lv.onLoad = function(success:Boolean) {
if (success) {
result_ta.text = "Thank you for completing this training module.";
} else {
result_ta.text = "Error connecting to server.";
}
};
var send_lv:LoadVars = new LoadVars();
send_lv.fname = fname.text;
send_lv.lname = lname.text;
send_lv.email = email.text;
send_lv.sendAndLoad("

Populating An Array With Loop
Hey guys, here is the deal. I am having hard time populating myArray with for loop. This is what i need to accomplish

myArray = new Array();
for (i=0;i<25;i++){
/* how to make it add new value to myArray every time it goes through the loop*/
myArray = ????
}

at the end i need myArray(1,2,3,4,5,6,.......)

thanks

Populating An Array With A Loop?
Hi...

I was wondering if it is possible to populate an array using a loop. For example, I need to create an array with a large number of images (ie img0, img1, img2 ...), but don't want to type each in manually. It would be easier, in my head, to create a loop that i could set the length, and it would create my array with img0, img1, img2 ... up to the predefined length. Any ideas? Thanks in advance!

Kris

Populating An Array With A Loop?
Hi...

I was wondering if it is possible to populate an array using a loop. For example, I need to create an array with a large number of images (ie img0, img1, img2 ...), but don't want to type each in manually. It would be easier, in my head, to create a loop that i could set the length, and it would create my array with img0, img1, img2 ... up to the predefined length. Any ideas? Thanks in advance!

Kris

Dynamic Text Area
I'm pulling in some text from a php file and it's being cut-off by the height of the dynamic text area in Flash.

Is there any way to make the text area expand with the amount of text?

Dynamic Text Area
I have a question. On the website I work with right now I have two Dynamic text areas. Both of them are rotated, so I had to set "Embed Font Outlines For" to "All Characters" and it works perfect on the one of them that reads text from an txt file, the other one is a guestbook that also reads from a txt file, but with All Characters setting in the "Embed Font " menu it shows only the first entry of the guestbook. The rest dissapears. What could it be?

ask for more information

Vertical Align Text In Dynamic Text Area
Have just created my first database driven dynamic text box and it works

Just one problem...

One of the dynamic text areas is multi-line and try as I might I can't seem to find any way to set the vertical alignment of the text to 'middle' vertically...

i.e. if the text is only a couple of words, it aligns to the top of the textarea and I'd like it to align to the middle of the text area vertically.

Any ideas???

Thanks

dominicall

[mx2004] Text Area Component Vs. Dynamic Text Box
Hi I have made this which works exactly how I want it to using a text area component

http://www.goslinganimation.com/wall/test2_b.swf

Now I want the same thing but using a dynamic text box instead.

This is the code I have used

Code:
var fontType = "font1";

messageBox.text = "This is a message test. Blah blah blah";

// define the font styles
var styleObj = new mx.styles.CSSStyleDeclaration();
styleObj.styleName = "styleOne";
_global.styles.styleOne = styleObj;
styleObj.setStyle("fontFamily", "space cowboy.");
styleObj.setStyle("fontSize", 20);
styleObj.setStyle("fontWeight", "bold");
styleObj.setStyle("themeColor", "haloOrange");

var styleObj = new mx.styles.CSSStyleDeclaration();
styleObj.styleName = "styleTwo";
_global.styles.styleTwo = styleObj;
styleObj.setStyle("fontFamily", "Jennifer's Hand Writing");
styleObj.setStyle("fontSize", 16);
styleObj.setStyle("fontWeight", "bold");
styleObj.setStyle("themeColor", "haloOrange");

var styleObj = new mx.styles.CSSStyleDeclaration();
styleObj.styleName = "styleThree";
_global.styles.styleThree = styleObj;
styleObj.setStyle("fontFamily", "delarge marker pen");
styleObj.setStyle("fontSize", 15);
styleObj.setStyle("fontWeight", "bold");
styleObj.setStyle("themeColor", "haloOrange");

//------------------------------------------------

if (fontType == "font1") {
messageBox.setStyle("styleName", "styleOne");
} else if (fontType == "font2") {
messageBox.setStyle("styleName", "styleTwo");
} else {
messageBox.setStyle("styleName", "styleThree");
}
any ideas?

Dynamic Text Area Resizes Itself...
I'm using a dynamic text area with a scroll bar component to make a scrolling text area. it appears to work without problems but then randomly resize itself to fit all the text in the area. i've set it to multiline, called the textarea in the parameters section for the scroller. This is really starting to annoy me because i keep on having to recreate the text area from scratch. would really appreciate any ideas people might have.

Problems With Dynamic Text Area PLEASE HELP ME
hello,

I've got a lot of problems with dynamic text area

I built a movie (biography.swf) which has a dynamic text area. On frame 1 of this movie there's this action

_root.textArea = loadVariablesNum("textFile.txt", 0,"POST");
updateAfterEvent();
stop();

When I test this movie everything goes well.

Then I built another movie (main.swf) which has a target movie clim (named target). I have to load biography.swf in target movie clip of main.swf in order to view textFile.txt loaded in dynamic text area.

I wrote this action on mail.swf:

loadMovie("biography.swf",target);

When I test main.swf nothing happens.
How do I have to do? Please help me!

Thanks a lot!

Pictures In Dynamic Text Area?
Might there be a way to place photos in the text or dynamic text area? Photos linked from other sources?

For instance the " <img src= " tag.


I'm trying to create a scoll area of many thumnail images with text links next to them. I can do the external website links with no problem. It's inseting photos where my problems start.

Even if I could find a way to just use thumnail images inside of Flash... that would be alright too I guess.


Thank You
- Dan

Different Dynamic Text Area Question...
Hi all

I have a dynamic text area which reads from a .txt file. All works well and I'm quite happy with it.

However, I cannot for the life of me, work out how to format the text - ie make some elements bold, as para headers.

Can a dynamic text box parse html? Is that the way to do it?

Look forward to sorting this one out.

Thx for any help.

Cello

News In Text Area Dynamic
Hi! i have some trouble with my portal system news, i have a text area (dynamic text) and selected the Apply HTML tags, in the frame 1 i have the action script like this:

Code:
news="<b>New1</b><br>Welcome.<a href='http://www.myweb..com'>visit my web</a>";
The Text Area have the var news, all works fine, except the hyperlink, the linl go fine, but the active zone is all the height of the movie... like this:

The zone with red mark is the zone active.
I want only the "visit my web" have the hyperlink efect, how can i do ?
thx

Pictures In Dynamic Text Area?
Might there be a way to place photos in the text or dynamic text area? Photos linked from other sources?

For instance the " <img src= " tag.


I'm trying to create a scoll area of many thumnail images with text links next to them. I can do the external website links with no problem. It's inseting photos where my problems start.

Even if I could find a way to just use thumnail images inside of Flash... that would be alright too I guess.


Thank You
- Dan

Text Area Component Vs. Dynamic Text Box
Hi I have made this which works exactly how I want it to using a text area component

http://www.goslinganimation.com/wall/test2_b.swf

Now I want the same thing but using a dynamic text box instead.

This is the code I have used

Code:
var fontType = "font1";

messageBox.text = "This is a message test. Blah blah blah";

// define the font styles
var styleObj = new mx.styles.CSSStyleDeclaration();
styleObj.styleName = "styleOne";
_global.styles.styleOne = styleObj;
styleObj.setStyle("fontFamily", "space cowboy.");
styleObj.setStyle("fontSize", 20);
styleObj.setStyle("fontWeight", "bold");
styleObj.setStyle("themeColor", "haloOrange");

var styleObj = new mx.styles.CSSStyleDeclaration();
styleObj.styleName = "styleTwo";
_global.styles.styleTwo = styleObj;
styleObj.setStyle("fontFamily", "Jennifer's Hand Writing");
styleObj.setStyle("fontSize", 16);
styleObj.setStyle("fontWeight", "bold");
styleObj.setStyle("themeColor", "haloOrange");

var styleObj = new mx.styles.CSSStyleDeclaration();
styleObj.styleName = "styleThree";
_global.styles.styleThree = styleObj;
styleObj.setStyle("fontFamily", "delarge marker pen");
styleObj.setStyle("fontSize", 15);
styleObj.setStyle("fontWeight", "bold");
styleObj.setStyle("themeColor", "haloOrange");

//------------------------------------------------

if (fontType == "font1") {
messageBox.setStyle("styleName", "styleOne");
} else if (fontType == "font2") {
messageBox.setStyle("styleName", "styleTwo");
} else {
messageBox.setStyle("styleName", "styleThree");
}
any ideas?

Buttons With Dynamic Text - Hit Area Problem
Hi,
Here's the problem i am experiencing:
x) I have a button which has a movie clip in the UP and OVER states. The Hit Area is a rectangle
x) the movie clip in the button contains dynamic text. the variable for the text is loaded externally.

the HIT area for the button stops working for with this setup. It only works if I change the text in the movieclip to static text (not desirable in this case)

Is there a known bug regarding buttons and dynamic text?

Have found posts in deja.com about similar problems, but no solutions yet.

Any help would be appreciated
thanks in advance
mac

Dragable Area & Dynamic Text Conflict
Dragable Menu Moves around the screen, But dynamic text on the same script does not move

does any one have any code


on (press) {
setProperty("/MC_dragarea", _alpha, "60");
startDrag("/MC_dragarea" && "/DynamicText");
}
on (release) {
setProperty(("/MC_dragarea") && ("/DynamicText"), _alpha, "100");
stopDrag();
}


Please help PLEASE PLEASE PLEASE

Adding Perspective To Dynamic Text Area
Is it possible to add perspective to a dynamic text area, (includes text area and scroll bar component)?. I've tried but the text disappears and the scroll bar stops working.

Cheers people.

Dynamic Text From XML Covering Button Hit Area.
Hello everyone,

This is my first post on ActionScript.org and I am very new to ActionScript and XML. Everything I know about it is from manipulating other people's scripts and a lot of trial and error.

Anyway, this question should be pretty easy for you pros. I have a list of members of a team and I have the names imported to a button and a small database imported to another area of my Flash through the use of an XML file. My problem is that my Dynamic textbox that contains the member name is covering up the button that in turn imports the member data. The button remains undisturbed if I use static text but i need these names to be dynamic so that you only need change the XML file.

I'm sure there is a simple solution but I don't know what it is. Can anyone help?

Thanks

How To Vertical Center To Dynamic Text In A Specified Area?
i saw a example can make Vertical Center to Dynamic Text in a Specified Area.
http://www.rabidgadfly.com/?p=34
but when i type chinese or japanese character, it does not support even display.

any expert got any suggestion or advice show me?

Button In Dynamic Scroll Text Area
Who can help me with this Flash 8 issue?

I have a list of items in a scroll field with text. Now, i want these items to be buttons so i can push them and let a picture appear besides the list. I can't fix it somehow.

Anyone help?

Thanks so far...

Jethro

Setting The BG Color Of A Dynamic Text Area
I'd like to set it to black, with yellow text, but I'm having a heck of a time.  Can someone point me in the right direction?

Problem Loading An & Into A Dynamic Text Area
Is there a way to load an & from a php page into a dynamic text area?
Here is how I am loading the variable.

The php page is just this
<?
echo "&textArea= this is a test & testing";
?>

Then I use this in the flash file
loadVariables ("location of php file", this);


It loads in fine except for anything after and including the &.

Dynamic Text Field Links - Hit Area Too Small
Hi,

I'm trying to create a dynamic table in a flash movie with links on many of the bits of data. However, I'm having a bit of trouble with the links themselves. If I'm displaying just one character e.g. '1', the hit area where the user can click is very small and seems to sit just to the left of the actual number. This happens if I'm defining the data through actionscript (using 'htmlText = .....'), but seems to be fine if I create a dynamic textfield manually and set up a link myself.

Any ideas?

Loading Multiple Text Files Into One Dynamic Area
Good Afternoon Everyone !
I am making an office calendar that allows text to be loaded when they press a button. I also want them to be able to link to certain html pages....and so forth
I have the calendar done, and everything works....except the html.
I have this embedded in each button

//Flash Script to Load on Button Press
on (release){
var variables_lv:LoadVars = new LoadVars();
variables_lv.load("july_2_event.txt");
variables_lv.onData = function(data) {
event_loader_clip.text=data;
}
}

but the html is not rendering...even if I have the rendering action pressed.
"I am a rookie and this is frustrating"
art-

Auto Adjusting Dynamic Text Area Size
Ok I have been looking all over the net, Google/Yahoo/Pixel2Life, and am not having any luck finding what I need. I am loading PHP Variables into flash and I am looking to auto adjust the dynamic text area size like that my scrollbar can adjust to the correct scrolling size. Right now all that I have done is created a huge text area like that I am sure the text will fit in there but when I scroll all the way down I get some blank space after a while.

I hope I have given you enough info.

Nick

Load Comma Delimited And Assigning Dynamic Text Area
Im using a txt file that goes num=123,456,789 how do I use the split command to seperate and assign them to num1 - num2 - num3 text boxes?

Embedding A Font For A Dynamic Text Area In Flash Mx 2004
can't seem to find the solution to this for flash mx 2004...

how do i embed a font? i've got some dynamic text fields that are displaying external html formatted text, but i want that text to show up in a certain font.

how can i embed a font for this?
it'll probably be the same size font throughout different pages, possibly some bold used here and there. what's the step by step how to on this and what actionscript do i need?

also, will such a method work for texareas or externally loaded swfs?

Populating Dynamic Textfields
Hi, im using this code to create dynamic text fields on my stage and populate them from an array.

Code:
for (i=1;i<Number(_root.myvars.total)+1;i++){
myarray=_root.myvars["player"+i]
myarray=myarray.split(",");

_root.createTextField("mytext"+i,i,300,200+(i*10),300,100);
_root["mytext"+i].multiline = true;
_root["mytext"+i].wordWrap = false;
_root["mytext"+i].border = false;

myformat = new TextFormat();
myformat.color = 0x000000;
myformat.font = "eurostile";
myformat.size = 10
myformat.bold = true
myformat.leading = 5


_root["mytext"+i].text = myarray[4];
_root["mytext"+i].setTextFormat(myformat);

}


however, i want to have these inserted to a movie clip inserted on my stage, how should i adjust accordingly?

Populating Scrollpane Dynamic
I have some trouble when i put dynamic content inside a scrollpane.
It works fine to populate it using attatchmovie, but when the content are supposed to scroll, it just overflows the scrollpane.
It just dont want to scroll

Anyone that can tell me how to solve this?

Dynamic Array Populating
I need to load the images and then fill up the five arrays dynamically. The part of interest is how to reference the array with the string variable (arrName.. headshots_thumbs, kids_thumbs, maternity_thumb etc...)

This is the line which I wrote which is supposed to reference the arrays correctly.

MovieClip(_root[arrName]).push(_mc);








Attach Code

var myVars:LoadVars = new LoadVars();
var arrImageNames:Array = new Array();
var index:Number = 0;
var counter:Number = 100;
var folder:String;
var arrImages:MovieClip = new Array();
var headshots_thumbs:Array = new Array();
var portraits_thumbs:Array = new Array();
var maternity_thumbs:Array = new Array();
var kids_thumbs:Array = new Array();
var weddings_thumbs:Array = new Array();
var thumbsFolders:Array = new Array("headshots", "portraits", "maternity", "kids", "weddings");
// Load an array of thumbs for each folder.
function LoadNextThumbsArray() {
if (index<thumbsFolders.length) {
folder = thumbsFolders[index];
LoadMovieClipsArray();
index = index+1;
} else {
trace("starting");
Start();
}
}
function LoadMovieClipsArray() {
myVars = new LoadVars();
myVars.onLoad = OnLoad;
var path:String = "http://localhost/getimages.php?folder=portfolio/"+folder+"_thumbs";
myVars.load(path);
}
function OnLoad(success) {
var i:Number = 0;
if (success) {
for (var x in myVars) {
var arrImageName:String = myVars[x];

if (arrImageName.toLowerCase().indexOf(".jpg", 0)>0) {
trace(arrImageName);
var folderName:String = eval(folder);
var arrName:String = folder+"_thumbs";
// eval(arrName).push(arrImageName);
// Load movie onto the movieclip.
var _mc:MovieClip = _root.createEmptyMovieClip("thumb"+counter, counter);
_mc._alpha = 100;
_mc.loadMovie("portfolio/"+folder+"_thumbs/"+arrImageName);
_mc._x = counter;
_mc._y = counter;

MovieClip(_root[arrName]).push(_mc);
trace(_root[arrName][x]);
counter = counter+1;
}
}
LoadNextThumbsArray();
} else {
trace("failed");
}
}

























Edited: 05/17/2007 at 10:04:30 PM by jwize

Populating Dynamic Textarea?
Can anyone point out what I'm doing wrong here?
I'm trying to populate a dynamic textarea with values selected at random from an array. (It's going to be a simple flashcard app.)

Everything is working great except the population of the textarea. I'm including the code below. Also, I'm doing this in Flash MX.

TIA!

on (keyPress "1"){
var messageNum = 10;
/* Generate Random number to select array */
randomNumber = (Math.floor(Math.random()*10+1));
trace("randomNumber=" + randomNumber);
var fcards = [
    {Q: "Q index 0, item 1", A: "A (index a0, item a1)", Ex: "Ex (index ex0, item ex1)"},
    {Q: "Q index 1, item 2", A: "A (index a1, item a2)", Ex: "Ex (index ex1, item ex2)"},
    {Q: "Q index 2, item 3", A: "A (index a2, item a3)", Ex: "Ex (index ex2, item ex3)"},
    {Q: "Q index 3, item 4", A: "A (index a3, item a4)", Ex: "Ex (index ex3, item ex4)"},
    {Q: "Q index 4, item 5", A: "A (index a4, item a5)", Ex: "Ex (index ex4, item ex5)"},
    {Q: "Q index 5, item 6", A: "A (index a5, item a6)", Ex: "Ex (index ex5, item ex6)"},
    {Q: "Q index 6, item 7", A: "A (index a6, item a7)", Ex: "Ex (index ex6, item ex7)"},
    {Q: "Q index 7, item 8", A: "A (index a7, item a8)", Ex: "Ex (index ex7, item ex8)"},
    {Q: "Q index 8, item 9", A: "A (index a8, item a9)", Ex: "Ex (index ex8, item ex9)"},
    {Q: "Q index 9, item 10", A: "A (index a9, item a10)", Ex: "Ex (index ex9, item ex10)"}  
 ];

/*   len = fcards.length;
for(var i=0; i<len; i++){
  trace(fcards[i].Q + newline + fcards[i].A + newline + " ex. " + fcards[i].Ex + newline);
}   */
    this.QTextArea.text = fcards[randomNumber].Q;
    this.ATextArea.text = fcards[randomNumber].A;
 trace("QTextArea = " + this.QTextArea.text + newline);
 trace("fcards Q = " + this.fcards[randomNumber].Q + newline);
 trace("fcards A = " + this.fcards[randomNumber].A + newline);
}


Populating A ListBox With Dynamic Data HELP
Hi Everyone,

Need to know how to update a listbox from data thats comming from a ASP script using the LoadVars(). I can do it for dynamic text boxes in Flash, but not for the Listbox. I know how to populate a list box or combo box on a HTML page using ASP but my problem that I do not understand is that the data from an ASP page is being received as one large data block, how can I break it down so that flash will add a new item for each value sent in from the ASP page.

Cheers

Carl

Populating Sequential Multiple Dynamic
I need help populating sequential multiple dynamic text boxes - 3 total. Right now I can populate the first box but know I need an array to populate the other 2 boxes.

Can someone get me started here?

thanks,

Squirrel

code:
onClipEvent(load){
_root.click = "0";

}
onClipEvent(enterFrame){
if(_root.click >=3){
_root.full._alpha = 100;
}
}

[ Populating Dynamic Scrolling Content ]
Hi,

I am using a scrolling script for a movie clip "myMovie" that contains a dynamic textfield and other clips and elements which are scrolled with custom scrollbar based on the height of the myMove which is masked.

The scrolling ration is based on the size/height of that main MovieClip which contains all these elemets of course so that if I put more elements the height changes and readjusts the scrolling ratio.

The problem I am having is that for example my scrolling movie clip contains dynamically created buttons , now the script only detects the height of the movie based on the static elements inside the clip. And all scripts I found use the same method .height()

If I load buttons or any other elemets dynamically the myMove.height can't dettect that the size of the movie clip is now bigger. Dynamic elements don't seem to be detected at all when it comes to detecting the size of the clip that contains them ... so my scrolling height does not readjust to match the correct scrolling ratio ...

Same works for dynamic textfield what ever the original height was set that's how much it will scroll ...If I want to add text I need to change height of the textfield to match it manually ..which is pain

Is there a way to overcome this ???

thanks

Copyright © 2005-08 www.BigResource.com, All rights reserved