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








Displaying Array Contents


Hi! Ok, I'm trying to simplify a really complicated process. My first step is display the contents of part of an array. I use a movie clip and duplicateMovieClip, but nothing has ever displayed and I've spent more hours on this than I ever want to think about. My question basically is: how do go from an array of words to a movie clip to showing a word in the Flash movie in a certain place. Below is what I have been attempting to piece together. If anyone knows ANYTHING, I would be a very happy lady! Thanks!!!
Stephanie

//This is placed in a box, which is a movie clip instance

onClipEvent (load) {
var startX = 100;
wordClip = new Array();
wordArray = ["It", "works", "now", "I", "can", "go", "to", "bed"];
trace(wordArray);
var n=5;
var count = random(wordArray.length);
trace (count);
duplicateMovieClip ("wordClip", "newwordClip", n);
newwordClip = wordArray[count];
trace(newwordClip);
setProperty ("newwordClip", _visible, true);
setProperty ("newwordClip", _x, _root.box);
setProperty ("newwordClip", _y, getProperty("box", _y));
newwordClip.play();
n += 1;
trace (n);
}




FlashKit > Flash Help > Flash Newbies
Posted on: 11-07-2001, 08:19 PM


View Complete Forum Thread with Replies

Sponsored Links:

Displaying Array Contents Without Comma?
Hello,

I have an array that contains individual letters and numbers. What I want to do is display the contents of this array as a string, but without commas between them, so that means I can't use .toString.
Any suggestions?
I am working in Actionscript 1.0.

thanks,
Brent

View Replies !    View Related
Help Displaying Array Contents Spaced Over Time
I'm using Actionscript 2.0 in Flash MX 2004.

My goal is to randomly display movie clip names ("C1", "C2", etc) from an array. I want these movie clip names to not display all at once, but to show up one second apart from each other.

I have some code posted below which is in the first (and only) frame of my Flash file. I have created an array (interactiveON) which holds all of the movie clip names.

I then create an Array (ary) which generates and holds random numbers.

I can get the movie clip names from "interactiveON" to display in a random order, however instead of having them all show up in the output window at once, I want them to display one at a time, 1 second apart from each other, and then stop once all names have been displayed.

If anyone can help me solve this puzzle it would be much appreciated.



Code:
// Create Array (interactiveON) with my content
var interactiveON:Array = new Array(6);
interactiveON[1]="C1";
interactiveON[2]="C2";
interactiveON[3]="C3";
interactiveON[4]="C4";
interactiveON[5]="C5";

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

//Set up an Array (ary) of random numbers
n = 6;
ary = [];

// Assign random numbers to "ary"
for (i = 0; i < n; ++i) ary[i] = i;
ary.sort( function() { return random(2)? 1 : -1; });
trace(ary); // Returns string of numbers 0-5, randomized

// Convert random numbers to new Array
for (j=0; j<n; ++j){
trace(interactiveON[ary[j]]); //Returns the cells of "interactiveON" in random order
}

View Replies !    View Related
[F8] Displaying The Contents Of An Object
Hey.

If I set an object like this:

Code:
var dat:Object = new Object();
And set variables within it like this:

Code:
dat.size=5;
dat.open="asdf";
Is it possable to print them like this:

Code:
trace(dat);//its not
instead of like this:

Code:
trace(dat.size+" "+dat.open);

View Replies !    View Related
Displaying The Contents Of A Txt File?
I'm kind of a bit stuck with this as I am very new to the world of Flash.

What I want is that when I select an option from a Combo Box, it's appropriate text file is opened (that is, every option has it's own text file) and its content displayed in a text box thing in Flash MX.

Is this possible, if so can somebody please help me out?

Thanks in advance for you help.

View Replies !    View Related
Displaying Hard Drive Contents?
I'm working on a flash mx desktop for my computer, I love windows xp but thier intended use of the desktop just sucks. Anyway I was wondering if anyone knew how to display local hard drive contents from within a flash movie. Kinda like the way you do it with a frame in normal html, just specify the hard drive as the htlm path. I was thinking of using a dynamic text box and specifying C drive as the variable. If anyone knows how do this pleas oh please let me know!!!!!!!!!!

Thanks in advanced.

View Replies !    View Related
Dynamic Table Of Contents...Not Displaying
Hello List,

I am trying to create a dynamic table of contents using two arrays. One for the filenames the other for the linknames that will display in the created text fields. The Debugger lists the variables as created and the MovieClips as well but nothing is displayed. So my code is sort of working. Why is nothing displaying? All input gratefully appreciated.

Brody



ActionScript Code:
var fileNames = ["CCC_mod1_less1_top1_1.swf", "CCC_mod2_less2_top1_2.swf", "CCC_mod1_less1_top1_3.swf"];
var linkNames = ["Lesson One", "Lesson Two", "Lesson Three"];

for (i = 0; i < fileNames.length; i++){
   
this.createEmptyMovieClip("newLesson" + i, this.getNextHighestDepth());
trace("newLesson" + i);


newLesson[i].createTextField("firstText_txt" + i, 1, 0, 0, 200, 20);
newLesson[i].firstText_txt[i].border = "true";
newLesson[i].firstText_txt[i].type = "dynamic";
newLesson[i].firstText_txt[i].text = "linkNames" + i;
trace(linkNames[i]);

newLesson[i].onRelease = function(){
     //loadMovie stuff here
};

}

View Replies !    View Related
Displaying A Directories Contents (online)
How do you display a directories contents on-line as a list? For example if you click on a button 'show' or 'browse' than a dialogue box will open with a list of files & folders within the directory specified, all within the swf.

View Replies !    View Related
Pulling A Variable From A PHP File, And Displaying Contents.
I was wondering if anyone knew if the following is possible:

