Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Using LoadVars() To Load Pictuers



Hi
I know that u can use LoadVars() to load anything, so I've used it to load a bunch of pictures and it went well.
Now I want to use this pix, let's say to attach them to a MCs' or a text field, can anyone show me how??



Ultrashock Forums > Flash > ActionScript
Posted on: 2004-01-28


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Random 3 Pictuers In Flash 5
I have made 3 frames, with 2 layers

---------------
In the first Layer i put an action for every frame like this:

gotoAndStop (random(4));
--------------
In the second layer i have a pictuer in every frame.

-----------
The action work and it random the pictuers, but the problem is when it random it repeat the first pictuer in the firs frame for 7-10 times !!!!! then it goes to the next frame.



I want the pictuers to be random every time i refresh the site .
-------------------------PLZ HEEEEEEEEEEEEEEELP----------------
::T H A N X ::
-------------------
STILL WAITING

When Do LoadVars Load?$@%$%^
I have 2 combo boxes, the 1st is populated static, the second is populated dynamicly, here is my problem, when I select something in the 1st combobox, it does a loadVariable according to the choise of the selection in box 1, it then populates the second combobox. The problem is, I have to select it twice before the loaded variables show up in the 2nd box. My code works, to the point of selecting it twice. Any ideas, am I not loading it soon enough? I dont want to load all the variables at the begining, I want to wait until the selection is made in the 1st box?
Thanks in advance.
Jeff

Loadvars.load
I'm loading in some variables and using the .onload function, as such..

receiveVars2.onLoad = function(success) {
if (success) {
trace(receiveVars2.length);}
}

but for some strange reason, the output of the trace is 0, how can I get the size of receiveVars2?

thanks
boombanguk

Loadvars.load
hi again to everybody!!

now I have some problems when loading a txt file. I have a textare component named text_txt.

The code:

var carrega:LoadVars = new LoadVars();
carrega.onLoad = function(vabe)
{
if (vabe)
{
text_txt.text = unescape(carrega.toString());
}
else
{
text_txt.text = "Error carregant les noticies";
}
};
carrega.load("Noticies.txt");

stop();

And the problem:
When the text from the text file (noticies.txt) is loaded, in my text_txt appears a last line that is not in the noticies.txt. This is what it says:

=&onLoad=[type Function]

what the fu** is this???

Thanks to everybody!!!!

LoadVars.load Help
hi its me again i am now making progress in my chat program and still facing many problems:

here is my actionscript code:
on (release, keyPress "<Enter>")
{

var chat = new LoadVars()
chat.message = _root.mes.text
chat.onLoad = function(s)
{if(s)
{
_root.output.text = chat.output
_root.output.scroll = _root.output.maxscroll
trace(chat.output)
}else trace("Data Cannot be loaded")

}
chat.load("http://localhost/monchat/chat.php?"+chat.toString());
}


and here is my php code:


<?php
include "tools.php";
if (isset($message))
{
$message = trim($message);
$message = cleanup_text($message);
$mes = $message;
//erase the current file
unlink(chat.txt);
//open the file for next msg
$filepointer = fopen("chat.txt","w");
fputs($filepointer,"$mes");
fclose($filepointer);

//open the file for reading
$filepointer = fopen("chat.txt","r");
$message = fgets($filepointer);

print '&output='."$message";
}else
{
print '&output='."wala naman";
}

?>


i work just fine in my own computer but when i try to run this my swf in another computer (computer in a network); it does nothing. the actionscript is placed on a button:

Thanks in advance

LoadVars Doesn't .load
My LoadVars object refuses to run it's load method.
I type:

newvars = new LoadVars();
newvars.onLoad = function () {
trace("Blah blah blah");
}
newvars.load("existing_file");

I run this thing, and nothing happens.
I scratch my head and insert a non-existing path in there.
Nothing happens (And I DO expect a 'cannot open file' output).

I think - "something wrong with the place" and put in a couple more LoadVars objects around the movie with the same parameters - none respond.

XML.load works fine.

Have you seen a problem like this before?

LoadVars.load Issues?
I hope some flash guru out there can help me with this…
Here it goes.

Im trying to have the users input send (POST) to a .txt when the user clicks a button.

So far I have worked out how to display parts of a txt file in a dymatic text box and the idea in the long run is to make a simple web log.

Any help would be greatly appreciated.

Load Array With Loadvars?
Can u load an array with loadvars... if so what format does the array have to be in.

Im using asp and when i check to see the length of the array it comes up as 50 when it should only be 5 and all the values are undefined.

Loadvars - Load Array
is a possible to load an array from a text file (.txt) using loadvars - i know you can load ordinary variables - and if you can what would the text file look like?

[F8] LoadVars Problem... Why Won't It Load Twice?
Hi there

I'm using LoadVars to display text in a dynamic textbox, however when you return to a place where the text has previously been displayed it's not there. It seems loadvars will only be called once.

