ActionScript 2.0 :: Can't Access The Array Outside The Xml.onLoad Function

May 8, 2008

However I have an upcoming project that's going to have a big image gallery, that is likely to change often, so I can see XML would be very useful for speed of editing/adding etc.

I'm a complete XML noob then, and I'm just doing a little test with some text, and I can't seem to access the Array outside the xml.onLoad function.

Here is the xml...

Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<writing>
<para>

[Code]....

Now in the above code, my dynamic text field named "desc" correctly displays "bloody hell, XML is a nause".

However, when the line in bold is placed outside the onLoad function, it returns undefined, and when traced, the description array returns nothing at all.

I need to access the array outside of this function.

View 6 Replies


Similar Posts:


ActionScript 2.0 :: Cant Seem To Access Array From Outside OnLoad

Dec 30, 2003

I've done the following [code]trace gives me a,b,c. am i missing out something? i cant seem to access the array from outside onLoad() ...

View 5 Replies

ActionScript 2.0 :: Can't Access The Array From Outside OnLoad()

Dec 30, 2003

I've done the following

[AS]
playList_lv = new LoadVars();
playList_lv.load("playlist.txt");
playList_lv.onLoad = function(){

[Code]....

trace gives me a,b,c. am i missing out something? i cant seem to access the array from outside onLoad() ...

View 5 Replies

Actionscript 2.0 :: Access Sound Duration Outside Onload Function?

Jan 21, 2009

How to access the sound duration outside the onload function....im trying to diaply the duartion of each song in the playlist by loading them one after the other...but am not able to access duartion of all the mp3 files....i want to knw if there is any way to access the sound duration outside the sound.onload function.

View 3 Replies

ActionScript 2.0 :: XML Loads Other XML Files, Onload Function In Onload Function?

Nov 20, 2006

I am writting an image gallery that loads one intial xml file named galleries.xml.From this point each xml node loads a XMl file for that gallery that holds all the images.The problem arises in the fact that to do this I need a onload function within an onload function.Onload functions dont accept parameters so I can pass down the variable that shows what loop the gallery loop is on as I need that in the function that holds the images.

View 4 Replies

CS3 Access Array From Different Function

May 10, 2009

I've been having a few problems with accessing an array from a different function.

The array I want to use is from the makeFly function, which generates instances of the Fly MovieClip. I want to access the array from the paperSwing function, which should test for a collision between the mouse cursor and the fly movieclip, and then if true remove the instance. This is the part where I'm having a bit of trouble, I'm not sure of how to access the array "name[i]".

This is from the "Main" Document class:

Code:
package {
import flash.display.*;
import flash.events.*;

[Code]......

View 2 Replies

Can't Access Array From Function

Sep 13, 2011

I'm having trouble accessing the turnQueue array which is being updated in the first function and accessed in the second, no idea what the rules are between functions for actionscript. Heres the code, I want the turnQueue to be growing as keys are pressed, and at the moment its not updating from the first function.

public function keyListener(e:KeyboardEvent):void {
trace("Key Entered");
if (e.keyCode > 36 && e.keyCode < 41) {

[code]....

View 2 Replies

ActionScript 3.0 :: Access Array From Different Function?

May 10, 2009

I am fairly new to actionscript, I've been having a few problems with accessing an array from a different function.

The array I want to use is from the makeFly function, which generates instances of the Fly MovieClip. I want to access the array from the paperSwing function, which should test for a collision between the mouse cursor and the fly movieclip, and then if true remove the instance. This is the part where I'm having a bit of trouble, I'm not sure of how to access the array "name[i]".[code]...

View 2 Replies

ActionScript 3.0 :: Can't Access Array From Function

Sep 13, 2011

I'm having trouble accessing the turnQueue array which is being updated in the first function and accessed in the second, no idea what the rules are between functions for actionscript. Heres the code, I wanted the turnQueue to be growing as keys are pressed, and at the moment its not updating from the first function.

[Code]...

View 1 Replies

ActionScript 2.0 :: Access That Array From A Function Using A LoadVars Object Called LoadDVDsText?

Feb 28, 2004

I'm using an onLoad function (importing variables from a text file) and I'm creating arrays within a for loop in the onLoad function.
I'm using something like this:

Code:
this["dvdAry" + i] = this[indexAry[i]].split("##");
So say the first array is called dvdAry0 .

How can I access that Array from a function? Please note the function, the onLoad function and the arrays are all being created on the same timeline.I've tried tracing the array dvdAry0 from the function after the array is created in the onLoad function, but it comes up as undefined. Is the array created on the object that I'm using onLoad on?I'm using a loadVars Object called loadDVDsText.

View 2 Replies

ActionScript 2.0 :: Mc.onLoad = Function

Mar 25, 2005

look at this code, what's wrong?

_parent.unit['bullet'+openbullet].onLoad = bulletload;
function bulletload() {
this.range = 5;[code]...

my mc.enterfame works but this doesn't. I think it's because it's on load and for this to be implemented it has to be called after load so how do i use it? I tried to call it on the original but it didn't work.

View 6 Replies

ActionScript 3.0 :: How To Run Function OnLoad

Feb 23, 2009

Is there a way that I can run a function when it first loads, as if it wasn't inside of the function, but still be able to call that block of code as a function later on? For example if I did...

Code:
someFunction();
function someFunction():void{
//do this
}

It wouldn't work correctly.. I need it to do what is inside the function as if it wasn't in the function, which it loads, but also be able to call it again later on.

View 2 Replies

IDE :: Function Not Getting Called In OnLoad?

Mar 9, 2009

I am loading one xml file and onload (or onData) of this file I am calling another function but, this function is not getting called. What can be the issue? Can delegates be used here and how?

Here is the code for reference

Code:
//path for _global.bookXML is defined already.
_global.book_xml = new XML();
_global.book_xml.ignoreWhite = true;

[Code]....

View 2 Replies

ActionScript 2.0 :: XML.onLoad And Other XML Function

Oct 8, 2004

load XML data (it parses automatically), parse through the XML tree and assign the values to an array of my choosing for access later in the movie. I can load the XML data, but the only time I can access the XML functions, i.e. XML.firstChild, or XML.getChildNodes(), is when I am within an XML. onLoad function.[code]Shouldn't I be able to call these XML function and properties from anywhere? not just within the XML.onLoad function? I look at other people's scripts and they do it, but I can't?I created a function that parses through the data and puts it into an array. And that works well if I say XMLdata.onLoad = my_array_funtion();But the problem is, if I do it that way I can't get the array out of the function. I can't return the value because the function is being called from an onLoad event and the return value of the function isn't assigned to a variable. So the array I create is worthless.And there is no way to call the function, and have the XML.functions, i.e. XML.firstChild, to work outside of an XML.onLoad event. Is there? Please tell me there is a way.I tried assigning the array to a global variable, but evidently you can't modify _globals within a function.Ultimately, I need this array because later in the script I use the data on the fly, and I want instant access to it.

View 2 Replies

ActionScript 2.0 :: Mc.onLoad = Function?

Mar 25, 2005

[Code]...

my mc.enterfame works but this doesn't. I think it's because it's on load and for this to be implemented it has to be called after load so how do i use it? I tried to call it on the original but it didn't work.

View 6 Replies

ActionScript 1/2 :: Trace() The Length Of An Array Outside The OnLoad()

Oct 14, 2009

I have a question i need to get the length of an array but outside the onLoad()
 
here is my code:
 
var O:XML = new XML();O.ignoreWhite = true;O.onLoad = function(success) {
var photos:Array = this.firstChild.childNodes;    _root.PanelH = photos.length*200;    trace(PanelH);};trace(PanelH);O.load("VideosBank.xml");

View 1 Replies

ActionScript 3.0 :: XML OnLoad Function Without Listener

Sep 9, 2010

Can I write onload function without using EventListener...? Iget boolean value from loader..?

View 1 Replies

ActionScript 2.0 :: OnLoad - Attempt To Use Outside Of The Function?

Aug 5, 2009

I have this code

[code]...


so, where is my code inside the function I have some variables which are global variables that I declared and I attempt to use outside of the function.Is this possible ? I ask the question cause I don't see that they work

View 6 Replies

ActionScript 3.0 :: Can't Get Xml Data Out Of The Onload Function?

Apr 28, 2011

I can't figure out why this doesn't work. I need to pass the text in the xml file to an object that needs to be created outside of the onload function so i need access to the data out side of that function. I've declared variables to store the data at the class level which i thought would give me access to the databelow is the code:

Code:
package {
import flash.display.MovieClip;

[code].....

View 2 Replies

ActionScript 3.0 :: Load Random Frame From Array Onload?

Dec 2, 2010

i have an array containing the frame numbers and i would like to add an onload event so a random frame from this array would be played on load

View 7 Replies

ActionScript 1/2 :: Xml.onLoad Variables Undefined Outside Function?

Aug 25, 2009

I've been searching this problem for a while and have tried a number of solutions found on google but nothing has worked so far. I'm sure this is a common problem, but due to my lack of flash knowledge I can't logically work through it as I'm used to windows form development, it makes sense to me that the function could access the variables I have defined but they dissapear after the .onLoad event. Does anyone know the common solution to this problem? I want to be able to pass the xml details into the local variables so I can pass on the details into a dynamic text field when movies are hovered over etc

var myXML:XML = new XML();
myXML.ignoreWhite=true;
var nav1Text:String;

[code].....

View 3 Replies

ActionScript 2.0 :: OnLoad Function Not Running Within Section SWF

Feb 9, 2004

I have 2 swf's:
Section.swf (to be loaded in main)
Main.swf

In section.swf, on the first frame I have this:
[AS]
onLoad = function(){
// start doing stuff
}[/AS]

When I run the section.swf on its own, the onload function works, and the "doing stuff" code runs. But when I load it into main, this onload (within the section.swf, above) does not run!

View 7 Replies

ActionScript 2.0 :: Break The For-loop From Within The OnLoad-function

Feb 21, 2004

I would like to break a for-loop. It should be easy with "break;", but there is a slight complication to the code - the for-loop contains a function from within which I want to be able to break the loop. Here is a codesnippet:

[Code]...

So, somehow, I want to break the for-loop from within the onLoad-function. Is that possible with some other code (this ofcourse doesnt work)?

View 6 Replies

ActionScript 2.0 :: How To Call Function Within OnLoad In Class

Jun 14, 2006

I'm trying to call a function with a onLoad function in a Class
XML_var.onLoad = function(success) {
anotherFunction();
}

View 6 Replies

ActionScript 2.0 :: Calling A Function From Within Sound.onLoad()

Sep 11, 2007

So I'm trying to call a function from the onLoad method of my sound object and something is wrong with my scope.

see my example...

Code:
class com.infect.SoundController{
private var soundObject:Sound
private var soundMC:MovieClip

[Code].....

View 2 Replies

ActionScript 2.0 :: OnLoad Function - Reading Text File

Feb 16, 2008

Code:
onLoad=function() {
my_text=new LoadVars()
my_text.load("C:\Documents and Settings\Wrkspace\Desktop\flash_wordlist.txt");
my_wordlist="";
} my_text.onLoad=function(success) {
if(success) {
my_wordlist=(this.var_wordlist).split(" ");
trace(my_wordlist)
}}

The trace doesn't showup at all....by the way, this is in the first frame of the timeline, and i am trying to load a wordlist and then use the words in my program separately. Is it because flash loads the text file slowly? I am using flash 8, AS2.

View 2 Replies

ActionScript 2.0 :: Internet Adress Doesn't Even Get Into Onload Function

Aug 21, 2004

I'm building a streaming mp3 player. So that you can load a mp3 from all over the internet in a streaming way, but soon It became obvious that when I set the loadSound to true (used to stream sounds) that sometimes the mp3 begins to stop and load and then play again. A sort of short stops. So I thought let's place a buffer so that when the song is loaded half way it's starts playing and gone are the short stops. But that's where my problem started and some questions arised. I use the onload method to check if any sounds are loaded into the sound object. I used this sentense to handle the onload action:[code]But now that I'm not exactly streaming anymore, so I have set the loadSound to false. Now I wonder if the onID3 method I used for getting some specific information out of the mp3 also acts like a none streaming file stream?Also something is wrong with my check if the loading process is half way.I have some songs on my pc and one on the internet. The songs on my pc load very well. (offcourse ) But they don't get into my if statement. And the song loaded from an internet adress doesn't even get into the onload function

View 2 Replies

Javascript :: Soundmanager2 IE Playback - 'onload' Callback Function Is Defined As Null

Apr 5, 2012

I'm currently working with soundmanager2 in an IE/flash context (not html5). The issue is that audio playback of mp3 content does not occur for the following case where the 'onload' callback function is defined as null OR as a function that does almost nothing.

[Code]...

View 1 Replies

ActionScript 2.0 :: Include In A Class The Implementation Of The OnLoad Function Of The XML Class?

Dec 14, 2005

how to include in a class the implementation of the onLoad function of the XML class. I have something like:

[Code]...

View 2 Replies

ActionScript 3.0 :: Access Array In Arraycollection And Add Item To The End Of Array?

Aug 24, 2010

I have this code to try to acess the values of the array in the arraycollection but it does not work it actually creates a value to the end of the arraycollection. can anyone tell me what im doing wrong i basically whant to modifys the individual arrays in the arraycollection and add Login_user.

Code:
for(var i:int = 0; i< dispArray.length; ++i){
dispArray.addItemAt({"login_user":"XXX"},i);
}

View 1 Replies







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