ActionScript 2.0 :: For Loop For Loading External Data?
Jul 28, 2009
I have a bit of a problem finding the correct syntax. I have a whole lot text variables here. The myLV value is in a external text file. So myLV.nr1 from my external textfield is loaded in ovrnr1.text. This way I can easily change the value in my text document.
ovnr1.text = myLV.nr1;
ovnr2.text = myLV.nr2;
ovnr3.text = myLV.nr3;
ovnr4.text = myLV.nr4;
If I put it like this it works fine but I thought, hey, in stead of writing
150 of these I can put it in a for loop. So I tried this.
for (i=1; i<150; i++) {
ovnr[i].text = myLV.nr[i];
}
However, this does not seem to work ? And could I do it to a button too ? So instead of writing 150 button onrollovers I could also make a loop for it ?
Something like
for (i=1; i<150; i++) {
this.btn[i].onRollOver = function() {
[Code]....
View 2 Replies
Similar Posts:
Sep 23, 2011
I would like to create thumbnails in a player. For that, I have to load external swf files in a scrollPane component.
so in a for loop, I attach a thumbnail container in the scrollPane content, and with that container I load the swf.
the idea of the code is that :
mcThumbnailsScrollpane:MovieClip = menu.thumbnailsScrollpane.content;
var X_pos = 30;
var Y_pos = 25;
[Code].....
and so basically 8 or 9 thumbails are visible (on 34). furthermore when I skip the loadMovie and let only the container, I can see all containers. so I feel like the ScrollPane is not refreshing fast enought, or the movies take too long to load ...
View 6 Replies
Jun 25, 2011
I've spent days working on this code, it seems so simple, but yet it never works. All I'm trying to do is make a loop automatically load person0.swf through person4.swf in the same directory. I've got it set-up so that I can change a single number and it loads up to person[whatever-the-new-number-is].swfCurrently it loads the first movie and thats it. I also get this error: "TypeError: Error #1009: Cannot access a property or method of a null object reference.at Menu()"Here is the code
package {
import flash.display.*;
import flash.net.URLRequest;
[code].....
View 3 Replies
Mar 2, 2012
I 'm checking to see if an image file exist but I don't think the code checks but the last iteration in the loop. Here's my code:
[Code]....
fix this or if you know a better way to check if an image file exist could you let me know.
View 1 Replies
Jun 30, 2010
Im working with FlashDevelop and have two main projects, all pure AS3 projects.When trying to load my second project from my main project I get all kinds of errors.The Main class of the main project extends Sprite and the Main class in the "to-be-imported" project extends MovieClip. Looking at the loading of the swf in the debug window in FD it all seems fine:
[SWF] 'pathToSwf'secondProject.swf - 410 626 bytes after decompression.
If i try to assign the loaded swf to a newly created MovieClip I get a coercion failiure:
swfContent = loader.content; // =>
Type Coercion failed: cannot convert Main@46c0201 to flash.display.MovieClip.
So, typecasting the loaded content like so:
swfContent = loader.content as MovieClip;
removes that error but then I fall into the next pit as I try to call addChild:
Error #2007: Parameter child must be non-null.
Trying to get around the issue I tried to add the loader directly into the container where I want to show the external swf. This is when the real interesting problems begin:
targetContainer.addChild(loader);
My main application now hang, restarting in a never ending loop. How can my external swf be loaded but then again be null.It works perfectly fine when I run the external swf by itself...
View 5 Replies
Jul 21, 2006
Is there a way to load an XML file if it's on a differen server/domain than the html/swf file? I already set allowScriptAccess="all" but it didn't seem to help.
View 1 Replies
Jan 15, 2009
Having done loads of it in the first few years of this century, I've not done much Flash in the past few years, been focused on PHP/MySQL Development. Anyway, I now need to use the data from a MySQL database offline in a Flash executable so I'm jumping back in with AS3. There are several tables involved and I can write a script to export the data to whatever format is best.
XML or CSV? Should I get it all into one file with all the data or is it possible to do the quivalent of joined queries once the data is in Flash? I don't need a full explanation at this stage,
View 8 Replies
Apr 19, 2010
I built a simple application to load XML data using a external XML file. However, the link I am using will have a different Presentation ID each time a user creates a presentation. So some how the presentation ID needs to be know before I actually load the XML file at least in my mind it does. Is there a way to load the URL dynamically or set my url loader up so it loads whatever ID there is?
[Code]...
View 1 Replies
Jan 13, 2006
I have an external text file that will have two variables and look like this:&months=January,February,...&days=Sunday,Monday,.. .I am using loadVars to load the textfile in. When it is done loading, I want to load each of the of the 2 variables into an array so I have an array for months and array for days
View 7 Replies
Jun 7, 2006
Ok, lets see if i can explain this right. I have been trying to make a movie that loads different information from an external file each day. I name the external files according the the date that i want it to be imported (example: 200667, for today)Ive been able to make the .getYear(), .getMonth(), .getDate() work to make the date in the above formatxmlData.load(" ");<-- now when i write in the url to load the external file is there a way that i can write it so that it will update itself to the correct date so that i dont have to update it manually myself?
View 2 Replies
Mar 16, 2009
I have a pretty CMS that generates an XML and I want to make part of the site loading that data (menu items, thumbs, info, and big pics) is there an way to make all that using for?here is my XML code
Code:
<albums>
<gallery id="1" name="design" path="gallery/1/">
[code]......
View 1 Replies
Feb 7, 2011
I have a listBox and I want to take data from a php file and insert it in my list box. But I am doing something wrong, because it's not working.
The php file retrives data in the following format:
echo "nrsongs=" . $nr_songs;
$i=0;
foreach($song_ids as $song_id){
$i++;
[Code].....
View 2 Replies
Jun 21, 2011
I am trying to load dynamic data into text fields with in flash (.swf) the system is a closed circuit (no internet & web access) basically there are about 10 standalone computers connect through a network and one central computer i created a flash which will be downloaded to all the computers at once and each computer has a unique (name).My goal is to load the different data into the text field for each computer:Computer 1 would have winner 1 Computer 2 would have winner 2and so one........Steps the code should do..1. call function and load the "unique (name)."of the computer by going to("c:/myharddrive/local.ini"); flash will reconize the "ini file to say "this is computer 12. then have the txt request come from("c:/CMS/MediaFiles/Data2.txt");when i publish the file out there is no errors-When I view the files on each computer there is no data (blank screen")so my guess it is not seeing the path for newURLRequest("c:/myharddrive/local.ini");r new URLRequest("c:/CMS/MediaFiles/Data2.txt");can anyone breakdown the code and let me know how flash can go to those specific areas on each individual computer and pull the data into flash
View 1 Replies
Jun 26, 2009
[URL]when i test the site on my computer with flash it works. when i upload to the internet the xml data is not picked up. when i had the xml data in the same subdomain it worked both on my computer and in the internet...but i need the data to be accessible...
i have tried adding cross domain "policy files" for permission, but either they are not working, or i am doing it incorrectly...
View 2 Replies
Oct 26, 2009
i have been given two sources for a weather data feed:
[URL]
i would like to 'load' the text similar to loading xml i have seen several articles on reading variables from .txt but they all suggest the .txt file needs more formatting - whilst this one is just seperated by lines.
View 1 Replies
Aug 29, 2009
I am having a problem with loadMovie(); I have a button that loads external SWF into a container, but when another button is released loading a different SWF into same container, that SWF twitches and doesn't load properly.Is there a way to cancel an external SWF from loading during the load process? Or is there an easier way to prevent this using onLoadProgress(); with a while loop?And I am some what new to listeners and loadProgress(); programming
View 4 Replies
Jul 5, 2002
it took me so long to write this tutorial Well, here I go... Section 1: Introduction So you want dynamic content on your Flash movie. Sounds simple, right? Well let me tell it is, and well, it isn't. This tutorial assumes a basic knowledge of Actionscript, PHP and MySQL. If you have that, it's time to move on. Otherwise, I recommend you do some reading on the subjects... Section 2: Setting up your SWF to receive external data Loading external data into an SWF is a fairly simple task. Although the external text file method is probably the most widely known, it is by far the clumsiest way to get data into your SWF. Of course, this may be your only option of your server doesn't support MySQL/PHP! But for those of us who are fortunate to have these privileges, let me show you how Flash can get external data without having to create additional text files.
Dynamic text fields In order for Flash to get data from an external source, you need to make use of dynamic text fields. Simply place a blank dynamic text field on the stage and make sure you give it a variable name (NB: dynamic text fields have both an instance AND a variable names. In this case we want to focus on the variable name). Note the name you give to the field's variable name, as we'll need it when we write our PHP script. Once you have a text field setup, convert it to a movie clip symbol. Attach the following code to the resulting movie clip:
[Code]...
View 8 Replies
Aug 12, 2010
When retrieving external variables from the server URLVariables my Flash get stuck on first compilation values. Whenever I update server values flash compiles the first old values. Only after i restart CS4 IDE values are updated. Is there an internal cache?
There is nothing wrong with my code, because it works fine on my mac, but not on pc.
View 1 Replies
Jan 12, 2009
as i understood, external data loads with async mode. Please, suggest me good way to get sync mode
View 9 Replies
Dec 12, 2007
What is the best way to work large amounts of external data in Flash? XML, remoting,something else??I'm looking into a project that has a lot and I'm not sure what the best way to handle it would be
View 1 Replies
Nov 16, 2009
spot the error here that is giving me a TypeError: Error #2007: Parameter text must be non-null.The text field captions are in a file named captions.txt in the same root folder.
Code:
var myURLLoader:URLLoader = new URLLoader();
var myURLRequest:URLRequest = new URLRequest("captions_tuesday.txt");
[code].....
View 4 Replies
Aug 13, 2004
Possible to load an array from a external data source. I.e. like from a .txt file? I tried putting this in the external text file:
mytest = new Array("dadada")
It loaded, but not as a array, just as text. I am using LoadVars.
View 3 Replies
Jan 25, 2009
I'm trying to load data from an external text file into an array. I created an array and am able to load the data into an array if I explicitly say something like
ActionScript Code:
array[0] = event.target.data.uid1_name;
I can then do a trace statement on array[0] and it will output the correct name from the file. My problem is I'm trying to iterate through the variable names in the text file in the file by using an index variable. This is the code I'm using after doing all the URLloader, URLRequest, and so forth stuff:
ActionScript Code:
for(var i = 0; i<20;i++){
fArray
= event.target.data.uid_name;
}
This produces a syntax error. I've tried several other syntax variations but haven't been able to figure it out. I've also tried the following:
fArray
= event.target.data["uid"+i+"_name"];
fArray = event.target.data.["uid"+i+"_name"];
fArray
= event.target.data."uid"+i+"_name";
All three of those also give me errors. For the first one the trace statement outputs "undefinded" instead of "Doug". For the second I get "syntax error. Expecting identifier before left bracket". And for the third I get "syntax error, expecting identifer before uid.":
syntax to iterate the number after uid(uid1_name, uid2_name, uid3_name, etc)?
View 3 Replies
Jan 24, 2009
I'm trying to load data from an external text file into an array. I created an array and am able to load the data into an array if I explicitly say something like:
ActionScript Code:
array[0] = event.target.data.uid1_name;
I can then do a trace statement on array[0] and it will output the correct name from the file. My problem is I'm trying to iterate through the variable names in the text file in the file by using an index variable. This is the code I'm using after doing all the URLloader, URLRequest, and so forth stuff:
ActionScript Code:
for(var i = 0; i<20;i++){
fArray[i] = event.target.data.uid[i]_name;
}
This produces a syntax error. I've tried several other syntax variations but haven't been able to figure it out. Why syntax iterate the number after uid (uid1_name, uid2_name, uid3_name, etc)?
View 3 Replies
Oct 27, 2009
I have a flash movie that connects to xml, php etc and uses absolute path. The file works perfectly fine on any browser on my mac but doesn't work at all if I am using my windows (none of the browsers seem to be working)
This is the way I'm loading stuff:
editorXML.load"); [URL]
}
I don't know now, maybe I should use ' instead of " for this example.
View 3 Replies
Mar 14, 2011
I'm trying to read some data in from a sql source, some of which contains double quotes embedded in the text. I know I can strip the doublequotes, but don't want to go that route if I can avoid it. I've tried replacing to double quotes with hex codes before passing the text via parameter to my flash file, but the text string always cuts off at the hex code, the same as if the double quote were present in the string. For example:This is a "text" stringreplace double quotes with hex: This is a x22textx22 stringesults when read into flash: This is a <remainder is dropped>Yet if I type the same text string in a variable in flash, the string displays the double quotes properly:
View 1 Replies
Apr 9, 2007
I will be creating a program to use for data entry. I'll be studying zebras in kenya and I won't have the internet there as I'm recording the data. I'd like to be able to send the data I generate in flash to an external text file. I understand I need some sort of script to do that, but is this something I can run just on my machine? (I'll probably make the data into xml format).
View 1 Replies
Nov 9, 2006
I have this code inside my flash to name my navigation menu. Now I want to put this outside flash and load it via XML. How do save my different arrays into a variable for later use in my code?
In my nav fla (what i want to load from XML):
Code:
// MAIN MENU ARRAY
var mm_array:Array = ["MAIN1", "MAIN2", "MAIN3", "MAIN4"];
// SUB MENU ARRAY
[Code]...
View 9 Replies
Aug 10, 2008
Loading data from the test.php into the startLoading();
How do I load the data from test.php "echo $photo_out;" into the startLoading();
loadVariables("test.php", this, "POST");
infoField._visible = true;
startLoading(test.jpg);
[Code]....
View 16 Replies
Sep 24, 2006
I have read through Shared Objects but i couldn't get it work...
I just have to save my data, maybe array into .txt file and later on
retrieve from the same .txt file...
Anyone here have an example or some source code so i can have reference on it?
View 6 Replies