To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here


A Flash Developer Resource Site

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Reply
 
Thread Tools Search this Thread Display Modes
Old 09-16-2007, 04:06 PM   #1
halfasix
Registered User
 
Join Date: Sep 2007
Posts: 0
I need Actionscript Help with this! Anyone!!!

Hi evryone


Iv been banging my head against a brick wall for the last 3months ... i cant get any assistance anyware and its really driving me mad.... this is my problem... iv managed to put together a php script that reads the contents of the folder that the php file is in... so if theres 6files in a specific folder on your Apache server when you execute the php file in your web browser the output strings would be for e.g file3=getFiles.fla file4=getFiles.swf ....ect..! Right php working fine...ITS JUST FLASH thats being silly ..Right? heres my script!



var myLoadVars:LoadVars = new LoadVars();
myLoadVars.onLoad = function(success:Boolean) {
if (success) {
for (var i = 0; i<10; i++) {
var fileName = "file";
var fileNumber = i;
var files = fileName+fileNumber;
trace(files);
myTree.dataProvider = [myLoadVars.file3,myLoadVars.file5];
}
trace(myLoadVars.file3);
}
};
myLoadVars.load("http://localhost/listfiles.php");



If you wanna see the results for yourself just change localhost to moneyspiderr.com!!



You see the "myTree.dataProvider = [myLoadVars.file3,myLoadVars.file5];" section that puts the php output results in the Tree component... i just want to add the "i" value to the file3 value so i get somthing like this "file"+i = file1,file2,file3 ect....as you can see i have accomplised that with this



for (var i = 0; i<10; i++) {
var fileName = "file";
var fileNumber = i;
var files = fileName+fileNumber;
trace(files);



its just that when i now try to use that paticular string inside the [myLoadVars.file3,myLoadVars.file5];" statement like this [myLoadVars.files] the statement dont work!!! it returns a undefined value.....what would be the correct way to deal with this problem....please help...im going mad over here...lol if i can pull this off i would of created a flash tree menu that can read and display the content of your folder....if you aint got one of these then you can have a copy of my completed fla.......



I hope you can help me...Thanx

Jaden

www.moneyspiderr.com
halfasix is offline   Reply With Quote
Old 09-16-2007, 05:46 PM   #2
a_modified_dog
FK'n_dog
 
a_modified_dog's Avatar
 
Join Date: Apr 2003
Location: "aaarf"
Posts: 9,176
The data of a tree component must be provided from an XML data source,
and needs to be well formed ( which yours is not, [use List Variables] )
so you need to manipulate the string from your php file to correct it,
or manipulate it into well formed XML in Flash
this is a method to correct the string in Flash -
PHP Code:
var myLoadVars:LoadVars = new LoadVars();
myLoadVars.onLoad = function(success:Boolean) {
if (
success) {
str = unescape(this).toString();
str = str.split("<dataSet><data><name></name></data></dataSet>").join("");
arr = str.split("<br>");
arr.pop();
newStr = "";
for(var
i=0;i<arr.length;i++){
var
u = arr[i].split("=");
newStr +="<node label='"+u[1]+"'/>";
}
var
trDP_xml:XML = new XML("<node label='Local Files'>"+newStr+"</node>");
myTree.dataProvider = trDP_xml;
}
};
myLoadVars.load("http://moneyspiderr.com/listfiles.php");
i doubt it is exactly as you want it, but it should help you on your way
a_modified_dog is offline   Reply With Quote
Reply

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:15 PM.


internet.commerce
Be a Commerce Partner
 »  »  »  »  »  »  »
 »  »  »  »  »  »
 

    

Acceptable Use Policy


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.