Is there some way I can store the text to be displayed in the textbox?

Thanks for any help you can shed

Sammy

[MX04] LoadVars Or Load XML...
I'm wondering if it's possible for me to take an array I have in Flash and put it in an external file, either a .txt or .xml.

Currently, I have this array in flash:


PHP Code:



var aItem:Array = new Array();
    aItem["PT1P1 m"] = {instance:PT1PPage1.maxwell, itemname:"Shrub 1 - Maxwell", itemnum:"1697", price:.01, quantity:0};
    aItem["PT1P1 v"] = {instance:PT1PPage1.vray, itemname:"Shrub 1 - VRay", itemnum:"1698", price:.01, quantity:0};
    aItem["PT1P1 r"] = {instance:PT1PPage1.mentalray, itemname:"Shrub 1 - Ment Ray", itemnum:"1699", price:.01, quantity:0};
    aItem["PT1P1 maps"] = {itemname:"Shrub 1 Maps", itemnum:"8888", price:0, quantity:0};
    
    aItem["PT1P2 m"] = {instance:PT1PPage2.maxwell, itemname:"Shrub 2 - Maxwell", itemnum:"1700", price:.01, quantity:0};
    aItem["PT1P2 v"] = {instance:PT1PPage2.vray, itemname:"Shrub 2 - VRay", itemnum:"1701", price:.01, quantity:0};
    aItem["PT1P2 r"] = {instance:PT1PPage2.mentalray, itemname:"Shrub 2 - Ment Ray", itemnum:"1702", price:.01, quantity:0};
aItem["PT1P2 maps"] = {itemname:"Shrub 2 Maps", itemnum:"8889", price:0, quantity:0};




This array works great and is being accessed by this code:

PHP Code:



for (var i in aItem) {
    var currentProduct:String = i;
    aItem[i].instance.id = currentProduct;
    aItem[i].instance.onRelease = function() {
<code>
}
}




I'm worried that if I take the array out of Flash then the .onRelease code above won't work becuase I'd be taking 'aItem[i].instance' out of the flash timeline?!? I guess what I don't know is if flash can parse the info from the .txt or .xml and use it just as if it was an array on its own timeline? Does that make sense?

If I am able to use an external file to create the array then my next question is should I use a .txt or .xml file??

TIA

LoadVars Wont Load
attmepting to create a crappy message board that refreshes upon submitting data to a php script which then writes it into a txt file. All that stuff works.

In fact, loadVars intially loads the data at runtime. Also loads the data on submit when testing locally, but wont load the new comments when hosted.

The code is set in a blank mc. Frame 1 is empty, frame 2 has the below code, and frame 3 just loops back to frame two.


ActionScript Code:
_root.commentVars.load(_root.commentData)
_root.commentVars.onLoad = function(success) {
    _root.load_comments();
    gotoAndStop(1);
}

I'm not even sure if this is a problem with the code or some issue with restricting in the html or swf? Any suggestions are appreciated.

LoadVars.load() Syntax
Is there a way of making a normal loadVars.load load a url depending on a variable you set in the swf?


var reciever = new LoadVars();
loadurl = "test_onload_3.cfm?propertyID="+MY_VARIABLE_GOES_HERE;
reciever.load(loadurl);

so that I can set my variable and then load the variables with the propertyID that I choose in the swf?????

Can LoadVars() Load The Return Value From..
Hi,

Can LoadVars() load a returned value from web service. do we have to set any values to access the data from web service.


Thanks

Can LoadVars() Load The Returned Value
Hi,

Can LoadVars() load a returned value from web service. do we have to set any values to access the data from web service.


Thanks

LoadVars.Load Won't Return Variable
I am 16 hours into frustration.

When you see the code it will be pretty self-explanatory. It's a typical form and db. When the user presses the submit button the database does populate but after that I can't get the ASP to send the blnFailed back to the flash file so that I can send the user to the appropriate page. The variable blnFailed is always coming back as 'undefinded'. I'm so tired and mad. It's like, everything works until it goes to pass me back that variable.

I really hope you can help. Thank you.

Selfminded

The Actionscript is as follows:

__________________________________________________ _______________

function checkFailed(){
if(db.blnFailed == 0) {
_parent._parent.gotoAndStop(2);
}else if(db.blnFailed==1){
_parent._parent.gotoAndStop(3);
}else{
stop();
}
}

function submitFormS(){
var alertString = "";
var checkString = txtSName.text;
var theProblem = checkString.indexOf("'");
if (checkString == "") {
alertString = alertString + "<br>Nothing in Name field.";
} else if (theProblem != -1){
alertString = alertString + "<br>' in Name field. ";
}
checkString = txtSTitle.text;
theProblem = checkString.indexOf("'");
if (checkString == "") {
alertString = alertString + "<br>Nothing in Title field.";
} else if (theProblem != -1){
alertString = alertString + "<br>' in Title field. ";
}
checkString = txtSDistrict.text;
theProblem = checkString.indexOf("'");
if (checkString == "") {
alertString = alertString + "<br>Nothing in District field.";
} else if (theProblem != -1){
alertString = alertString + "<br>' in District field. ";
}
checkString = txtSAddress.text;
theProblem = checkString.indexOf("'");
if (checkString == "") {
alertString = alertString + "<br>Nothing in Address field.";
} else if (theProblem != -1){
alertString = alertString + "<br>' in Address field. ";
}
checkString = txtSPhone.text;
theProblem = checkString.indexOf("'");
if (checkString == "") {
alertString = alertString + "<br>Nothing in Phone field.";
} else if (theProblem != -1){
alertString = alertString + "<br>' in Phone field. ";
}
checkString = txtSEmail.text;
theProblem = checkString.indexOf("'");
if (checkString == "") {
alertString = alertString + "<br>Nothing in Email field.";
} else {
if (theProblem != -1){
alertString = alertString + "<br>' in Email field. ";
} else {
theProblem = checkString.indexOf("@");
if (theProblem == -1) {
alertString = alertString + "<br>Invalid email address in Email field."
}
}
}
checkString = txtSFourth.text;
theProblem = checkString.indexOf("'");
if (checkString == "") {
alertString = alertString + "<br>Nothing in Fourth grade field.";
} else {
if (isNaN(checkString)) {
alertString = alertString + "<br>Fourth grade field should only contain numbers.";
} else if (theProblem != -1){
alertString = alertString + "<br>' in Fourth grade field. ";
}
}
checkString = txtSSixth.text;
theProblem = checkString.indexOf("'");
if (checkString == "") {
alertString = alertString + "<br>Nothing in Sixth grade field.";
} else {
if (isNaN(checkString)) {
alertString = alertString + "<br>Sixth grade field should only contain numbers.";
} else if (theProblem != -1){
alertString = alertString + "<br>' in Sixth grade field. ";
}
}
checkString = txtSTenth.text;
theProblem = checkString.indexOf("'");
if (checkString == "") {
alertString = alertString + "<br>Nothing in Tenth grade field.";
} else {
if (isNaN(checkString)) {
alertString = alertString + "<br>Tenth grade field should only contain numbers.";
} else if (theProblem != -1){
alertString = alertString + "<br>' in Tenth grade field.";
}
}
if (alertString != "") {
alertString = "The following errors have occured:<br>" + alertString;
_parent._parent.clipAlert.alertString = alertString;
_parent._parent.clipAlert.gotoAndStop(2);
} else {
dbURL = "flashsdb.asp"; // I use the absolute path here, insert your own
db = new LoadVars();

var strName = txtSName.text;
var strTitle = txtSTitle.text;
var strDistrict = txtSDistrict.text;
var strAddress = txtSAddress.text;
var strPhone = txtSPhone.text;
var strEmail = txtSEmail.text;
var strFourth = txtSFourth.text;
var strSixth = txtSSixth.text;
var strTenth = txtSTenth.text;

db.onLoad = checkFailed();
db.load(dbURL+"?strName="+strName+"&strTitle="+str Title+"&strDistrict="+strDistrict+"&strAddress="+s trAddress+"&strPhone="+strPhone+"&strEmail="+strEm ail+"&strFourth="+strFourth+"&strSixth="+strSixth+ "&strTenth="+strTenth);

}
}

function clearFormS(){
txtSName.text = "";
txtSTitle.text = "";
txtSDistrict.text = "";
txtSPhone.text = "";
txtSEmail.text = "";
txtSAddress.text = "";
txtSFourth.text = "";
txtSSixth.text = "";
txtSTenth.text = "";
}

function submitFormO(){
}

function clearFormO(){
txtOName.text = "";
txtOPhone.text = "";
txtOEmail.text = "";
txtOAddress.text = "";
txtOProposed.text = "";

}

__________________________________________________ _______________

Here's the ASP Code that goes with it:
__________________________________________________ _______________

<%@ language="VBscript"%>
<%
Option Explicit
Dim objConn, checkSQL, blnFailed
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "DB"

Set checkSQL = objConn.Execute("SELECT Email FROM School WHERE Email = '" & Trim(Ucase(request("strEmail"))) & "'")

If checkSQL.EOF Then
objConn.Execute("INSERT INTO School(Name, Title, District, Address, Phone, Email, Fourth, Sixth, Tenth) VALUES('" & Trim(Ucase(Request("strName"))) & "', '" & Trim(Ucase(Request("strTitle"))) & "', '" & Trim(Ucase(Request("strDistrict"))) & "', '" & Trim(Ucase(Request("strAddress"))) & "', '" & Trim(Ucase(Request("strPhone"))) & "', '" & Trim(Ucase(Request("strEmail"))) & "', '" & Trim(Ucase(Request("strFourth"))) & "', '" & Trim(Ucase(Request("strSixth"))) & "', '" & Trim(Ucase(Request("strTenth"))) & "')")
objConn.Close
Set objConn = Nothing
blnFailed = "blnFailed=0"
Else
objConn.Close
Set objConn = Nothing
blnFailed = "blnFailed=1"
End If

response.write blnFailed
%>

How To Make A Preloader For LoadVars.load
hi guys how do i make a preloader for loading dynamic pages (jsp).

its like preloader for sound where u getbytesloaded / getbytesTotal.

but this time i need it for LoadVars.

any idea?

LoadVars.load(); Returns And Array?
Hi. When loading variables from an external file... are they returned to actionscript as an array? If so, I am trying to figure out how to loop through them and have them all print to a textbox. How would this be done? Thanks.

LoadVars & Asp Doesn't Load Data?
I cant seem to get the LoadVar section to work. so there must be something wrong with my actionscript on frame 1. The asp seems to work well enough when viewed from [ /localhost/flashvars.asp ] since it returns the correct string, but I dont get any results in the flash part?

thanks for any help.

.:AlphaOne:.

Load Text W/ Loadvars Without Using A Variable Name
ok, is there a way i can load a text file without it specifying a variable name? ie:
Code:
//page1.html
blah blah <b>blah</b><u>djdsa</u>
i want to be able to load that html without putting &variablename= in front of it...it'll just simplify it for the client to use...thanks

LoadVars To Load HTML For FlashPlayer 7
Help! I cannot find an answer in Flash Help or on the web. I am working in Flash Professional 8. I have developed a fla where I use the loadVars Script to load external HTML files. This works great when set to publish as FlashPlayer 6. Now, I need to stream video to the same file using Flashplayer 7 capabilities. But, when I change the publish settings to 7, my HTML no onger comes in. It only says "undefined". Does LoadVars work in 7? I am using a dynamic text box placed on the stage called "tArticle". Even when I create the box with ActionScript, it works in 6 and not 7.


var lvArticleContent:LoadVars = new LoadVars();
lvArticleContent.onData = function(sHTMLData:String):Void {
tArticle.htmlText = sHtmlData;
};
tArticle.condenseWhite = true;

lvArticleContent.load("rollovers/home.html");

LoadVars, Load Movie Troubles
I dont know how best to phrase this, but ill try cause i have been trying to fix it all day long.

I have a flash movie, and when its loaded another smaller flash movie is loaded into that( a guestbook).

This guestbook loads a variable in from a php script, status.

It will work fine on its on, but when i embed the movie into another movie it doesnt get the variable from the script.

attached are the files, changed the .php file to a .txt file

Please someone help me on this one

Loadvars Load Text From Files
How do I change the following code so that i can load text from two diffrent text files and dispaly it in the same dynamic text field? I tried
Code:
lv.load("test.txt","test2,txt");
but it didn't work.

Code:
read_btn.onRelease = function(){
read.text = "";
var lv:LoadVars = new LoadVars();

lv.onData = function(thetext:String) {
read.text = thetext;
}

lv.load("pass.txt");
};

LoadVars - Load External Txt Files
Hi, Here's my question, I will try to be as clear as possible:
my website is working on loadVariables, which is a pain in the ass, because, it require a variable in the begining of the txt file (say, textbox=, which makes it harder to update, since the website is dual - html, and flash).
I downloaded a movie, and the guy there did a great job, using loadVars.
I can email you the file. He made so easy to handle, but, I can't find his email...
He made the text scrollable, but, I couldn't combine it with a scroll bar (he did up and down buttons).
How can you help? help me combine this code, with a scroll bar. It should be easy to a pro, but, this is what I am not. Anyway, I like this code, and would love to send it to you.

Thanks,

Koby (koby_hayun@hotmail.com)

[CS3] LoadVars() Variable Trying To Load Whole Object
I have been working on getting a basic variable to load from an external source (PHP) into Flash, and thus far.. it's actually loading! However, for some odd reason the variable that displays the variable is trying to display the entire object it's in. Can anyone help with this?


Code:
seriesData = new LoadVars();
seriesData.onLoad = function (success) {
if (success) {
series1.text = seriesData;
} else {
series1.text = "Error Loading";
}
}

seriesData.load("listing.php");

Multiple Calls To Loadvars.load?
Folks,

I have to read 8 small text files and assign 8 dynamic text fields with the returned contents - simple enough. I execute the text_lv.load in a for loop (0 to 7) and it reads the data in all 8 files sweetly.

My problem is that in the text_lv.onData routine, I have no idea which file it's currently processing, so I don't know which variable to assign the data to. The for-loop is been and gone by the time the onData is triggered, so whilst the results come in nicely, I don't know which text_lv.load they belong to.

The movieClipLoader returns a target to let you know the name of the clip that called but there is nothing like that in loadVars. I can think up some ugly workarounds (like using 8 different loadVars, which I would do if I could dynamically create them) but surely someone has come with an elegant way of doing what I would have thought to be a common requirement.

LoadVars(); And Checking For A Previous Load ...
Hello everyone! First off, I wanted to thank everyone who has been so helpful on this forum! I have learned so much from your generosities!

Anyway, I am using the new LoadVars(); object to preload variables into flash ... and once they are loaded it redirects the frame to where my text box animates in. What I want to do is add in script that will check to see if the variables have already been loaded ... and if so ... just skip ahead to the animation where the text box is instead of using the preloader every time. Below is my code ... if you are confused at all ... please let me know and I will try to clarify! Thanks so much in advance.



Code:
_global.my_lv = new LoadVars();
my_lv.load("news.txt");
my_lv.onLoad = function() {
gotoAndPlay(12);
};

Sincerely,
Brian Griffith

How To Load Unicode Text From Php Using LoadVars?
Hi, i'm trying to load vars using php, but i need tu use unicode encode because i have to load different symbols from other languages. Does any body knows how to do this?? thks

XML To Load Movie Parms? (instead Of LoadVars?)
Hi All,

Semi-newbie -- Looking for any advice or insights I can get on this.

I'm inclined to try to load parameters for my Flash movie via XML. I'm wondering if that is a good idea to or not.

I've searched a bunch, and don't seem to find that is the norm. Maybe I'm not asking the right questions? Or maybe it's not the right way to do things for some reason I'm not thinking of? I was expecting it'd be pretty easy to find some code examples that I could adapt or use, but haven't found much of anything which makes me wonder if it's a bad idea for some reason.

Parms I'm thinking of loading:
colors for use throughout the movieheights, widths, locations, orientations for use throughout the movievalues for populating dropdown lists
Why I'm inclined to use XML and not loadVars
More intuitive to edit the file used to hold the variables. With loadVars it's just one long text string. Possible to load arrays, not just name/value pairs. I'm thinking somewhere in the direction of 'if there's child node, then use the parent node's name as as the name of a variable to be created (possible?), and iterate through the children assigning each's value to be the value of that iteration's corresponding array number. Possible? Worthwhile?
Thanks in advance for any thoughts,

:)Ben

HELP LoadVars Doesn't Seem To Load Quickly Or All The Time
I created a Flash website (you can view it at www.chirocurrent.com ) that is Database driven using Loadvars. The problem I am having is that the page sometimes load slow of the data doesn't show up on a page until you go to another page and then come back to the page. Any ideas on how to performance tune this so that the data shows up everytime? Thank you for your help! Here is an example of my code:

_global.cs = new Object();
var rStr:LoadVars = new LoadVars();
rStr.load("http://www.chirocurrent.com/pibsFt.php");
rStr.onLoad = function (success) {
_global.cs.title = rStr.c_title;
_global.cs.boddy = rStr.c_intro;
_global.cs.url = rStr.c_url;
_global.cs.target = rStr.c_target;
}

Load A Frame In HTML File With LoadVars
Well the case goes like this:

as i understood, there's a lot of problems with loading a file from different domain... or is it impossible? -kindof remember i did it once but ok, thats not an issue...

basicly i need to load an HTML page into flash - aint much of a problem.... but.... now the html page loads external site into an iframe... basicly my problem is that i cant see the contents of the iframe - ismuch as i understand it's because when the html file is loaded, then flash recognizes success and don't wait for the iframe content to load...

Any sugestions how to?

I have a way to fo it... i think... as i tried to help someone here with a similar problem...

1. flash sends the request to a php file with an url to display
2. also sends an unique variable - lets say Date.getTime()+random
3. the php file loads the html content from the url and saves it in a folder with the filename of this unique variable.... (dunno how to do it exactly but quess it's possible to save somekind of html content this way)
4. flash tries to load the file that php saves... let's say with an interval of 3 seconds... if the file is not found, it keeps tring... when it is found - well - success

now: Any better solutions - please - any ideas apreshiated greatly! -cuz mine sux

LoadVars Firefox Handle Failed Load
On my script im trying to load some data from a uri using LoadVars, somewhere in the code i want to check if the LoadVars failed to retrieve the uri (server down or uri not exists).

For that im using the onHTTPStatus function to get the response status code, but as i read in Adobe livedocs

A value of 0 can be generated in any player, such as if a malformed URL is requested, and is always generated by the Flash Player plug-in when run in the following browsers, which do not pass HTTP status codes to the player: Netscape, Mozilla, Safari, Opera, or Internet Explorer for the Macintosh.

Is there any trick to make this work ?

Strange LoadVars Thing – Can't Load A File...
Hello,

I seem to have ran into one of the many oddities in flash. Only this time, I can’t seem to get around it, nor can I even tell what is wrong...

My code is pretty simple I think, just 1 method right now:


Code:
private var loaderObject:LoadVars;
private var contentString:String;

public function init(inputFile:String):Void {
loaderObject = new LoadVars();
loaderObject.onLoad = function(success:Boolean):Void {
if(success == false){
} else {
trace("inside loader: "+loaderObject.text);
}
}

var anotherLoader:LoadVars = new LoadVars();
anotherLoader.onLoad = function(success:Boolean):Void {
if(success == false){
} else {
trace("inside anotherLoader: "+anotherLoader.text);
}
}

loaderObject.load(inputFile);
anotherLoader.load(inputFile);
}
The file that both of these loaders, ('loaderObject' and 'anotherLoader') are loading are the exact same. The only difference between the two is that ‘loaderObject ‘ is a class variable (so it can be access in another method), while ‘anotherLoader’ exists only inside the method. If it matters, the class (that this method is in) extends MovieClip. The file itself is a text file that contains 1 line: “text=This is a sample string of text.”

When I run this I get:

inside loader: undefined
inside anotherLoader: This is a sample string of text.

Any ideas why 'loaderObject' can’t load the text/file?

Load MPEG Files Dynamically Using Loadvars?
Can anyone tell me if it is possible to load MPEG files into a Flash movie dynamically?

Everything's working fine loading jpeg's and text into a listing of results in the Flash movie.

However, what I also need is an option where the user can click on "View movie", and an MPEG file (which is particular to that record in the database) loads and plays in the Flash movie.

Has anyone done this? Can it be done?

Using Loadvars To Load A Boolean Value From A Text File.
I'm quite new to actionscript so i hope i give enough info on this one.

I am trying to control the visibility of a movie clip using a boolean variable contained within a text file.

The mc i want to make invisible is in a swf which is loaded into a 'master.swf' using a MovieClipLoader object.

I have managed to get text to display across various boxes in my loaded (child) MC using a loadvars obeject defined in the masterMC and used by the childMC. I just cant seem to be able to get the value of my Boolean variable to go with the text variables and therefore control the visibilty of my MC.

This is my code - (in the master movie):

var myLV:LoadVars = new LoadVars();
myLV.onLoad = function(success) {
if (success) {
_level5.portfolio.loadedInfo.htmlText = myLV.info //this loads correctly
_level5.portfolio.workTitle.text = myLV.header //this loads correctly
_level5.portfolio.workMiniTitle.text = myLV.header //this loads correctly

_level5.webAddress = myLV.webLink //###this does not seem to load##

} else {
_level5.portfolio.loadedInfo.text = "There has been an error loading the requested information. Please contact the web master to report this error.";
}

This is the code that i think should load the webAddress variable into the child movie:

function loadWork() {
_level0.myMCL.loadClip("work/work.jpg", this.portfolioMC);
_level0.myLV.load("work/work.txt", this.portfolio.loadedInfo); // the webLink variable locat

trace (webAddress); //###this trace comes back as undefined

if (webAddress = false){
this.portfolio.webAddressMC._visible = false;
}
}

Any help on this would be great, as i have been scanning sites and forums for two days now!

Thanks

Loadvars To Load External Text File Åäö Is Not Possible?
Hi, this is my first post here.
The code it concerns is this: (which I found here on kirupa i belive)
myData = new LoadVars();
myData.onLoad = function() {
myText_txt.text.embedFonts = true;
myText_txt.text = this.myVariable;

};
myData.load("myText1.txt");

The problem: As I from Sweden and we have to use åäö sometimes, I would like this to work!
I added "myText_txt.text.embedFonts = true" which wasn't included in the original code.
Didn't help, also tried at properties for the text field, embeding the fonts there, but that made all text disapear. Thanks m8's in advance.

Unknown Reason LoadVars.load Fails
i am using LoadVars.load(), i am using this many times in the flash file and it all works expect in one place it wont load successfully when on the server, yet it WILL when i test from the flash IDE, ive tried using relative and absolute paths to the .php file and neither work....I dont understand why its not working on the server all the others are and works when i test movie? doesnt make much since? anyone have any ideas?

this is my code:


Code:
this._visible = false;
var couponLoad:LoadVars = new LoadVars();
System.security.allowDomain("https://www.kranichs.com");
couponLoad.load("https://www.kranichs.com/get_coupon.php");
couponLoad.onLoad = function(success) {
if (success) {
if (couponLoad.discount != 'none') {
_root.send_coupon._visible = true;
txt.text = 'Get an e-coupon for '+couponLoad.discount+' off entire e-cart.';
sender.searchTxt.text = 'Enter your Email';
}
}
};

Using LoadVars To Load 2 Dynamic Text Boxes?
This is the code I have on my timeline
Code:

// Dynamic Box 1
myLoadVars = new LoadVars();
myLoadVars.onLoad = function() {
   mytext.htmlText = myLoadVars.myHTMLdata;
};
myLoadVars.load("linkstext.txt");

// Dynamic Box 2
myLoadVars = new LoadVars();
myLoadVars.onLoad = function() {
   mytext2.htmlText = myLoadVars.myHTMLdata2;
};
myLoadVars.load("links2text.txt");

each box has an instance name of:
"mytext" - For the first box
"mytext2" - For the second box

My problem is I keep getting the "undefined" when I test my movie.

*** This worked fine with only one text box

Please help!
thanks
ZG

GetBytesLoaded/Total Not Working With PHP And LoadVars.load()
anyone know why this is? if I use ANY other file in the load(); command, it will return the number of bytes to me, but if I use anything with a php extension then it returns 0 bytes. What's up with this?

Load Source Code Of A Page As A Big String In LoadVars
say I want to load the whole source code of an HTML page in a loadVars object to perform a string search in it. If I simply go:

myLoadVarsObject = new loadVars();
myLoadVarsObject.load("http://yahoo.com");

It works but as soon as there is a "&#38nbsp" thing myLoadVarsObject uses the "&" and does funny stuff as if there was a new variable or something.

I'm guessing that if I can change the contentType of myLoadVarsObject things would go better...

Does anyone know how to achieve that?

[CS3] AS2.0 LoadVars Load Works But Send And SendAndLoad Dont
Hi all

I'm working on an existing code base ActionScript 2.0 flash object, and I'm trying to load content from an external XML source.

I'm using LoadVars for this. But I am unable to do a sendAndLoad or send, neither of them make the actual HTTP request to the remote server. This happens in both the actionscript debugger and when hosting the swf on a server.

Within the ActionScript code I have:
System.security.allowDomain("*");


And the URL is explicitly mentioned, and on the same server.
code:
t1 = new LoadVars();
t1.send(url)

t2 = new LoadVars();
t2.load(url)

the LOAD command goes through, however the send does not.

I'm explicitly setting param allowNetworking=all and allowScriptAccess=always when instantiating the swf.

Any ideas what might be stoping send and sendAndLoad

Thanks this has stumped me!

AS2: Need To Increase LoadVars.load (and SendAndLoad) Timeout To Over 30 Seconds
Hi,
I have found that loadVars. load and sendAndLoad times out ofter 30 seconds.
I need to override this to increase it, as there can be a longer time to process my call.

Is there a way to do this?

I have seen posts on using onHTTPStatus to detect statuses, but it still times out after 30 seconds.

Testing against PHP code and the 'sleep()' function proves the 30 second time out.












Attach Code

// AS2 code

load_btn.onRelease = loadStuff;
function loadStuff() {


var myLoadVars:LoadVars = new LoadVars();
myLoadVars.onHTTPStatus = function(httpStatus:Number) {
this.httpStatus = httpStatus;
if (httpStatus<100) {
this.httpStatusType = "flashError";
} else if (httpStatus<200) {
this.httpStatusType = "informational";
} else if (httpStatus<300) {
this.httpStatusType = "successful";
} else if (httpStatus<400) {
this.httpStatusType = "redirection";
} else if (httpStatus<500) {
this.httpStatusType = "clientError";
} else if (httpStatus<600) {
this.httpStatusType = "serverError";
}
};
myLoadVars.onData = function(src:String) {
trace(">> "+this.httpStatusType+": "+this.httpStatus);
if (src != undefined) {
this.decode(src);
this.loaded = true;
this.onLoad(true);
} else {
this.onLoad(false);
}
};
myLoadVars.onLoad = function(success:Boolean) {
trace("done");
trace("reply: "+myLoadVars.reply);
};
trace("loading test data");
myLoadVars.load("timeout_test.php");
}


/// timeout_test.php code
<?php

// works
// pause script for 29 seconds
sleep(29);

// does not work - times out
// pause script for 35 seconds
sleep(35);


echo "&reply=HELLO&";


?>

























Edited: 03/04/2008 at 05:42:24 AM by kossok

Unable To Load External Files Using Loadvars In Flash 8
Hi, i am unable to load external files from the flash authoring environment. Anyone know why this is or any possible fixes??

When ever I try and load a file, i get the error: (I changed the url of my site for this example of error)

Error opening URL "http://www.mysite.com/contact.php"

Any ideas??

Regards,

Martin

Computing Help And Info:
http://www.webrevolt.biz

The LoadVars.load Method Is An Asynchronous Action? Race Conditions?
I am trying to determine if a file exists on a server using the LoadVars.load method and checking for "success". I believe I am having an issue because I am actually using a 'for loop' to run through the file names while calling the '.load' method every iteration. However, every call seems to fork and do it's own thing while the loop continues.

This does actually work and it does find the file, but I don't want to make all these uneeded calls and more importantly...I am not even sure if there is a race condition and the variable I am depending on to be set further down in the code will be ready.

Is there any way to have my 'for loop' wait for the '.load' method to complete before continuing with the iterations? Maybe a while loop that checks '.isLoaded' or a more suitable method?

CODE:


PHP Code:




var vidExtensions:Array = new Array;
                                    //These are all the possible movie file extensions that could be there
                                    vidExtensions = [".3gp", ".3gp3", ".mpg", ".avi",
                                                    ".mp4", ".mqv", ".mov"];
                                    //Create the URL except the extension
                                    var testPath:String = new String();
                                    testPath = imgThumbPath.substr(0, imgThumbPath.indexOf("tn_"));
                                    testPath += imgThumbPath.slice(testPath.length + 3, imgThumbPath.length - 4);
                                
                                    var fileExists = new LoadVars();
                                
                                        fileExists.onLoad=function(success)
                                        {
                                            if(success){
                                                trace("SUCCESS!");
                                                //We have found the correct file
                                                myLink = unescape(""+sendPath);
                                
                                
                                            }
                                            else{
                                                trace("FAIL");
                                            }
                                        }
                                    
                                    //Loop through all possible movie extensions
                                    for(var i=0;i<vidExtensions.length;i++){
                                        var sendPath = testPath + vidExtensions[i];
                                        //Check if file exists
                                        fileExists.load(sendPath);
                            

                                    }

Load Txt Using LoadVars. Text Doesn't Show But "undefined" Instead?
Hello guys

I'm having some problems loading text. I tried to use the solution explained in the help file of MX 2004. But it doesn't work. What am I doing wrong here

Fla and txt attached.

Regards
Michael

My Variables Load With LoadVars...how Do I Execute A Loop To Assign Variables?
I have 52 (one for each week) duplicated MCs, a loadVars(), and variables "sermonTitle" and "airDate," which I'm trying to assign with the following:

this.airDate=_root.loadContent["airDate" + sermonDate];
this.sermonTitle=_root.loadContent["sermonTitle" + sermonDate];

which is placed in an onClipEvent (enterFrame) handler of the button which is duped . The vars load when I click Video > 2001.

The vars loaded have values named sermonTitle1, sermonTitle2, etc. and the same for airDate. The numbers attached reference the sermonDate which has already been assigned though my duplicateMovieclip loop:

num = 52;
ystart = b._y
n = 1;
while (n <= num) {
duplicateMovieClip("b", "b" + n, n);
setProperty("b" + n, _y, ystart + n*17);
this["b"+n].sermonDate = n ;
trace(this["b"+n].sermonDate);
n = n + 1;
}

I've tried attaching the assign code to the dupMovieClip loop:

num = 52;
ystart = b._y
n = 1;
while (n <= num) {
duplicateMovieClip("b", "b" + n, n);
setProperty("b" + n, _y, ystart + n*17);
this["b"+n].sermonDate = n ;
this["b"+n].airDate = "airDate" + n;
this["b"+n].sermonTitle = "sermonTitle" + n;
trace(this["b"+n].sermonDate);
n = n + 1;
}
setProperty("b", _visible, 0);

and it works - as far as assigning the correct value to the correct button, but it does not associate the loaded vars with them.

The SWF is VERY sluggish, though, which makes me think the onclipEvent is not the best way of assigning vars. I get the trace(this) showing all of the variables loading, so I know that's not the problem.


Does anyone know how to best assign these? I have been advised to use a loop for it. How would I go about executing a loop for this, as I will have navs loading in different text files - Thanks

Link to SWF:
HERE

LoadVars Load("home.txt"); Into Tdynamic.text
How to put .txt files into dynamic text field

I created the home.txt file in the same directory as this .fla file.
I named the dynamic text field: home_txt
My AS code i tried creating is:


Code:
var text:LoadVars = new LoadVars();
text.onLoad = function() {
home_txt.htmlText = a.LoadVars;
};
a.load("home.txt");
this.dynamicTextField.htmlText = "home.txt";
result:
Dynamic Text Field sais: undefined.

LoadVars In A For Loop Not Executing .load Function Until For Loop Completed?
Ok so I have a simply for loop: ID[i] is a global array



Code:


for (i=0;i<12;i++)
{
var loadInfo:LoadVars = new LoadVars();
loadInfo.onLoad=function(success:Boolean)
{
if (success)
{
trace("whatever:"+loadInfo.myname);
}
else
{
trace("Nope");
}
loadInfo.load(ID[i]+".txt");
}



the problem I'm having is that the function doesn't execute until the for loop completes and then it executes 12 times in a row. Output is 'whatever: undefined' 11 times and then 'whatever: Bobble' (which corresponeds to the last .myname value as it should). Why is this? And how can I fix it? To be continued...

~NH

Preloading Loadvars + Code That Uses The Loadvars
Hey everyone

I can't find out how to do this.

I have a main file with a menu. When a menu button is pressed, and external SWF with the corresponding page is loaded into a container in the main movie. I use the MovieCliploader for this

In all my external files, I have a loadVars that gets XML-output from a PHP-file. In the onLoad handler, I have a buildPage() function that takes the variables and e.g. builds a news page and so on.

My question is how I make a preloader that preloads the loadVars + all the code inside my buildPage function? I mean - on big preloader for it all?

I guess it cannot be done with my moviecliploader inside my main movie?

thanx - Rune

Copyright © 2005-08 www.BigResource.com, All rights reserved