ActionScript 2.0 :: Incrementing Within Arrays Using XML Data

Jan 6, 2007

I'm working with a gallery grabbing images from data extracted from an external XML file, and I'm trying to make it work in a hierarchical or folder like structure in Flash 8.For instance, thumbnails are displayed on load, and when a thumbnail is clicked, more thumbnails specific to the image clicked are displayed.As sort of a beginner to Flash and ActionScript, I've been working with this project for a couple months.There is one obstacle I'm facing within the 'for' loops I'm using.First, an example of my XML file is like this:[code]This way displays the catalog look just as I'd like, but it is only good for the first piece of art since this 'for' loop only loops through the <products> node within the first <art> node. Now, if I change 'this.childNodes[0]'to 'this.childNodes[1]',I can display the <products> for the next <art> node.The part that I have not been able to figure out is how to increment that 'this.childNodes[x]' so that I can use it in an onRelease function.

View 4 Replies


Similar Posts:


ActionScript 3.0 :: Arrays Of Arrays / Data Providers And Dictionarys

Aug 26, 2009

I've got a bit that loads a big chunk of xml data about products.I push product info into an array(e.g. productArray), then add that array to another array (e.g. allProductsArray)How do I sort those arrays? For instance, if I want to sort the allProductsArray based on the info in productArray[0]?Alternatively, would something other tha an array of arrays be a better route?This loader loads the same sort of info for many different clients, so the bit to sort on will change.

View 5 Replies

ActionScript 2.0 :: Pull Data From The Arrays And Put That Data Into Text Fields?

Oct 24, 2006

Flash 8, I have some XML creating a few simple arrays. These pull some movie clips onto the stage with incremented names: product1, product2 and so on. Inside these clips I have some code that is supposed to pull data from the arrays and put that data into text fields.

[Code]...

Shouldn't this last output be the number 1? I want to use this number to call the correct node for each clip,

View 2 Replies

ActionScript 3.0 :: Finding Data In Arrays

Nov 25, 2009

So how do i go about using something like indexOf() on a multilevel array? for example, lets say i have the following array:[code]how do i find the index of lets say "tree 1 data 2"?

View 4 Replies

ActionScript 3.0 :: Get A Grip On Arrays And XML Data?

Jan 20, 2010

I need to get a grip on arrays and XML data but I'm having trouble understanding how to turn xml data into useful data. I was hoping these forums might provide some insight.

I load my XML with this code:

Code:

//set values for XML data file
private var XML_URL:String = "http://www.mysite.com/media/locXML.xml";
private var locXML:XML = new XML();
private function getXMLdata():void

[Code].....

how can I do that without taking up 2000 lines of code? I was hard coding a number in each one of those '[]' brackets, but that is becoming very painstaking...?

View 1 Replies

AS3 :: Arrays - Accessing XML Data Randomly

Oct 21, 2011

After reading data from XML source I like to be able to show one random item from data whenever, say, clicked a button. I think I can accomplish this by storing the data into an array and use it from the array. I would like to learn if possible to do it directly from xml without storing it into another array.

var myXMLLoader:URLLoader = new URLLoader();
myXMLLoader.load(new URLRequest("XML_NOTES.xml"));
myXMLLoader.addEventListener(Event.COMPLETE, processXML);

[Code].....

View 2 Replies

ActionScript 2.0 :: Access Data From XML Arrays?

Nov 21, 2006

I keep getting 'undefined' if I ask for the value of a variable from an array into which XML data has been loaded.[code]...

View 1 Replies

ActionScript 3.0 :: XML And Arrays - Extracting The Data From An XML

Jun 2, 2009

I'm having trouble extracting the data from an XML file that I've loaded into arrays in flash. Ultimately the XML file will sit on a server and will be updated separately from the flash file. What I am trying to do is get text boxes to pull in the data from an array when a button is rolled over.

View 1 Replies

ActionScript 3.0 :: Pulling X,y Data From 2 Arrays FLASH?

Jan 1, 2012

I loop through two arrays and im checking their data, i have collison working for them but I want to add more A.I. by making them stop when they are a certain distance from each other. so i need a way to pull EACH object that is in the arrays x,y, pos and use that data. my distance var keep bouncing all over the place...
 