I want to declare a variable inside the PHP file,
ex: <?php $text = "Hello!"; ?>

Then have the Flash movie display the text Hello! in a dynamic text box that is not selectable.

Anybody?

View Replies !    View Related
Array Labels Instead Of Contents?
OK...I can't seem to see this (and I bet its real simple):

In my flash project I have 3 rather long lists of words (in 3 separate arrays). I then assign the contents of these arrays randomly to 3 predefined subject arrays for each user that visits my site:

User 1
Words Array 1 = Subject Array 2
Words Array 2 = Subject array 1 and so on...
(I know it probably sounds odd, but I have to do it this way).

Anyway, I would like to keep track of which word lists are assigned to which subject group for each visitor by writing them to a text file via perl. I have no problem in doing it so that I see every word in all of the arrays being assigned for every person. I would rather be able to just have a text file of array names showing what word array has been assigned to what subject array (like what I've done above) instead of array contents.

Long story short; is there away to do this? (maybe by assigning a variable to an array name without affecting the array itself???)

Thanks
RD

View Replies !    View Related
Using Contents Of Array In A Path Name
How do I use the contents of an array in a path name? (Like _root.[contentsofarray].blah.blah

For example, say I have a string in an array-- and that string is the name of an instance of a movie clip. And I want to use the name of that instance in a path name.

What's the syntax for doing this? Anybody know? : )

Using Flash MX.

View Replies !    View Related
Losing Array Contents
I'm tracing the contents of an array in one function and when the next function starts, the same exact trace function returns "undefined". Its crazy.


PHP Code:



finder_xml = new XML();
finder_xml.onLoad = Start;
finder_xml.load("finder.xml");
finder_xml.ignoreWhite = true;

// Intialize variables
function Start(success) {
    if (success == true) {
        rootNode = finder_xml.firstChild;
        trace(rootNode);
        firstGroup = rootNode.firstChild;
        totalFeatures = firstgroup.childNodes.length;
        trace(totalFeatures);
        secondGroup = firstGroup.nextSibling;
        totalModels = secondGroup.childNodes.length;
        trace(totalModels);
        firstFeature = firstGroup.firstChild;
        trace(firstFeature);
        nextFeature = firstFeature.nextSibling;
        trace(nextFeature);
        firstModel = secondGroup.firstChild;
        trace(firstModel);
        nextModel = firstModel.nextSibling;
        trace(nextModel);
        extractFeatureData();
        trace(productFeature[1]);//These traces return "undefined".
        trace(productFeature[2]);
        trace(productFeature[3]);
        trace(productFeature[4]);
        trace(productFeature[5]);
        trace(productFeature[6]);
        trace(productFeature[7]);
        trace(productFeature[8]);
        trace(productFeature[9]);
        featureLayout();
    }
}
function extractFeatureData() {
    var productFeature = new Array();
    var productCode1 = new Array();
    var productCode2 = new Array();
    var productCode3 = new Array();
    var productAdvice = new Array();
    var productOption1 = new Array();
    var productOption2 = new Array();
    var productOption3 = new Array();
    var productNode = new Array();
    featureCount = totalFeatures;
    featureNode = firstFeature;
    trace("featureNode before loop = "+featureNode);
    for (i=1; i<=featureCount; i++) {
        productNode[i] = featureNode;
        trace("productNode = "+productNode[i]);
        productFeature[i] = featureNode.attributes.name;
        trace("productFeature = "+productFeature[i]); //This trace works.
        productCode1[i] = featureNode.attributes.code1;
        productCode2[i] = featureNode.attributes.code2;
        productCode3[i] = featureNode.attributes.code3;
        productAdvice[i] = featureNode.attributes.advice;
        productOption1[i] = featureNode.attributes.option1;
        productOption2[i] = featureNode.attributes.option2;
        productOption3[i] = featureNode.attributes.option3;
        featureNode = featureNode.nextSibling;
    }
}
function featureLayout() {
    featureCount = totalFeatures;
    trace("featureCount = "+featureCount);
    y = 0;
    spacing = 26;
    for (i=1; i<=featureCount; i++) {
        _root.listBox1.attachMovie("FeatureText", "FeatureText"+i, i);
        var name = "FeatureText" + i;
        trace(name);
        _root.listBox1[name]._y = y;
        trace(y);
        trace(productFeature[i]); //This trace returns "undefined"
        _root.listBox1[name].featureName.text = productFeature[i];
        //_root.listbox1[name].currentNode = classGroupNode[i];
        y = i*spacing;
    }
}




Here is the XML:


PHP Code:



<?xml version="1.0" encoding="UTF-8"?>

<project>

<features>
<feature name="Number of Keys" code1="100" code2="110" code3="120" advice="keys are useful for playing" option1="61" option2="76" option3="88" clicks1="0" clicks2="0" clicks3="0"></feature>
<feature name="Key Action" code1="200" code2="210" code3="220" advice="keys are useful for playing" option1="Organ Type" option2="Weighted" option3="null" clicks1="0" clicks2="0" clicks3="0"></feature>
<feature name="Yamaha Education Suite" code1="300" code2="310" code3="320" advice="keys are useful for playing" option1="Yes" option2="No" option3="null" clicks1="0" clicks2="0" clicks3="0"></feature>
<feature name="Song Book" code1="400" code2="410" code3="420" advice="keys are useful for playing" option1="Yes" option2="No" option3="null" clicks1="0" clicks2="0" clicks3="0"></feature>
<feature name="Portable Grand" code1="500" code2="510" code3="520" advice="keys are useful for playing" option1="Yes" option2="No" option3="null" clicks1="0" clicks2="0" clicks3="0"></feature>
<feature name="Recording" code1="600" code2="610" code3="620" advice="keys are useful for playing" option1="Yes" option2="No" option3="null" clicks1="0" clicks2="0" clicks3="0"></feature>
<feature name="Removable Storage" code1="700" code2="710" code3="720" advice="keys are useful for playing" option1="Yes" option2="No" option3="null" clicks1="0" clicks2="0" clicks3="0"></feature>
<feature name="Score/Lyric Display" code1="800" code2="810" code3="820" advice="keys are useful for playing" option1="Yes" option2="No" option3="null" clicks1="0" clicks2="0" clicks3="0"></feature>
<feature name="Vocal Harmony" code1="900" code2="910" code3="920" advice="keys are useful for playing" option1="Yes" option2="No" option3="null" clicks1="0" clicks2="0" clicks3="0"></feature>
</features>

<products>
<product model="PSR550" picurl="/yamahavgn/Images/Education/Lifestyle/0302-01.jpg" detailurl="/yamahavgn/Images/Education/Lifestyle/0302-01.jpg" codelist="100,300,500" clicks="10"></product>
<product model="PSR1100" picurl="/yamahavgn/Images/Education/Lifestyle/0302-01.jpg" detailurl="/yamahavgn/Images/Education/Lifestyle/0302-01.jpg" codelist="100,300,500" clicks="10"></product>
<product model="PSR2100" picurl="/yamahavgn/Images/Education/Lifestyle/0302-01.jpg" detailurl="/yamahavgn/Images/Education/Lifestyle/0302-01.jpg" codelist="100,300,500" clicks="10"></product>
<product model="PSR550" picurl="/yamahavgn/Images/Education/Lifestyle/0302-01.jpg" detailurl="/yamahavgn/Images/Education/Lifestyle/0302-01.jpg" codelist="100,300,500" clicks="10"></product>
<product model="PSR550" picurl="/yamahavgn/Images/Education/Lifestyle/0302-01.jpg" detailurl="/yamahavgn/Images/Education/Lifestyle/0302-01.jpg" codelist="100,300,500" clicks="10"></product>
<product model="PSR550" picurl="/yamahavgn/Images/Education/Lifestyle/0302-01.jpg" detailurl="/yamahavgn/Images/Education/Lifestyle/0302-01.jpg" codelist="100,300,500" clicks="10"></product>
<product model="PSR550" picurl="/yamahavgn/Images/Education/Lifestyle/0302-01.jpg" detailurl="/yamahavgn/Images/Education/Lifestyle/0302-01.jpg" codelist="100,300,500" clicks="10"></product>
<product model="PSR550" picurl="/yamahavgn/Images/Education/Lifestyle/0302-01.jpg" detailurl="/yamahavgn/Images/Education/Lifestyle/0302-01.jpg" codelist="100,300,500" clicks="10"></product>
<product model="PSR550" picurl="/yamahavgn/Images/Education/Lifestyle/0302-01.jpg" detailurl="/yamahavgn/Images/Education/Lifestyle/0302-01.jpg" codelist="100,300,500" clicks="10"></product>
<product model="PSR550" picurl="/yamahavgn/Images/Education/Lifestyle/0302-01.jpg" detailurl="/yamahavgn/Images/Education/Lifestyle/0302-01.jpg" codelist="100,300,500" clicks="10"></product>
<product model="PSR550" picurl="/yamahavgn/Images/Education/Lifestyle/0302-01.jpg" detailurl="/yamahavgn/Images/Education/Lifestyle/0302-01.jpg" codelist="100,300,500" clicks="10"></product>
</products>

</project>

View Replies !    View Related
What's The Best Way To Delete The Contents Of An Array?
What's the best way to delete the contents of an array?

I want to delete the conects of an array, but want to keep the array itself.

I'm not quite sure what the best way to do this would be?

If I just use delete, then this will delete the array itself, but I don't want this as I want to keep the array variable.

Any help would be appreciated.

Thanks.


OM

View Replies !    View Related
Push Contents Of One Array Into Another
Hi guys - if one array is called MyArray and the second is called MyArray2, how do I push the contents of the first array into the second?

I've tried passing the array contents into a text box and then pushing the text box contents into the second array and about a dozen other methods. I'm very much an amateur at this and I'm tearing my hair out over here...

View Replies !    View Related
Contents Doubling In Array
Hey all, need some help.

I've created an Array to load four separate jpegs. Everything works fine and dandy, except everytime I click, the trace (and the children and whatever else being added) multiplies exponentially, thus bogging down the swf file after several clicks.

Any idea what's causing my events to double?

Thanks in advance!

//-----


ActionScript Code:
var thumbList:Array = ["P1_1.jpg", "P1_2.jpg","P1_3.jpg","P1_4.jpg"];

var loader:Sprite = new Sprite;

var container:Sprite = new Sprite();
container.x = 0;
container.y = 0;
addChild(container);

function init(nNum:Number) {
    trace("Project Icons Loaded");

    //--- Loader

    var pictLdr:Loader = new Loader();
    var pictURL:String = thumbList[nNum];
    var pictURLReq:URLRequest = new URLRequest(pictURL);

    pictLdr.load(pictURLReq);
    pictLdr.contentLoaderInfo.addEventListener(Event.COMPLETE, imgLoaded);

    function imgLoaded(event:Event):void {
        container.addChild(pictLdr.content);
    }
    //---
    th1.addEventListener(MouseEvent.CLICK, th1Load);

    function th1Load(e:MouseEvent):void {
        trace("Image 1 loaded");
        pictLdr.content.visible = false;
        thumbList.length = 0;
        thumbList.push("P1_1.jpg");
        init(0);
    }
    //---
    th2.addEventListener(MouseEvent.CLICK, th2Load);

    function th2Load(e:MouseEvent):void {
        trace("Image 2 loaded");
        pictLdr.content.visible = false;
        thumbList.length = 0;
        thumbList.push("P1_2.jpg");
        init(0);
    }
    //---
    th3.addEventListener(MouseEvent.CLICK, th3Load);

    function th3Load(e:MouseEvent):void {
        trace("Image 3 loaded");
        pictLdr.content.visible = false;
        thumbList.length = 0;
        thumbList.push("P1_3.jpg");
        init(0);
    }
    //---
    th4.addEventListener(MouseEvent.CLICK, th4Load);

    function th4Load(e:MouseEvent):void {
        trace("Image 4 loaded");
        pictLdr.content.visible = false;
        thumbList.length = 0;
        thumbList.push("P1_4.jpg");
        init(0);
    }
   
}

init(0);

View Replies !    View Related
Separating Contents Of An Array
Right now I have an array with a bunch of different file and folder names in it. I want to separate the files and folders in to two separate arrays. How would I check the arrays to see if the elements have a "." in them, and then if they do have a "." in them, put them into files array.

View Replies !    View Related
Display Contents Of Array
hey,
so i am just hoping that someone has done this before and it is a quick copy paste for you.

I am working on a site where the only access that I have to anything from the database is VIA an array that I can display by listing the variables. but it gets a little bit messy (to say the least).

I am looking for a way to recursively loop through an array and display the contents either in a component that i will build or just tracing out.

I currently have the following:

Code:
public function printArray (obj) {
trace(obj);
for (var item in obj)
{
trace(item + " = " + obj[item]);
printArray (obj[item]);
}
}
it works fine but returns a mess. I am looking to make something like print_r does in PHP where it either indents or just intelligently displays the contents.

Please let me know if you have done anything like this before and how it works.

cheers, marc

View Replies !    View Related
How To Return Name Of An Array Not It's Contents?
Hey there, thanks for checking this. I have an array that holds some other arrays and I want to return just the name of the arrays that it holds, not their contents. In this example I want to trace the string "myDays_ar" but can only get the contents.

ActionScript Code:
var myDays_ar:Array = ["Sat", "Sun", "Wed"];var myMonths_ar:Array = ["January", "July"];var my_ar:Array = [myDays_ar, myMonths_ar];trace(my_ar[0]);//RETURNS: Sat,Sun,Wed  

I have tried

ActionScript Code:
trace(my_ar[0]._name);

and

ActionScript Code:
trace(my_ar[0]._name.toString());

but can't get what I want!
If anyone could help I would be really grateful
Thanks!
Schm

View Replies !    View Related
Separating Contents Of An Array
Right now I have an array with a bunch of different file and folder names in it. I want to separate the files and folders in to two separate arrays. How would I check the arrays to see if the elements have a "." in them, and then if they do have a "." in them, put them into files array.

View Replies !    View Related
How To Erase An Array's Contents
I'm trying to figure out to erase all of the contents of an array I have so I can reuse it within a loop in a function. Basically I want to create an array each time I enter the loop, add new values to it, save that array to another name and then go back into the loop and reuse the same array.

Problem is when I trace the array it continues to adding new values to the array. I'm using the ".push" method to update my array.

Any ideas?

View Replies !    View Related
Contents Doubling In Array
Hey all, need some help.

I've created an Array to load four separate jpegs. Everything works fine and dandy, except everytime I click, the trace (and the children and whatever else being added) multiplies exponentially, thus bogging down the swf file after several clicks.

Any idea what's causing my events to double?

Thanks in advance!

Code:

var thumbList:Array = ["P1_1.jpg", "P1_2.jpg","P1_3.jpg","P1_4.jpg"];

var loader:Sprite = new Sprite;

var container:Sprite = new Sprite();
container.x = 0;
container.y = 0;
addChild(container);

function init(nNum:Number) {
    trace("Project Icons Loaded");

    //--- Loader

    var pictLdr:Loader = new Loader();
    var pictURL:String = thumbList[nNum];
    var pictURLReq:URLRequest = new URLRequest(pictURL);

    pictLdr.load(pictURLReq);
    pictLdr.contentLoaderInfo.addEventListener(Event.COMPLETE, imgLoaded);

    function imgLoaded(event:Event):void {
        container.addChild(pictLdr.content);
    }
    //---
    th1.addEventListener(MouseEvent.CLICK, th1Load);

    function th1Load(e:MouseEvent):void {
        trace("Image 1 loaded");
        pictLdr.content.visible = false;
        thumbList.length = 0;
        thumbList.push("P1_1.jpg");
        init(0);
    }
    //---
    th2.addEventListener(MouseEvent.CLICK, th2Load);

    function th2Load(e:MouseEvent):void {
        trace("Image 2 loaded");
        pictLdr.content.visible = false;
        thumbList.length = 0;
        thumbList.push("P1_2.jpg");
        init(0);
    }
    //---
    th3.addEventListener(MouseEvent.CLICK, th3Load);

    function th3Load(e:MouseEvent):void {
        trace("Image 3 loaded");
        pictLdr.content.visible = false;
        thumbList.length = 0;
        thumbList.push("P1_3.jpg");
        init(0);
    }
    //---
    th4.addEventListener(MouseEvent.CLICK, th4Load);

    function th4Load(e:MouseEvent):void {
        trace("Image 4 loaded");
        pictLdr.content.visible = false;
        thumbList.length = 0;
        thumbList.push("P1_4.jpg");
        init(0);
    }
   
}

init(0);

View Replies !    View Related
Make The Contents Of The Array Into Variables
I am running an array that creates 10 random numbers. I want to make the contents of the array (the 10 random numbers) into variables where I can then proceed to work with them. This is the actionscript I am using:

Array.prototype.pickRandom = function(){
return this.splice(random(this.length), 1);
}

numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];

//pick all the numbers in random order
while (numbers.length) {
trace(numbers.pickRandom());
}

The only problem is I don't know how to make the contents of this array into variables... Anyone have the heart to show a little code? Thanks.

View Replies !    View Related
[F8] Reading Entire Contents Of 2D Array
I've got a 2D object array that hold varying data:

StudentArray[0].FirstName
StudentArray[0].LastName

StudentArray[1].FirstName
StudentArray[1].LastName
StudentArray[1].Grade

StudentArray[2].FirstName
StudentArray[2].LastName
StudentArray[2].Address

Each index number can hold different attributes (some might have "grade", others "address"), and we don't know what each in each set, as they are read in via outside data sources.

The question: How can I loop through each array element and whatever info might be stored in it, without knowing the name of the attributes ahead of time?

Thanks in advance!

View Replies !    View Related
Randomly Picking Contents Of An Array
Does anyone no how to randomly pick items from an array without ever picking the same item again until everything has been randomly picked at least once. I'm building a online radio and I don't want the "station" to play the same song until all the songs have been played at least once.

Has anyone tried to do this? If so any help would be appreciated.

Thanks,

MK

View Replies !    View Related
Putting Contents Of An Array In Textfields
Yow, I have a problem ...

I have an Array with several Items (between 10-15)
Now i wanted to give out these Items in Textfields dynamically.
Can sumone help me out?

much appreciated

cheers

ChromeD

View Replies !    View Related
Problem Reversing An Array's Contents
I seem to be having trouble reversing the contents of an array

this is the code:

Code:
stop();
// Attributes arrays
var nd:Array = new Array();
var ns:Array = new Array();
var sp:Array = new Array();
var idnum:Array = new Array();

// Load XML
var newsXML:XML = new XML();
newsXML.ignoreWhite = true;
newsXML.onLoad = function()
{
trace("this " + this);
var nodes:Array = this.firstChild.childNodes;
trace("nodes: " + nodes);
for(i=0;i < nodes.length; i++)
{
idnum[i] = nodes[i].attributes.id;
trace("idnum[i]: " + idnum[i]);
nd[i] = nodes[i].attributes.date;
trace("nd[i]: " + nd[i]);
ns[i] = nodes[i].attributes.story;
trace("ns[i]: " + ns[i]);
sp[i] = nodes[i].attributes.spacer;
trace("sp[i]: " + sp[i]);
}
// Display Text
var stringCache:String;
for(n=0; n < idnum.length; n++)
{
trace(idnum[n]);
trace(nd[n]);
trace(ns[n]);
trace(sp[n]);
theNews.text += nd[n] + "
" + ns[n] + "
" + sp[n] + "
" + "
";
}
theNews.text = stringCache;
}
newsXML.load("updates/adNews.php");
i've tried changing the 'for' loops for both the 'n' and 'i' variables to decrement them and also tried idnum.reverse(); but i can;t get it to work.

It's a news page so i'm basically trying to get the newest story(which is attached to the highest id number in the databse) to post first and then post the rest in descending order.

anyone have any suggestions?

thanks

View Replies !    View Related
PLEASE Help. Dynamically Populating Array With Folder Contents?
Hi there. I would be every so appreciative if someone could just point me in the right direction here. You see, what I'd like to do is use all the .swf files located in a root folder of mine and dynamically populate an array with them. So that if I add additional .swfs, my array updates accordingly.

I have a hunch this isn't exactly the correct way to go about populating an array with a bunch files that I continually add to. . . so hopefully someone out there might be able to give me a bit of guidance? Please?

Thank you so much for your help; I appreciate you reading my post.

View Replies !    View Related
Delete And Create To Flush Array Contents?
When you want to clear out the contents of an array in Flash MX is it a bad idea to just delete the array and create it again?

for example:

Delete myArray;
myArray = new Array();

I'm wondering:
1. If the way Flash handles (and doesn't handle) memory management would cause some problems.

2. Is it considered good coding practice.

I'm assuming in this example that myArray does not contain any other arrays or objects that need to be tossed first.

Thanks for the help.

View Replies !    View Related
Examine Array Contents (counting Like Values)
I am using Flash MX 2004 Pro.

An array of a known length (lets say 10), can contain values (say from 0.01 to 9999.99).
How would I ensure that there are no more than X occurances of the same value within the array?

I was thinking of looking at each value and checking along the array to see how many times that value is repeated. Has anyone any pre written function/code that will do this?

Many thanks.
Gav

View Replies !    View Related
How To Get Array Contents To Text Field As Rows?
Hi,

Here is a beginner question:

How to get arrays contents to show on own rows instead of one continuous row?

I have tried this:

ActionScript Code:
for (n=0; myArray.length; n++) {
myArray[n]+"<br>";
}

text_txt = myArray;
There must be something missing...

- jari-

View Replies !    View Related
Loading Contents From Randomized Array Sequentially...
Hi there,

I have this function which randomizes an array loaded from a text file that contains the names of folders that contain the content to be loaded. The problem is that all the content is preloaded at once (12 thumbnail-sized swf's, that in turn load images), before it displays it in Flash. How would I go about displaying each image as soon as it is loaded, while the rest are still being loaded?
Here's the code I have:

First frame:

ActionScript Code:
stop();toArray = new Array();my_var = new LoadVars();my_var.onLoad = function(success) {if (success) {toArray = this.toArray.split(",");gotoAndPlay(2);}};my_var.load("content/inspiration/inspirationContents.txt");


Second Frame:

ActionScript Code:
randomNumArr = [];for (i=0; i<12; i++) {randomNumArr.push(i);}addContent = function (clipNum) {var ranNum = Math.floor(Math.random()*(randomNumArr.length));this["daThumb_"+clipNum].daImageTarget.loadMovie("content/inspiration/"+toArray[randomNumArr[ranNum]]+"/preview/loadThumb.swf");randomNumArr.splice(ranNum, 1);};


And then on the third Frame I add all the contents:

ActionScript Code:
addContent(1);addContent(2);addContent(3);...addContent(12);stop();


Any input is really appreciated!!

Thanks,

Rufus

View Replies !    View Related
[AS] Loading Contents From Randomized Array Sequen
Hi there,

I have this function which randomizes an array loaded from a text file that contains the names of folders that contain the content to be loaded. The problem is that all the content is loaded at once (12 thumbnail-sized swf's, that in turn load images), before it displays it in Flash. How could I alter my 'addContent' function to display the items that have been loaded straight away, instead of adding them "manually" on the third frame??


Here's the code I have:

First frame:

ActionScript Code:
stop();
toArray = new Array();
my_var = new LoadVars();
my_var.onLoad = function(success) {
        if (success) {
                toArray = this.toArray.split(",");
                gotoAndPlay(2);
        }
};
my_var.load("content/inspiration/inspirationContents.txt");


Second Frame:

ActionScript Code:
randomNumArr = [];
for (i=0; i<12; i++) {
        randomNumArr.push(i);
}
addContent = function (clipNum) {
        var ranNum = Math.floor(Math.random()*(randomNumArr.length));
        this["daThumb_"+clipNum].daImageTarget.loadMovie("content/inspiration/"+toArray[randomNumArr[ranNum]]+"/preview/loadThumb.swf");
        randomNumArr.splice(ranNum, 1);
};


And then on the third Frame I add all the contents:

ActionScript Code:
addContent(1);
addContent(2);
addContent(3);
.
.
.
addContent(12);
stop();


Any input is really appreciated!!!

Thanks,

Gene

View Replies !    View Related
Dynamically Load Array Based On Folder Contents
Tough one...

I'd like to have the contents of an mp3 folder entered into an array (containing strings of each file name in the folder).

I'd like this to be totally dynamic so I can modify a playlist simply by dropping more mp3s into this folder.

File names must come in as strings in an array (i.e. "js bach - air on the g string.mp3")

How about it? Any thoughts or ideas?

Thanks
-dave-

View Replies !    View Related
Populate Array In Flash With The Contents Of A Directory(folder)
Hi all,

I'm trying to get Flash MX 2004 to read the contents of a specified directory (containing .jpg files) and populate an array that I can then read from the array to view the images within the flash movie.

I want to be able to add more images to the directory without having to edit hard coding of the array everytime. Plus I don't want to have to name all the images "image0.jpg, image1.jpg, image2.jpg" etc...

Can anyone help???

Many Thanks


Craig

View Replies !    View Related
Displaying Contents Of A Text File In A Text Box
As the topic describes, I need to display the contents of a text file in a text box. How would one go about doing this? Thanks in advance.

View Replies !    View Related
Displaying Info From An Array
Hi guys
i have a problem. I am creating a online shopping cart in flash 5 solely and I have a problem. I want to display the items that have been chosen by using the numbers collected in an array and using that data to display a description of what the user has selected. I am using the for syntax but it does not seem to be picking out the data from my array.Has anyone got a idea how i can look at the numbers in an array and assigne a discription based on a number that has been picked from the array until you have come to the end of the array.

View Replies !    View Related
Displaying Array Grids
I'm using Flash 5, and have run into a problem with regards to arrays.
The program requires three variables from the user (X,Y,Z).
I want Flash to create and display a grid for me, the grid should be X long by Y high, and should display a random number from 1 to Z.
I've sorted out the random number generation, and how to assign the numbers to X. I've then told flash to repeat this process until Y is completed.

How do I now get flash to display this grid in a text box, and will the code below work?

The code I've used so far is below, and may contain errors that need fixing:

//Generates an array 1 to X containing a randomnumber between 1 and Z
function randomnumber () {
countx = 1;
generatenumber= new Array(X);
do {
generatenumber[countx] = (random(Number(Z)))+1;
countx = countx +1;
} while (countx <= X);
}

//Generates an array 1 to Y which should contain the values from 1 to X

countz = 1;
generaterows= new Array(Y);

do {
generaterows[countz]=(randomnumber);
countz = countz +1;
} while (countz <= Y);


Thanks for your help.

View Replies !    View Related
Displaying Values Of An Array
Hi all,

Hope you can help me, I think this is a simple one but I cant figure it out.
What I need to do is display the last element, the second last element and the third last element of an array in dynamic text boxes that have variables numbercalled1, numbercalled2 and numbercalled3. The Array is always changing so this is what I have come up with am I doing something simple wrong??? usednumbers is the array that I want to pull the values from.

mary = usednumbers.length
mary2 = usednumbers.length-1
mary3 = usednumbers.length-2
numbercalled1 = usednumbers.toString([mary]);
numbercalled2 = usednumbers.toString([mary2]);
numbercalled3 = usednumbers.toString([mary3]);

Will this display the elements as I have discribed or am I going about this all wrong. I cant use the pop method as I dont want to change that array but just display the elemants in the text boxes.

Also is there any way that I can do this with usednumbers.slice()

Thanks for your help.

View Replies !    View Related
Displaying Array In Text Box
I'm trying to bring in variables from a remote shared object and add them to an array and display those values on stage either in a dynamic textbox as a variable or using myTextBox.text. I'm able to pass the values into the swf via the RSO no problem, but where I'm running into trouble is getting the entire array to show in the textbox. All I'm getting is the last item that was added to the array....


var rec_array:Array = new Array();

remote_so.theseCredits = function(someName, credits)
{
userName = someName
theseCredits = credits

displayArray();
}

displayArray = function(){
rec_array.push({name: userName, Credits: theseCredits});
for(i=0; i<rec_array.length; i++){
_root.userCredits.CLIST =(rec_array.name + ", " + rec_array.Credits);
}
}

I know there's an easy solution to this I just can't see the forest for the proverbial trees right now!...

Thanks in advance
jH





























Edited: 11/03/2007 at 04:19:53 PM by JHight61

View Replies !    View Related
Displaying An Array Of Movieclips
hello
I am trying to create an array of several movieclips (they are actually just one frame graphics) that will display only one movieclip at any given time depending on a counter value.
I setup an array with movie clip names in quotes

var ChlogoAr:Array = new array("sixties","fifties","forties");

The only way i know how to make this work is to palce all the movieclips on the stage, but outside the document area, then change the ._y value of the one I want displayed

ie.
ChlogoAr[2]._y = 40;

but actually, that doesnt work. Is there a way to accomplish this? Ideally, I would want to setup a placement holder and then display whichever movieclip that matched up with the counter. thank you for any advice.

View Replies !    View Related
Displaying Array Selections
I'm not that knowledgeable with AS, but what I'm trying to do is display my selections from an array. Basically, there are some checkboxes -- from there the user ticks a few boxes, submits their preference and then the system tells them what they have chosen and acts accordingly.

In this case, the reason there is an array is because the user is selecting which videos they want to watch, and the videos will then play after each other, once one of the videos has come to an end.

At the minute, initially the array is set up, the user ticks the boxes, submits, then their options are added to the array. I'm having difficulty looping through the array to find only the values that have been chosen. Any pointers?

View Replies !    View Related
Displaying Array Values And Incrementing Them
Hi,

I have a little month incrementer that Im working on and Im having trouble displaying the months. I can get all the array values to display in the text field, however what I want to happen is when a user clicks on the up arrow the next value in the array will appear (ie January is the default value in the text field. When they hit the up arrow, January dissapears and February appears). Once it gets to December I need it to stop incrementing and once it hits January to stop as well. (I dont want it to loop around).

Right now, I can get it to display the next value in the array, but it shows the default one (january) with it. Ill post my .fla if anyone can help, Thanks.

View Replies !    View Related
Interactive Map And Displaying Array Values
hi

i have this script where you have an interactive worldmap
built up in MC's
and when you hoover over a continent a set of values from an array are displayed in a dynamic textfield

however i made a change in the code and now the values arent displayed anymore because first i needed to click on a button to activate the map and i wanted to replace that with an on enterframe but since i did the values arent displayed anymore

ive attached the fla its mx 2004 format

if someone wants it in mx format let me know

ive been searching all over to find an answer but no luck so far and the site has to be finished next week

View Replies !    View Related
Preloading Images In An Array Without Displaying Them
How would I go about preloading the image links that are stored in an array without displaying them?

I'm thinking - use createEmptyMovieClip for however many images there are - and load them all offstage, but im sure theres a better way of doing this. caching? I dont know


(fyi, my objective is to have Flash know the dimensions of each image before it is displayed onstage. I know php can do this, but id rather find an alternative )

View Replies !    View Related
Help Displaying XML Array Items In Textfields
I am attempting to pull XML content into my flash file and display it in various dynamic text boxes. It is properly looping thru the XML to collect the node data but cannot successfully display that data in my dynamic text fields. I was able to display data from the first Debit Title Node into a movie clip called "myDebitTitle1" but cannot display the data from the other Debit Title Node or the Credit Title Node into movie clips titled "myDebitTitle2" and "MyCreditTitle1". If someone can show me how to display the data in the Account Title nodes, I can do the rest. (Keep in mind that the XML will be changing; pulling in different transactions.)
Here is what I have so far:

var myXML:XML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function(success:Boolean):Void{
if(!success) return;

var rootNode:XMLNode;
var transDetails:String;
var transSummary:String;
var transDate:String;

var transAccounts:XMLNode;

var transDebits:Array;
var transCredits:Array;

//variables for account information
//var accountNode:XMLNode;
//var acctNodeName:String;
//var acctValues:Array;

var isCredit:Boolean = false;

rootNode = myXML.firstChild;
transDetails = rootNode.childNodes[0].firstChild;
transDate = rootNode.childNodes[1].firstChild;
transSummary = rootNode.childNodes[2].firstChild;

transDebits = new Array();
transCredits = new Array();

transAccounts = rootNode.childNodes[3];

numAccounts = transAccounts.childNodes.length - 1; //for some reason counts closing tag

for(var acctIdx:Number = 0; acctIdx < numAccounts; acctIdx++){
acctValues = new Array();
var acctNode:XMLNode = transAccounts.childNodes[acctIdx];

acctValues[0] = acctNode.childNodes[0].firstChild;//number
acctValues[1] = acctNode.childNodes[1].firstChild;//title
acctValues[2] = acctNode.childNodes[2].firstChild;//debitamt
acctValues[3] = acctNode.childNodes[3].firstChild;//creditamt
acctValues[4] = acctNode.childNodes[4].firstChild;//debitsign
acctValues[5] = acctNode.childNodes[5].firstChild;//creditsign

if( acctValues[2] == null) {
transCredits.push(acctValues);
} else {
transDebits.push(acctValues);
}
} // end for

//Results
trace("TransactionDetails: " + transDetails);
trace("-----------------------------------------------------------------------------------");
trace("TransactionSummary: " + transSummary);
trace("-----------------------------------------------------------------------------------");
trace("Date: " + transDate);
trace("-----------------------------------------------------------------------------------");
myTransDetails.item.text = transDetails;
myDate.item.text = transDate;
myTransSumm.item.text = transSummary;
for(var idx=0; idx<transDebits.length; idx++) {
trace("Debits Account: " + transDebits[idx]);
trace(" Number: " + transDebits[idx][0]);
trace(" Title: " + transDebits[idx][1]);
trace(" DebitAmt: " + transDebits[idx][2]);
trace(" CreditAmt: " + transDebits[idx][3]);
trace(" DebitSign: " + transDebits[idx][4]);
trace(" CreditSign: " + transDebits[idx][5]);
myDebitTitle1.item.text = transDebits[idx][1];//got this one to work...the others do not

}
trace("-----------------------------------------------------------------------------------");
for(var idx=0; idx<transCredits.length; idx++) {
trace("Credits Account: " + transCredits[idx]);
trace(" Number: " + transCredits[idx][0]);
trace(" Title: " + transCredits[idx][1]);
trace(" DebitAmt: " + transCredits[idx][2]);
trace(" CreditAmt: " + transCredits[idx][3]);
trace(" DebitSign: " + transCredits[idx][4]);
trace(" CreditSign: " + transCredits[idx][5]);

}

}

function fmtArray(arr):String{
var rv:String = "Array (";
var val:Object;
for(var idx:Number=0; idx < arr.length; idx++){
rv += " [" + idx + "] => ";
val = arr[idx];
if(typeof(val) == "object")
rv += fmtArray(val);
else
rv += " " + val.toString();
}
rv += " )";
return(rv);
}

myXML.load("data2.xml"); //URL for data file

-------------------------------XML---------------------------------------

<?xml version="1.0"?>
<LedgerTransaction>
<TransactionDetails>Working from the journal entry for this transaction, we put 12,000 on the debit side for Office Equipment, 2,400 on the debit side for Office Supplies and 14,400 on the credit side for Accounts Payable.</TransactionDetails>
<Date>4/3</Date>
<TransactionSummary>Bought $14,400 worth of Office Supplies and Equipment on credit</TransactionSummary>
<Accounts>
<Account>
<Number>124</Number>
<Title>Office Supplies</Title>
<DebitAmt>2,400</DebitAmt>
<CreditAmt/>
<DebitSign>+</DebitSign>
<CreditSign>-</CreditSign>
</Account>
<Account>
<Number>163</Number>
<Title>Office Equipment</Title>
<DebitAmt>12,000</DebitAmt>
<CreditAmt/>
<DebitSign>+</DebitSign>
<CreditSign>-</CreditSign>
</Account>
<Account>
<Number>201</Number>
<Title>Accounts Payable</Title>
<DebitAmt/>
<CreditAmt>14,400</CreditAmt>
<DebitSign>-</DebitSign>
<CreditSign>+</CreditSign>
</Account>
<Accounts>
</LedgerTransaction>

------------------------------------------------------------------------------

I am also including my source file and XML file. I am using MX2004 Professional.

Thanks in advance!!

View Replies !    View Related
Displaying Array-Urgent Help Required
Hi
I have a function in which an array is passed.The code is:
public function add(data:Array):void{
var i:uint = data.length;
var mytext:TextField = new TextField;
mytext.appendText(String(data));
}

<mx:HBox id="mybox" height="100%" width="100%">
<mx:TextArea id="mytxt" text="" height="100%" width="100%" />
</mx:HBox>
If i access the array in textarea it is displaying as a singlestring.
The Array length keeps changing and will contain values like "mobile,name".
i want the array to be displayed within the Hbox one entry after another along with a checkbox.
How can i dynamically create textfield/area and checkbox to insert data?

Thanx in advance
Sheetal

View Replies !    View Related
Displaying Images Contained Within An Array
How would would you display all the images within an array? This is as far as I've gotten so far...

var images:Array = new Array;
images[0] = "1.jpg";
images[1] = "2.jpg";

for (i=0;i<images.length;i++) {

...
...loadMovie(images);

}






























Edited: 12/14/2006 at 12:25:27 PM by fwitt

View Replies !    View Related
Displaying A Partial List Array?
Hi, I'm trying to figure out how to take an existing array of elements (for sake of argument, earth, air, fire, water), and have a text display list as the base, +/- based on button behavior.

So, for example, if I begin with earth, air

and click the add button, it will switch to "earth, air, fire"
if I click the add button again, it will display the four elements "earth, air,fire, water", and if I click the subtract button, it will subtract from the list (earth, air, fire... earth, air.... earth... undefined).

The idea is to be able to go from a completely empty list (undefined) to completely full (such as four elements) and back, in increments of one. String(aElements.pop()); works fine for removing elements from the list, but
aElements.push("___"); is completely insufficient for the task.
Ideas?

View Replies !    View Related
Displaying Array With Line Spacing?
myArray = ["a","b","c"];

& a dynamic text with var name display


ActionScript Code:
display = myArray;


the result is => a,b,c

How to make it =>
a
b
c

please help me..
thanks

View Replies !    View Related
Displaying Array With Line Spacing?
myArray = ["a","b","c"];

& a dynamic text with var name display


ActionScript Code:
display = myArray;


the result is => a,b,c

How to make it =>
a
b
c

please help me..
thanks

View Replies !    View Related
Problem With Displaying Text From Array
can someone please explain to me why this doesnt work?

ActionScript Code:
for (var i = 0; i < 25; i++) {
    var types:Array = new Array ("text1", "text2");
       
    this["line" + i + "_mc"].onRollOver = function(){
        relationType_txt.text = types[i];
    }
    this["line" + i + "_mc"].onRollOut = function() {
        relationType_txt.text = "";
    }
}


i only get undefined as result... I have 25 line[number]_mc's and I want them to display a different text according to their number and the position of the text in the array... I have a feeling this shouldnt be very difficult, but I cant get it to work...

thanks!

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