Loading External Values From .txt
Hello all I been using flash AS2 for quite some time, and recently (due to a job assignment) started reading AS3, and it is so so differant and new and need help =(
I have 2 files, a flash file (test.fla) and a text file (web_size.txt) where i want to store variables using name-values pairs, which i want to convert to global variables. (which can be accessed via any other function anywhere, anytime, any frame)
web_size.txt content
Code: x_value=1000&y_value=300 and for the test.fla, i modified from a few tutorials and got the following.
Code: var x_value = 0 var y_value = 0
var myLoader:URLLoader = new URLLoader() myLoader.dataFormat = URLLoaderDataFormat.VARIABLES myLoader.load(new URLRequest("web_size.txt")) myLoader.addEventListener(Event.COMPLETE, onDataLoad)
myLoader.addEventListener(HTTPStatusEvent.HTTP_STATUS, onHTTPStatus)
function onDataLoad(evt:Event){ x_value = evt.target.data.x_value y_value = evt.target.data.y_value } The problems i faced is that the codes... 1) dun work at all, cant seem to figure why >.< 2) im storring each .evt.target.data."value" manually one by one, i need a more flexible way to just store all the name-values pairs from the .txt file automactically 3) even when i copied from tutorials directly, i could not turn the variable into a global variable (it could only run inside onDataLoad)
i need to solve all these problems, for i intend to use the variables to create a highly coustomisable flash website =(
FlashKit > Flash Help > Actionscript 3.0
Posted on: 12-15-2008, 03:18 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
[F8] Loading External Values Into Flash
Hi all, I am trying to make a photoalbum that uses an external file for passing a variable to Flash for the number of pics to set my array,
this is what I have for code
myData = new LoadVars();
myData.load("external.txt");
myData.onLoad = function (success) {
if (success) {
NOI = Number(NOI);
trace(this.NOI);
gotoAndStop(2);
} else {
trace("error loading");
}
}
then in frame 2 of actionscript I have this
stop();
var LocationToImages = "pics/";
var FileType = ".jpg";
var x = 0;this
var jpg = new Array();
var i = 0;
while (i <= NOI)
{
jpg[i] = LocationToImages + i + FileType;
i++;
} // end while
//load first JPG into container
loadMovie(this.jpg[0], this.container);
reason I broke it up into 2 frams is that it will give flash time to parse the code and to make sure its loaded before continuing
and this is what I have in my external text file
NOI=29
the problem I get is everytime I test this, I get message saying script is causing the flash player to run slowly do you wish to continue, Now I tested the actual myData loading and it traces out properly, it shows the number that is in the external text file, I am thinking the problem is Flash is not assigning that number to the jpg array?
my basic Idea for this is to create a photo album that the user will not have to edit and republish the FLA in order to add or subtract pictures and text files, all he would have to do is add the JPGs and txt files to the folder and then edit the external.txt file for number of pictures/text files that are in this folder, can anyone help me on this or point me to a tut that explaines this thanks D_wiz
Problem Loading External Swf's Via Combo Box Values
I'm trying to load some external swf's based upon a combo box selection and it's not working.
Here is what I have setup so far:
2 layers. 1 frame.
1st layer is for my main script:
function loadMovieClip () {
if (_root.color_combo.getValue() == Purple) {
_root.blank.loadMovie("earrings/earring_00001.swf", 1);
} else if (_root.color_combo.getValue() == Green) {
_root.blank.loadMovie("earrings/earring_00002.swf", 1);
}
}
2nd layer has two things:
1. blank movieclip with the instance name of "blank"
2. combo box with the following values: (Blue,Yellow,Green,Red,Purple) and instance name of "color_combo". Also the combo box has the following script:
on (release) {
_root.color_combo.setChangeHandler("loadMovieClip" );
}
This project is one directory up from the directory where the files I am trying to load are located. (../ProjectDirectory/earrings/..) So I think I have that setup right.
When I test the movie there are no errors but selecting either "Green" or "Purple" has no effect. Nothing happens. I am wondering why.....
Any help would be appreciated.
Thanks.
How To Give Links For Loading External File Values
Hai flash experts, I need help.
I developed flash movie that it'll load the external text file and display the values. I would like to give links for the values in text file or in flash file. If u have any idea and solution, kindly send to my email id post2sathish@hotmail.com.
Actually in my text file i wrote the variable is "title" and value is "click here to get live news"
&title=click here to get live news
I able to view this value in my flash file, but not able to give hyperlink for this.
I've uploaded the sample work files in my server, so if u want to work in that, pls download through
http://209.235.29.142/temp/sathish/test.zip and and send solution.
I hope u'll help me to get done this task.
Avidly waiting for ur reply
Thx
sathish
Values From External File
Is it possible to pass the values needed for "button_label[x]" from an external file? How could I accomplish this? Any guidance is appreciated. Thanks!
Code:
stop();
contents_group.contents._visible = false;
contents_group.setMask( content_area );
contents_spacing = 5;
fm_button._visible = false;
button_label = new Array();
button_label[0] = "Home";
button_label[1] = "Messages";
button_label[2] = "Directors";
button_label[3] = "Materials";
button_label[4] = "Requests";
// a number of buttons in button_label array must be equal
// to a number of frames inside "contents" movieclip
for( var i = 0; i < contents_group.contents._totalframes; i++ )
{
fm_button.duplicateMovieClip("fm_button" + i, i);
_root["fm_button" + i]._x = fm_button._x;
_root["fm_button" + i]._y = fm_button._y+ i*30;
_root["fm_button" + i].label_mc.label_txt = button_label[i];
_root["fm_button" + i].no = i;
contents_group.contents.duplicateMovieClip("contents"+i, i);
contents_group["contents"+i].gotoAndStop(i+1);
contents_group["contents"+i]._x = contents._x;
contents_group["contents"+i]._y = i * (contents_group.contents._height + contents_spacing);
contents_group["contents"+i].contents_no = i;
}
Values From External File
Is it possible to pass the values needed for "button_label[x]" from an external file ? How could I accomplish this ? Any guidance is appreciated . Thanks!
Code:
stop();
contents_group.contents._visible = false;
contents_group.setMask( content_area );
contents_spacing = 5;
fm_button._visible = false;
button_label = new Array();
button_label[0] = "Home";
button_label[1] = "Messages";
button_label[2] = "Directors";
button_label[3] = "Materials";
button_label[4] = "Requests";
for( var i = 0; i < contents_group.contents._totalframes; i++ )
{
fm_button.duplicateMovieClip("fm_button" + i, i);
_root["fm_button" + i]._x = fm_button._x;
_root["fm_button" + i]._y = fm_button._y+ i*30;
_root["fm_button" + i].label_mc.label_txt = button_label[i];
_root["fm_button" + i].no = i;
contents_group.contents.duplicateMovieClip("contents"+i, i);
contents_group["contents"+i].gotoAndStop(i+1);
contents_group["contents"+i]._x = contents._x;
contents_group["contents"+i]._y = i * (contents_group.contents._height + contents_spacing);
contents_group["contents"+i].contents_no = i;
}
Can't Control The _x _y Values With External Swf Using LoadMovieNum***
can't control the _x _y values with external swf using loadMovieNum***
ok i'm loading 2 swf files with loadMovieNum within there levels. when they show up i'm getting thrown off as to how to control there _x and _y values.
they are showing up at the top left registration point of the background.
i for some reason cannot figure this out.
please help me out.
jt
Arrays, Alpha Values And External Jpegs
I have just run up against an error that I just can't work out, and I think I becoming blind to the code, I've been looking at it so much...
I have a series of external jpegs that load up in a series of external movie clips. when they are all loaded the alpha value of the first one gradually climbs up to 100, then goes down while the alpha values of the number 2 climbs. The pics fade in and out. The whole thing was working a few days ago, now suddenly its not - can anybody spot the bug? Basically now, the first pic just won't appear. I've made it appear by setting alpha to 100, but i can't get it take part in the fading game. Here's the code that gets called from a movie clip called 'loader':
onClipEvent (load) {
trace("got to second frame");
//lets get it to change the pics after x time
//how long (in milliseconds?)
t = 60000;
//how fast does the fader recall?
f = 100;
//set k to 0 before we starting, boy.
k = 0;
//when all pics are loaded set alpha to 0;
if (k == 0) {
//on getting to this frame it sets alpha of all pics to 0
for (i=1; i<images; i++) {
setProperty(_level0["pic"+i], _alpha, 0);
}
}
//here's the function that fades de pictchas
function fader() {
if (a<100) {
setProperty("_level0.pic"+k, _alpha, a);
a = a+2;
if (k != 0) {
setProperty("_level0.pic"+(k-1), _alpha, z);
z = z-2;
trace("alpha outgoing"+z);
} else {
z = 0;
}
trace("alpha incoming"+a);
trace("_level0.pic"+k);
_root.loadbox = "image "+(k+1)+" visibility: "+a+"%";
if (a>=99) {
//stop the fader
clearInterval(fader_it);
//increase k
k++;
}
}
}
//here's the function I'll call with setInterval
function telltime() {
//knock alpha values down and up a bit so it don't take so long
a = 20;
z = 80;
setProperty("_level0.pic"+k, _alpha, a);
setProperty("_level0.pic"+(k-1), _alpha, z);
//start the fader
fade_it = setInterval(fader, f);
trace("value of k is: "+k);
}
//get the first instance of telltime running, the others will be
//kicked off by setInterval
//telltime();
if (k>=images) {
k = 0;
}
changer = setInterval(telltime, t);
}
I'm stumped!!
External Data And Pics And Values Into Flash
I am mainly a designer and not too much of a backend guy. I have encountered some problems with something I am trying to build. Here is what I am trying to do:
I am trying to create an application built in flash that allows users to customize a pc and then submit that info to an email as a quote. Here's the thing, I know EXACTLY how I want it to work, I am just stuck on some points.
on the left side should be a blank area that is to load the images called from external folders. on the right would be checkboxes that allow get their info from external text or ophp files (whatever is easiest). When I check "monitor" for example, it has an assignedprice, a picture of a monitor pops up in the left and a subsection opens to select the specific type of monitor (example black, red, flat, old, new, whatever). These sub selections also need to call a specific image that has a cash value tied to it (so I select black monitor, and the monitor pic changes to the black one, and the price adjusts to add the extra from the black to the base of the monitor cost)
wow, thats alot of typing. here's some more:
that explains how each component should work, I need the app to have "monitor", "keyboard + mouse", "speakers", and "tower" and for each to have the same attributes as I discussed above. The images should appear in a manner like an actual desktop setup would (speakers to the left, monitor middle, keyboard mouse below and tower right). All the elements need to add together to get a total cost and then have a submit button to send an order description with all that info to my email addy. All the checkbox/sub menu items need to have the name/title as well as the value and pic load from external folders.
I have no clue how to create the checkboxes in this manner, and that is my main problem. can anyone direct me in how to do that?
Multiple Variable Values In External Txt File?
Hello
i am calling an external text file for a dynamic text field, i was wondering if i can use more than one text contents for different variables in the same text file.
For example the txt file contents may now lool like "x=this is the x variable text value" can i have in the same text file other variable vaues such as 'y=this is the y variable text for the dynamic text field retrieving its contents from the y variable value" ,"z=blah blah" etc?
Thanks
Xml - Loading Default Values
I have an XML script which loads the default values based from when a button is clicked. The button is dynamically generated from the XML script.
I want to remove the button completely. And I want the first Section by default without the need to click a button.
http://www.ultimadg.com/clients/ppag/testimonials.html
Please send me an email and I will Send All files needed to help me through this one .
Loading Values Into Movie
hi everyone.
i play an online game called runescape. and as part of this game there are highscore listings.
i want to know if i can get the values off the highscores list and put them into my movie.
i have seen this done in php like can be seen in this link:
http://www.rsbandb.com/sig/sig.php?n...ampinoman&.jpg
i was just wondering if there is anyway to do this in flash because i do not know any php scripting.
thanx in advance, champinoman
Reading Values Set When Loading Swf
Hi all, I've got a unique situation on my hands.
I have some server side code that takes a url visited and returns a swf file. This swf file needs to know the address that it is being loaded from so that it can take certain actions.
So if I have:
- example.com/ex1/movie.swf
- example.com/ex2/movie.swf
I need the video to be able to know if it is being loaded from ex1 or ex2.
Is this possible without JavaScript being present in the code loading the swf file? If not what alternatives would be available to me?
Thank you.
**As a note I am working in Flex 3 so all related libraries are available.
Loading XML Values In A Loop
Hi friends,
This is my XML. I want to read the values in a loop.
<?xml version="1.0" encoding="utf-8"?>
<Resources resname="IMAGE" language="English" code="eng">
<page pagename = "IMAGE">
<Resource tag="LOGO">images/logo.jpg</Resource>
</page>
<page pagename = "IMAGE">
<Resource tag="CONTACT">
<active tag="active">images/contact.jpg</active>
<inactive tag="inactive">images/contact1.jpg</inactive>
<over>images/contact2.jpg</over>
</Resource>
</page>
</Resources>
I had written a for loop to retirve the value. i got - images/logo.jpg, but now I need one more inner loop to get tge values - images/contact.jpg, images/contact1.jpg, images/contact2.jpg
help me....
this is my for loop
function loadImage(ab) {
var nidearr1 = importXML1.firstChild;
var nidearr = nidearr1.childNodes;
for (var i = 0; i < nidearr.length; i++) {
//trace(nidearr[i].attributes.pagename);
for (var j = 0; j < nidearr[i].childNodes.length; j++) {
//trace(nidearr[i].childNodes[j].attributes.tag);
varres=nidearr[i].childNodes[j].attributes.tag;
if (res==ab){
return nidearr[i].childNodes[j].firstChild;
}
}
}
}
This is the function call
trace(loadImage(tag));
The value of the tag is taking from the XML file.
Loading XML Only Returning Some Values
Hi Folks,
I am new to XML and am a bit rusty in my Flash skills so forgive me for my stupidity but any answers should please take this level of ignorance into account.
I have a 1 frame file with three movie clips on it. Each clip is the same as the others but is differentiated by the instance names: mc1, mc2, mc3.
The movie clips each have three dynamic text fields: title, body and link.
The problem is only the text fields in the mc1 movie clip get populated the others return as undefined.
Little Help?
I have included xml and code below.
thanks
Al
----------------------------XML (myxml2.xml)---------------------------
<?xml version="1.0"?>
<content>
<item>
<title>First Website</title>
<body>First Website text</body>
<link>http://www.firstwebsite.com</text>
</item>
<item>
<title>Second Website</title>
<body>Second Website text</body>
<link>http://www.secondwebsite.com</text>
</item>
<item>
<title>Third Website</title>
<body>Third Website text</body>
<link>http://www.thirdwebsite.com</text>
</item>
</content>
-----------------------Action Script---------------------------------
var xmlPath = "myxml2.xml";
function loadXML(loaded) {
if (loaded) {
mc1.title = this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;
mc1.body = this.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;
mc1.link = this.firstChild.childNodes[0].childNodes[2].firstChild.nodeValue;
mc2.title = this.firstChild.childNodes[1].childNodes[0].firstChild.nodeValue;
mc2.body = this.firstChild.childNodes[1].childNodes[1].firstChild.nodeValue;
mc2.link = this.firstChild.childNodes[1].childNodes[2].firstChild.nodeValue;
mc3.title = this.firstChild.childNodes[2].childNodes[0].firstChild.nodeValue;
mc3.body = this.firstChild.childNodes[2].childNodes[1].firstChild.nodeValue;
mc3.link = this.firstChild.childNodes[2].childNodes[2].firstChild.nodeValue;
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load(xmlPath);
Streaming Multiple External Variable Values To Single MC?
Hi,
I have an image of a box that I'm trying to make respond to _rotation values that are on an external text file. I got the code working such that when the button is clicked the box rotates to the first value. For example
[quote]Text File: text=180&
Effect: The box rotates 180 degrees[quote]
Now, I'm stuck. How do I get it to take a column of values and run through them? Do I need to load the column of values into an array and then loop through them? Or is there an easier way? I feel like I'm banging my head against a brick wall here, any help y'all can give me would be really appreciated!
Thanks,
Dave
Combo Box Component--loading In The Values?
I have several Combo Boxes to make for a search engine and a registration form, and each has a lot, in 2 cases 96, possibilities, and the possibilities are going to be constantly changing.
Can I load the values in to an MX Combo Box Component from say a text file or some other back-end service?
Worst case scenario, I've already entered the initial values into my Access database, so is there a way I can copy and paste that info somehow into the Combo Box? Can't seem to for trying...
They're all single values, like building addresses, and type of business, i.e., single, simple fields...just lotsa 'dem
A very simple tutorial on this might help me out a lot...
Thanks as always.
Shawn
Loading A Movie Clip Using X And Y Values
i'm tryiing to load a movieclip into my main movie using the following code:
_root.createEmptyMovieClip(myclip, 1);
myclip._x = .8;
myclip._y = 55.5;
loadMovie("impaxmenusbuttons.swf", "myclip");
i was told by one of my instructors to make myclip a string, so i tried that and it still does not work i.e. the movie clip does not show up at all. if i use loadMovieNum, the movie clip is there, but i'm not able to position it in the proper place.
what am i missing?
thanks.
Loading Values From A Control Panel
Hi,
I'm trying to modify a piece of code that is posted in the tutorial section by Alex Dodge (vectors to speed)
I want to be able to input a direction and speed value from a control panel and then when the "enter" button is click, the object moves in the given direction and speed.
I got a bit of help from Nunomira (thanks it was a big help), however I'm not fully there yet. I've attached a part working example if anyone can help.
Cheers,
Loading PHP Database Values Into Flash
I wish to load values from my PHP database into my Flash swf.
My PHP looks something like this;
$result = mysql_query("SELECT joke FROM Jokes where jokeID='0'");
$cant = 0;
while($row=mysql_fetch_array($result)){
echo "jokeID$cant=$row[JokeID]&joke$cant=$row[joke]&";
$cant++;
}
print "cant=$cant";
This returns the joke number and the joke.
My actionscript is the part I think is letting me down;
myLoad = new LoadVars();
myLoad.onLoad = function(done){
for(var i in this) {
joke.text += "
"+i+" = "+this[i];
}
}
myLoad.load("index.php");
I have a textfield called joke that is dynamic.
Can anyone help me to get this to work?
Problem With Array Size- Loading Values From ASP
I am currently working on an image viewer application for my company's intranet site. I'm dynamically loading jpegs after using ASP and VB script to get the filenames in a specific sub-folder. Using a URLencoded output, I then use the .split function on the variable that is returned to create an array with all the filenames. Then, I load each image interactively from the directory where it resides. My problem is, if I have more than 100 images in a directory, I can load that string from the ASP script and parse it, then view the images in the folder. However, if I change to a different directory for the script to run on, it won't call the GetVariables() function. I have put the GetVariables in a function in a movie clip that I call with a button press. in that function, I increment a variable just to make sure that the function is being called correctly, and display it in a dynamic text box. This is working- however, the GetVariables() call doesn't seem to work. This isn't a problem if they're are less than 101 images in a directory. I've read many posts, and it doesn't seem that an array has a "limit" to it's size. Perhaps there is something going on with Internet Explorer caching information here? I'm really fed up with this!!
Any ideas, please fire away..
Virgil Rockford
Storing And Loading Values With Flash Executable
Dear all,
I have written a flash application to do calculations on a evaporator.
http://home.hccnet.nl/m.dijk/pressur...lcs/calcs.html
Now the user is asking to store his calculations and reload them whenever the stand-alone *.EXE is started again. How can I do this?
Please tell me you advice, many thanks,
Carfi
Loading In A Array Of Values From A Text File
OK, I think I know how to load values using the loadVar command...but how do I go about loading an array of values from a text file? For example, the text file will be this format:
name = file1 size = 10 descrip = roses
name = file2 size = 12 descrip = tulips
name = file3 size = 13 descrip = daisies
And so I want three arrays, name[], size[], descrip[] to hold all these values...how do I set that up? And the code to do the loading from the textfile would be nice, newbie that I am .
Loading Vars From A File And Assign Values To Mcs
Hallo pals,
I have to load some variables from a php script, which sound like this:
Code:
box1.year=03;
box1.day=1;
box1.month=2;
box2.year=03;
box2.day=1;
box2.month=2;
where boxn is the instance name of each movieclip.
In brief, I should give properties to each movieclip I will duplicate with a command included in the loaded text file (how many MC's etc).
Due to my rather dumbness in scripting, I'm wondering whether it is possible to make a thing like that. Which shape should the text have? How do I assign such values to the MC's? ......
TIA!
s-
[MX04] How To Assign Values For Position Of An External Movie And Playing W/ Commands
i am loading a movie outside of my main movie by this command:
on (release) {
loadMovie("Core.swf",3);
}
but i would like to choose where this new swf file will sit on the main movie. can anyone help me w/ this?
and two other questions while i'm at it...
are the variables in flash global or only local with regards to the 2nd movie. basically, can the 2nd movie's variables be called in the first movie...and vice versa.
if it is global, can the 2nd movie asign variables in the 1st movie? basically, i want to dynamically change this image in the 1st movie but the second movie opens up asks the user to put in the image location from another site and hit okay. i followed this website for guidance: http://www.flashmagazine.com/654.htm
thanx a LOT guys
Loading/attaching Movies Based On Variable Values
I'm looping through elements of an array in order to dynamically load various thumbnails, one by one, onto the stage. The array is populated when the main flash movie queries a server side program with a parameter named 'category' (the value of which is the category name corresponding to a given list of thumbnails) and recieves in return a list of thumbnail filenames which must be loaded into the movie.
I use the same concept to build a navigation menu, except that instead of using the loadMovie() function, I use the attachMovie() function to load menu buttons from the flash movie library (the button text for each menu item is then dynamically set based on data retrieved from the server).
My dilema is that I can dynamically generate this menu without problems, but creating the dynamic table of thumbnails isn't working so good. Have a look at this code:
Now while this method works like a champ...
Code:
// function to dynamically add a movie clip to the stage from the movie library
function add_a_movie (libelement,clipvarname) {
// keep track of the movie clip level heirarchy
_global.DEEPEST_SBLV++;
// attach library element to the movie
_level0.attachMovie(libelement,clipvarname,_global.DEEPEST_SBLV);
// get a reference to the new movie clip
var clippath = eval('_level0.' + clipvarname);
// return a reference to the new thumbnail movie object
return clippath
}
...This method does not work at all
Code:
// function to dynamically load a movie clip from an external source
function load_a_movie (url,clipvarname) {
// keep track of the movie clip level heirarchy
_global.DEEPEST_SBLV++;
// create an empty movie clip into which the loaded image can reside
_level0.createEmptyMovieClip(clipvarname,_global.DEEPEST_SBLV);
// load image into the movie
var clippath = eval('_level0.' + clipvarname);
clippath.loadMovie(url, '_level0.' + clipvarname);
// return a reference to the new thumbnail movie object
return clippath
}
What am I doing wrong?
Dynamically Saving/loading Movie Clip Values
Hi folks
I could use some advice, I've been using Flash for ages but haven't a clue about backend scripting.
I've got a flash app where you can add movieclips to the stage and drag them around etc...
http://www.staff.ljmu.ac.uk/mkgngran/index.html
...what I'd like is for the user to dynamically save the _x, _y and _rotation values so they can be viewed by other people.
What would be the best way to do this - write to an XML file or to a MySQL database? I've looked at some tutorials but its beyond my capabilities to be honest. Any pointers would be appreciated.
Assigning User Info To A Swf/jpeg And Then Loading Based On Values
Hello there,
I work for a visual arts company in Derby UK and I am looking into creating an interactive installation. This is all just coming together in my head today and was wondering if anyone can give me a few pointers to get started.
I want to create a flash application that will:
a. Capture a user photo from webcam or from uploading an image (i think i've got this bit covered).
b. The user will then answer questions or input data. Name, age, sex etc.
c. The image and values will then be stored together in an external swf?
A second application will then load images based on selected value eg. people called Tom and display all the jpgs/swfs that match the criteria. The images will be placed randomly or in rows/columns.
I am sure this is possible with flash and may already be a similar application already out there. But if anyone can give me a point in the right direction then I would appreciate it and I can research deeper.
Alternatively if anyone is interested in developing this with me, it needs to be done by mid September, please let me know.
thanks
darius
Generating Random Values For A Variable While Excluding The Already Generated Values
Hey Flashers:
Here's my question this time around. I want to generate random values between 1and 50 for a variable but I want every time I generate the new value to exclude the already generated values from the pool of options. Something like playing the lottery where no two drawn numbers can be the same. Any hints or references to open code will be greatly appreciated.
As always, thanks a lot!
Function Populated By Node Values Returning Undefined Values
I have been working on some code which extracts the information from an xml document, styles it with css and then loads the various node values into a text field and arrays. The user click on a link in the text field which calls myFunction using asfunction and that in turn should enter the array values relating to that link into text fields.
Everything in general seems to work OK except the value that is returned to the two text fields on pressing the link in the CCTextField "which in turn calls myFunction" returns undefined for those values of the arrays. I check the agency[2] value in the function that populates the arrays and the value is returned as it shoiuld be so it appears there must be something amiss with myFunction, or at least it would seem so.
Any takers as to what this problem might be?
I have supplied some shortened code below.
PHP Code:
CCTextField.styleSheet = myStyle;
// NOTE: CCTextField styleSheet has been created beforehand
my_xml = new XML();
// NOTE: my_xml has been created beforehand
my_xml.onLoad = function(sucess) {
if (sucess) {
processXML(my_xml);
}
};
// Load up the XML file into Flash
my_xml.load('TEST.xml');
// This is the function that will be called when
// the XML document is loaded succesfully
function processXML(xmlDoc_xml) {
var listText_comm = ""; // List text variable
var entryNum = 0; // Entry number variable
var agency = new Array(); // Agency array
var production = new Array(); // Production array
for (var n = 0; n<xmlDoc_xml.firstChild.firstChild.childNodes.length; n++) {
categoryNodeName = xmlDoc_xml.firstChild.firstChild.childNodes[n].nodeName;
if (categoryNodeName == "client") {
listText_comm += "<a href='asfunction:_root.myFunction," + entryNum + "'>" + xmlDoc_xml.firstChild.firstChild.childNodes[n];
trace("client " + xmlDoc_xml.firstChild.firstChild.childNodes[n]);
} else {
if (categoryNodeName == "title") {
listText_comm += " - " + xmlDoc_xml.firstChild.firstChild.childNodes[n] + "</a>";
trace("title " +xmlDoc_xml.firstChild.firstChild.childNodes[n]);
} else {
if (categoryNodeName == "agency") {
agency[entryNum] = xmlDoc_xml.firstChild.firstChild.childNodes[n].firstChild.nodeValue;
trace("agency " +xmlDoc_xml.firstChild.firstChild.childNodes[n].firstChild.nodeValue);
} else {
if (categoryNodeName == "production") {
agency[entryNum] = xmlDoc_xml.firstChild.firstChild.childNodes[n].firstChild.nodeValue;
trace("production " +xmlDoc_xml.firstChild.firstChild.childNodes[n].firstChild.nodeValue);
entryNum++; // click over the entry number by 1
}
}
}
}
}
trace("AGENCY 2 = " + agency[2]); // this returns agency number 2 OK
_root.CCTextField.text = listText_comm; // CCTextField shows this text OK
}
function myFunction(listItem) {
clientF = agency[listItem]; // THIS RETURNS undefined ON PRESSING THE LINKS IN CCTextField
productionF = production[listItem]; // THIS ALSO RETURNS undefined ON PRESSING THE LINKS IN CCTextField
trace(listItem); // this trace = the list item passed by asfunction OK
}
[MX] Weirdness With Values Used By Array Populated Clip Values.
Hi,
I have used invisible buttons on top of some text, as part of a volume control interface.
The text buttons are set out as 0 – 25 – 50- 75 -100 referring to the % that a music tracks volume will change to once a button is pressed – so far so good.
Now to give values to the text buttons in order for them to make the text clip that they are on top of go to & stop & the right frame I have used arrays to give a reference the location of the text clip:
numbs_array = [_root.volHold_mc.vol0, _root.volHold_mc.vol25, _root.volHold_mc.vol50, _root.volHold_mc.vol75, _root.volHold_mc.vol100];
I then reference that in a home made “release” function as “this.monica.gotoAndStop(2);” “monica” being the reference to the address of the clip.
It all works fine except the code seems to make the movie play clips in an order that they have not been designated in the array – Like a button on top of the “25”% value will play the animation for the “75”% clip?
The whole problem is probably much better seen through the movie – the problem section of which i have attached below.
Passing Values From ASP To Change Alpha Values Etc
Is this possible? I currently have a log in system, logging each page a user visits, these visits amount to a value and have this value passed to flash to control alpha values, tints etc to reflect look and feel. is this possible?
Load "num" Values Through External Text File?
I've got some MCs duplicated with a variable ("num") providing the number to be duped in the loop (ie. i=0;i<num;i++).
Can the value of "num" be pulled in via a text file, either through LoadVars or loadVariables? It's a FAQ flash with someone adding to the text file which contains the questions loaded into flash. When he adds a question I have to change the value of "num" manually. Isn't there an easier way to do this?
I've tried but can't find an answer....
Database Values To Array Values
Hi all,
I've created a movie which uses a number of arrays to construct the elements of a flash-based gallery.
What I need is a practical method of getting values from a database into an array via an ASP page.
The plan was to load the variables into these arrays using the an asp page and a loadvars object to create a string (basically the array values in quotes separated by commas) which was then to be inserted into the parameters for the creation of the array. Needless to say this hasn't worked- the create array object seems to interpret the whole string as the first value in the array, i can't find a way of populating the array from just a single asp page.
I've given up with this method and really need a few pointers.
Thanks
Loading External SWF From External SWF Onto An Empty MC On Main Timeline?
Hi Everyone,
Please bear with me while I explain. I have an external swf that loads into a frame in the main timeline, into an empty MC. I can do this just fine. Once this clip is loaded, I have a button in this clip that loads another external swf into a different empty MC on the main timeline. I'm using loadMovie, and I need to load these movies into specific empty MCs. In other words,
I have the following:
MainStage: frame 5, contains empty MC "ClipA"; frame 6, contains empty MC "ClipB"
External swf: "Movie1"
External swf: "Movie2"
"Movie1" goes into "ClipA" of frame 5 on Main Timeline; and "Movie1" has a button that loads "Movie2" into "ClipB" of frame 6 on Main Timeline. I need help loading "Clip B" into "Movie2" from a button in "ClipA."
I'm sorry my message is so roundabout - it's not really a complicated situation, but explaining it makes it seem so.
Thank you in advance for any help - I'm assuming it's some sort of _root or _parent issue things I'm not quite understanding.
Thanks!
macgirl
Combining External SWF Loading With Dynamically Loading Text Tutorial
I am trying to combine the external SWF loading tutorial with the dynamic text loading (via XML and CSS) tutorial.
Everything loads fine, except the stylesheet is not applied to the text. It must have something to do with the swf being externally loaded, correct?
Any ideas how to fix this?
Here is the code for Frame 1 of the externally loaded swf.
Code:
//init TextArea component
myText.html = true;
myText.wordWrap = true;
myText.multiline = true;
myText.label.condenseWhite=true;
//load css
kungFuStyle = new TextField.StyleSheet();
kungFuStyle.load("example.css");
myText.styleSheet = kungFuStyle;
//load in XML
kungFuContent = new XML();
kungFuContent.ignoreWhite = true;
kungFuContent.load("example.xml");
kungFuContent.onLoad = function(success)
{
if(success)
{
myText.text = kungFuContent;
}
}
midframe=10
All the files are in the same dir.
Loading A Frame In _root And Also Loading An External Movie Problems.
First of all, hello everyone and nice to meet you
I have been hacking at a problem for a couple of days now and I am in need of help to solve it. Please excuse my noobishness, but I have a lot to learn when it comes to flash.
Here is my scenario:
I have my main movie (_root)
In the actions layer of my main movie I have:
Code:
this._lockroot = true;
I have a button that loads a new external movie at the end of which I want to load a particular frame in the main movie. I call this from the external movie:
Code:
on (release) {
_root.gotoAndPlay(610);
}
Everything up to here works brilliantly....But my problem arises when I also try to load an external movie onto level 5 at the same time as I am instructing the main movie to play frame 610 from an external movie. I want the external movie to call frame 610 in main, and also load a new external movie on level 5 in the main movie. I have tried about every way of loading movies that I can think of but I can never get the external movie to load along with frame 610 of the main movie. I even tried _root.loadMovieNum("myexternalmovie",5) right after my first root call, like this:
Code:
on (release) {
_root.gotoAndPlay(610);
_root.loadMovieNum("myexternalmovie",5)
}
Is that possible or do I have to approach this entirely differently? Thanks for any responses
Help Problems Loading External Text And Loading The Movie Into The Explorer
Hola a todos!
I have some troubles with my movies. I'll explain.
(Sorry for my poor English - I'm Spanish!)
I'm developing a website for a Real State Agency in Spain. My idea is make it enterely with Flash, but It's the first time I face Flash. I've found in the tutorials of kirupa.com the greatest help! But, still that, I need more help!
My first problem comes when loading the .swf into the explorer. I made a simple .html file that calls the .swf file to be loaded. The explorer says it's loaded, but I have to press the "Reload" button to see the movie. Can you say me why?!!!!
My second problem... well. I'll need a few minuts to explain it!
I have created a main scene. Inside the main scene I load the movies of the different sections of the site. This new movies loaded onto the main movie contain texts from external .txt files. There's no problem with the texts that are just a few words, as in the section "Acerca de". But when I need a bar to show the whole text I find that the bar doesn't work in the first time that the movie is loaded, and you have to click again in the section to access the whole text, I mean, to make the bar work. Have I explain myself?
Well. I think you should visit the site to see my problems.
Is this: http://www.wk-inmobiliaria.com/FLASH
This website is, of course, incomplete. I'm still working on it.
Could someone help me????
---- Help me Obi Wan: You're my only hope!!!!
Thanks a Lot.
Raul.
Combining External SWF Loading With Dynamically Loading Text Tutorial
I am trying to combine the external SWF loading tutorial with the dynamic text loading (via XML and CSS) tutorial.
Everything loads fine, except the stylesheet is not applied to the text. It must have something to do with the swf being externally loaded, correct?
Any ideas how to fix this?
Here is the code for Frame 1 of the externally loaded swf.
Code:
//init TextArea component
myText.html = true;
myText.wordWrap = true;
myText.multiline = true;
myText.label.condenseWhite=true;
//load css
kungFuStyle = new TextField.StyleSheet();
kungFuStyle.load("example.css");
myText.styleSheet = kungFuStyle;
//load in XML
kungFuContent = new XML();
kungFuContent.ignoreWhite = true;
kungFuContent.load("example.xml");
kungFuContent.onLoad = function(success)
{
if(success)
{
myText.text = kungFuContent;
}
}
midframe=10
All the files are in the same dir.
Access To "external" Values
Hello,
1. Can I access the height and width of the window from inside a script? I.e., adapt the script to changing screen sizes?
2. Can I access the frame rate from inside a script?
3. Can anyone point me to a text about displaying text that is in a file from inside a script?
Thanks!
Problem With External MCs, Loading An External Into An External
What I have is 2 seperate files, Main file is the actual website flash, second file is the external movie clip that loads 3 other external movie clips. The site will see the external clip but nothing will appear on the site, blank movie clip only.
On the main site there is this code to load the external clip into the site:
ActionScript Code:
loadMovie("toonsext.swf", _root.toons_mc)
On the external clip these are the codes for loading the 3 characters onto it:
ActionScript Code:
loadMovie("joshtoon.swf", joshblank_mc)loadMovie("toonmatt.swf", mattblank_mc)loadMovie("metoon.swf", meblank_mc)
Seperately the external clip will work and show the characters however on the main site it will not show anything. What could be the problem can flash not load 2 seperate entities like this or is there a code wrong on my behalf?
Problem With Loading New External Mc Before Existing One Has Finished Loading
Hi all,
I've been building a flash website which loads various external movieclips with preloaders into a main movie using either target or level. All is working fine, except when a user clicks on a button to load an external movieclip (the button actually goes to a frame label and then said frame contains the loadmovie action), but then decides to click on another button which loads another movieclip before the original has finished loading. This basically breaks flash, causing the movieclips to start looping erratically (even though I have stop actions in place).
Obviously this problem doesn't occur when I test locally, but please follow this link to see what I mean. Click on the 'locations' or 'recent shoots' sections and then try to load a new movie before an existing one has completely loaded:
http://www.david-vernon.co.uk/365_2/365.html
Now I've experimented with adding 'unloadmovie' to buttons and frames to no avail (though as I'm loading new movies into the same target this shouldn't be the problem surely?), so my only thought is that the preloader actionscript might be causing a problem. Here's the actionscript I'm using on frame 1 of all my external movies:
Code:
stop();
myInterval = setInterval(preloader, 10);
function preloader() {
if (getBytesLoaded() >=getBytesTotal()) {
play();
clearInterval(myInterval);
}
bar._xscale = (getBytesLoaded()/getBytesTotal())*100;
percent.text = Math.round(getBytesLoaded()/getBytesTotal()*100)+"%";
}
I'm not very good with actionscript and I'm really stumped with this, so any help would be greatly appreciated!
Thanks,
Dave
External Swf Loading Into Target Movieclip Loading Problem
Hi Everyone,
Can someone please help me...
I’m trying to load a SWF movie into a target movieclip called ‘blankmc’.
The SWF movie is loaded from an absolute URL (eg. http://www.somedomain.net/img/20042005113934movie3.swf )
My Loading Progress code fails to detect the SWF file size. However the same code works perfectly for a JPG!
Essentially the .getBytesLoaded() and .getBytesTotal fail to work. Why is this and how can I get it to work for loading SWFs?
//EXAMPLE CODE:
loadMovie( URL ,"blankmc");
blankmc.getBytesLoaded() ;
blankmc.getBytesTotal() ;
//This works with JPGs but not SWFs
Thanks in advance!
J
ps. i am using Flash MX
Loading External Images Loading Bar (Movie Clip)
I have managed to have external images loaded with the progress bar. However, when I place these items into a movie clip the preloader no longer works. can someone please take a look at the flash file for me.
http://www.bloggot.co.uk/file.zip
External Swf Loading Into Target Movieclip Loading Problem
Hi Everyone,
Can someone please help me...
I’m trying to load a SWF movie into a target movieclip called ‘blankmc’.
The SWF movie is loaded from an absolute URL (eg. http://www.somedomain.net/img/20042005113934movie3.swf )
My Loading Progress code fails to detect the SWF file size. However the same code works perfectly for a JPG!
Essentially the .getBytesLoaded() and .getBytesTotal fail to work. Why is this and how can I get it to work for loading SWFs?
//EXAMPLE CODE:
loadMovie( URL ,"blankmc");
blankmc.getBytesLoaded() ;
blankmc.getBytesTotal() ;
//This works with JPGs but not SWFs
Thanks in advance!
J
ps. i am using Flash MX
Loading Main Timeline Diff. From Loading External Swf's?
Last edited by enkriptid : 2008-06-30 at 04:16.
hey peoples, im still learning how to load things , my methods are working so far..
what ive been doing to load external swfs is using a intermediate "loading swf" that works between the main timeline and the desired swf to be loaded.. so far it works and is simple enough for me to work with now, but my question is, how do i go about preloading the main timeline if there are mc's being exported .. i tried my previously mentioned method but no dice.. if theres a rock-solid technical answer id like that..my goal is to have most of my site(illsci.com) in actionscript .as files, doc. classes and xml as of now so im looking for a method i can implement using script if i can, if there is one. perhaps a metatag trick of some sort
|