THIS is my code:
//check events between 2 objects
function CheckEventsEnemyFighterFighter():void
{

[Code]....

P.S. i need some tips for my coding... like should have i used a break in these for loops?

View 2 Replies

Actionscript 3 :: Preferable Way To Manage Data Classes Or Arrays?

Apr 7, 2012

I'm making a turn based RPG in Flash, with AS 3 as the language,Basically, my idea was to put all of my weapon data on a single multi-dimensional array. Now if I want to add a weapon into my inventory, easy, i just use inventoryArray.push(weaponArray[1]) Easy, I just added the weapon into my inventory.I've been looking into Design patterns, and it seems that most OOP designs are using classes and inheriting from a superclass. Component-->Weapon-->Sword-->LongSword. What should I go with, putting all data in one array or using the inherit style, with one class containing a single weapon?

View 2 Replies

Xml :: Make Flex Create One-element Arrays From Data?

Nov 2, 2009

I retrieve XML data in Flex via HttpService. I have the resultFormat property on the HttpService instance set to HTTPService.RESULT_FORMAT_OBJECT. The result contains data similar to this:

<!-- ... -->
<children>
<item><!-- ... --></item>

[Code]....

I get an array named item beneath the element children when there is more than one item sibling. If there's only one, the conversion can't distinguish it from a scalar.

What do I need to change to have Flex convert all item elements to an array with 0 or more elements?

What would I have to do to get an array member children, dropping the item wrappers altogether?

The XML is generated by Struts on the server side. I always have the option to change the structure of the document there, but right now I'm interested in what I can do with Flex.

View 2 Replies

Flash :: Obtain And Push JSON Data Into Arrays?

Sep 13, 2010

so I have a JSON link that contains a couple of nodes (not sure what you call them in JSON) that I need to put into arrays in ActionScript, but I'm still having trouble trying to trace out all the specific node content.I found a similar question here, but the fix just showed how to trace out the entire JSON file (which shows up in my output window as [object Object],[object Object],[object Object],...)first node: {"captions":[{"content":"[hello world] ","startTime":0,"duration":4000}

My code:

private function onCaptionsComplete( event:Event ):void
{
//var jsonObj:Object = JSON.decode(event.target.data);[code].....

captions: undefined

TypeError: Error #1010: A term is undefined and has no properties.What I would like to be able to do is put the content data into the captionsContent Array, and the startingTime into a startingTime Array, same with the duration data.

View 1 Replies

Arrays :: Flash - Data Being Lost Outside Of Loader Function

Nov 4, 2011

Trying to make a grid based question answer game and load variables from a text file using for loops into an array. I wanted to reduce redundant code and use for loops to populate my arrays. The issue I am having is with my arrays being lost/destroyed outside of the loader function.

I understand that if an array is declared inside the function, naturally the array would be destroyed upon exit of the function. However I am declaring the arrays outside of the function so the arrays should remain intact after I exit the function.

BTW - I'm not having an issue with the loading of the data. The data is loading correctly. The array is simply being destroyed after the data has loaded.

//Create the arrays to hold the
//categories, questions, and answers
var categoryArray:Array = new Array();
var quesAnswArray:Array = new Array();

[Code].....

View 1 Replies

ActionScript 3.0 :: Created A Method Which Parses The Data And Returns Various Arrays?

Oct 9, 2009

I have loaded an XML file in the class LoadXML and have here created a method which parses the data and returns various arrays: an array of background urls (i called the array: hintergrund[]), an array of image paths (pfad[]), an array of website urls (website[]) and so forth. In the main class I would now like to load the backgrounds and images. I must have made a mistake in my onBackgrLoad() because I keep receiving the error msg:Error #1084: Syntax error: expecting rightparen before colon.Here are the relevant sections in my Main class:

package { import flash.display.Sprite; import flash.net.*; import flash.display.*; import flash.events.*; import flash.display.Loader; import flash.filters.DropShadowFilter; import flash.net.URLRequest; import flash.text.*;// import de.container.text.Container_Text; // To

[code]....

View 18 Replies

Flash :: Arrays - Passing Audio Data ByteArray To Javascript?

Sep 7, 2011

I'm able to record sound with a Flash application embedded in my website, this audio is saved to a ByteArray, which I need to pass to Javascript in order to post to my server along with other required data.

I know I can use AS3 ExternalInterface class to communicate with Flash from Javascript, but what would be the appropriate format or variable type in javascript to hold the ByteArray, and how can I ensure that I won't lose much audio data when doing so?

View 1 Replies

ActionScript 2.0 :: Display Data In Arrays In Sequence While Click Button

Jul 6, 2004

i m doing a program which contain few text. When i click a button,'step 1' text will be view. When i second, 'step 2 ' text will be load out and 'step 1' text is still in the stage.. the method i m using is array.i put my text in an arrays.

View 9 Replies

ActionScript 2.0 :: Load Variable Data From An External XML File And Dynamically Displays The Item Names In A Menu - Arrays - Functions

May 18, 2005

I have been working on a Flash movie that loads variable data from an external XML file and dynamically displays the item names in a menu which may then be clicked to display other dynamically-loaded content that corresponds to the menu item that was clicked. I have now come to a standstill in the project as there is something I'd like to achieve but simply cannot work out how. This is my first attempt at working with XML in Flash and one of my early attempts at using variables. What I'm trying to achieve is; once the user has viewed the item's content, they can simply click "next" and "previous" buttons to display all of the content for the next or previous items in the XML document.

I know it probably sounds simple and I'm sure some of you could achieve this in 5 minutes (!) but I can't get my head around some of the coding. I assume previousSibling and nextSibling would come into play here as well as some sort of functions which access arrays of data for the previous and next items, but I'm just not sure how to correctly put these things to use. Rather than post my code and example images of the stage up here on the forums, I've created an html page here: [URL]

View 2 Replies

Actionscript 3 :: Why Isn't Variable Incrementing

Feb 18, 2012

When the user presses the space bar, I'm trying to take one string from a series of strings labeled c1-c9, break it into an array, display that array, and then increment the linenumber variable at the end of the function so that the next time the space bar is pressed, the next string in the series is traced and so on and so forth. Here is the relevant section of script (the strings and the linenumber variable have been declared earlier)

[Code].....

Every time I press the space bar, though, I just get the traces of the initial string and linenumber value repeated without any incrementing. I think it may have something to do with the "this" before the bracket in this line var displayarray:Array = this["c" + linenumber].split(" "); which I found in a code sample on some website and do not understand at all, but I get compiler errors if I try to join the "c" and the line number without the "this" there.

View 1 Replies

ActionScript 3.0 :: Incrementing Integer On Each Two Hours

Mar 29, 2010

I try to increment each 2 hours but I don't know how to proceed.

View 2 Replies

ActionScript 3.0 :: Rotation And Incrementing Variable?

Sep 28, 2009

I'm working on a flash movie that involves the use of rotating 3 objects in a matter that the first one moves 18000 degrees cw according to the value in the 'num' variable. The 2nd object rotates -1800 degrees. The third one rotates 180 degrees.

What I actually want to do is create a movie of the older analogue electric meters that had the 5 dials that represented each digit so if the far right dial moved from 0 to 5 the 2nd would move the opposite way to be between 0 and 1 and the third a hair to the right of '0' and so on in increments of 1/10.

When I run the below code the dials ( I currently useing jetplanes until I draw or locate a pointer image file as well as the circle with 0-9 marked off in it) stay on 500 and should be moving a bit since I have another variable that increments num by 1. I tried using the Timer event and would get several errors. I also know that the way it runs now doesn't work since num is going to be assign the same value of 18000 since I have it setup to gotoAndPlay(1) in frame 2. How would I be able to have it so that so it would increment without getting undefined variables. I also tried a for loop to increment the num but the stage would instantly show the end result after the loop was done.

code
--------------
var num:Number = 18000;
var i:Number= 0;

[code]...

View 0 Replies

ActionScript 3.0 :: Incrementing X Propety By 0.01 Does Not Work

Oct 3, 2009

Just having problems with incrementing the x property of an object by 0.01 using a timer.It works with 0.1, but does not seem to work with the value 0.01 (commented code).[code]

View 3 Replies

ActionScript 3.0 :: Incrementing A Number Randomly?

Nov 16, 2009

I'm trying to get a text field that behaves like a fake hit-counter. Adding random numbers and getting larger each time:

My code doesn't add up though, it just replaces the text each time!!

var incrementTimer:Timer = new Timer(1000,0);
var lastNumber:uint = 0;
incrementTimer.addEventListener(TimerEvent.TIMER, incrementNumber);
incrementTimer.start();

[Code]......

View 1 Replies

ActionScript 2.0 :: Incrementing A String Variable

Mar 15, 2012

I basically have a text file with a username variable that assigns usernames to username1, username2, and so on. I would like to create a loop that checks to see if that username was created and if it was a conditional statement will follow. The problem I have is I want to do a loop with a counter(var i) and increment that counter in the loop and concat that with loginName to input that into a dynamic textfield labeled loginName1. (Actionscript 2)[code]I am using loadvars to load 2 text files, one has username and ip(username1 = blahblah ipaddress1 = blahblah and so on), the second file has an array that has ipaddress and data usage passed in an array. i want to check how many usernames there are and check the ipaddress of that username against the other file containing ipaddresses and usage.) I have everything setup, but im running into issues when writing a loop to check for username1, username2, and so on.

View 2 Replies

Actionscript 3.0 :: Loop Not Incrementing Values

Apr 24, 2010

I've solved this problem in AS2 but I can't seem to sort it out in AS3.[code]...

View 1 Replies

ActionScript 2.0 :: Incrementing An Array Of Movies?

Jun 13, 2005

I'm trying to create a spinner for different ads for an advertising company website. Each ad has a name, such as "out" "pie" and "bigger". All of them are turned off except "pie" to start off with:

Code:
//initialize movie
var itemArray:Array = new Array();itemArray[0] = out;
itemArray[1] = pie;
itemArray[2] = bigger;

[code]....

The thing is, I can' figure out the button script to cycle through this array. I want to click a forward and back button, lets use forward for now, and do something like (don't mind the syntax):

Code:
on (release) {
i+1, remember the spot, and make everything else invisible.
When you click again, you increment to the
next ad/instance name and so on.
}

What is the actual syntax for this?

View 3 Replies

ActionScript 3.0 :: Incrementing Values To A Variable

Jun 17, 2011

i'm trying to add values to a variable.[code]a simple drag and drop on a MC.i would like to store the X displacement when i drag. let say i have 30 in a variable wich store x position of myMC, if i drag the MC 200 units the variable should read 230 and so on.

View 2 Replies

ActionScript 2.0 :: Won't Stop Incrementing While Being Hit By An Object

Feb 3, 2012

I have a problem creating scores in my game. how can i stop it from incrementing +1? [cod]e...

View 2 Replies

ActionScript 2.0 :: Incrementing A Variable With Buttons?

May 20, 2005

I've followed several tutorials on how to do this, but my dynamic text box always returns a value of "Nan" when I try to increment it's value.I've been trying to use Code:_root.total = _root.total + 1;] in an on release function. Even if i managed to get this to work though, I still need to reuse the variable i'm incrementing within other calculations.

View 2 Replies

Arrays :: Flash - Pushing Or Adding Arrays As Values Into A Multi-dimensional Array?

Jan 21, 2011

I am running into some trouble adding an array into another array to create a multi-dimensional array.The code appears as below:

var slideDataArray:Array = new Array();
var slideShowDataArray:Array = new Array();
slideDataArray[0] = xmlData.SlideShowParameters.SlideShowImagesDirectory;[code]........


I am looking for a means of placing the slideDataArray into a 'slot' or value of slideShowDataArray so that I can in the end pass the slideShowDataArray as a parameter to another function.As of now, the last slideDataArray appears 11 times (the loop runs 11 times) in slideShowDataArray and the way the code is written the slideDataArray is unique every iteration of the loop.

View 1 Replies

ActionScript 2.0 :: Looping / Incrementing OnRelease Function?

Mar 6, 2009

Just getting up to speed on looping and incrementing variables. A real time saver.I have a onRelease function that I would like to apply to several button objects:

phase1a.but1.onRelease = function() {
p=0;
thisImage();
}

I need the p variable as well as the target but1 to increment. This is my first attempt:

for (n=1; n<=23; n++) {
phase1a.but[n].onRelease = function() {
p=[n+1];[code].......

I get a good trace on n showing that the incrementing is successful but nothing on p when the button is clicked and no execution of the function thisImage(). Not getting any errors either. Can you not loop an onRelease statement?

View 13 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved