LoadMovie: Testing For 'success'
I'm wondering if anyone knows of a way to test whether a call to 'target_mc.loadMovie( path )' has failed to find the path to the movie or whether it is still loading.
Essentially I am looking for a measure of 'success' like that found in the LoadVars() object. Using LoadVars I can say the following:
var myVars = new LoadVars(); myVars.load( path_to_file ); myVars.onLoad = function(success){ if (success){ trace("I found the file!"); } else { trace("I didn't find the file"); } }
However from what I have read and tested loadMovie does not have the same measure of success. Therefore I have no way to know whether I passed a bad path to the loadMovie function. The only way I can figure to deal with this is to set an arbitrary time after which I will assume 'if the file hasn't loaded by now, there is a problem'.
Anybody know of a more functional / elegant way to resolve this?
Thanks in advance.
Ultrashock Forums > Flash > ActionScript
Posted on: 2003-06-26
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
LoadMovie Success & Failure
hey,
I am designing a interactive flash section for a website. the main movie contains a product menu with information and in that main movie there is an optional section for viewing with a "how it works" animation. i created the animation in a seperate file and call loadMovie in the main movie when the button is pressed. It works perfectly when i test movie or play swf. However when i embed the swf into the dreamweaver file the animation will not load. nothing happens. all other interaction/buttons work fine, just the movie will not load. Any idea why this is not working. this is the first time i have used loadMovie so im not familiar with this action or why it would be working in flash and not in my browser!!!?
thanks,
mike
Problem With LoadMovie Testing
For some reason all of my load testing only works when u move the mouse around. Like for instance i have a script that does the following on frame 21:
if (_level0.levelHolder.getBytesLoaded() != _level0.levelHolder.getBytesTotal()){
percenter = Math.ceil((_level0.levelHolder.getBytesLoaded()/_level0.levelHolder.getBytesTotal())*100) + "%";
percentile.text = percenter;
movtype.text = "movie";
gotoAndPlay(20);
}
simple back and forth frame motion ... this is great and all except that it won't run independent of the mouse moving... there are absolutely no scripts in any of the movie that have anything to do with the mouse outside of clips acting as buttons. i'm totally baffled by this. At first i thought it was cause i was using an attachedMovie to do the loader which worked fine except that it was mouse dependent... so i put it inside of a clip that's always on the timeline... yeah... same deal. any ideas? any thoughts? anyone even seen this? This is seriously disturbing since i'm miles beyond loaders. Now i'm a noob again *sobs*
Flash 4 Preloader, LoadMovie & Testing
Hi all. I've created a seperate swf containing a fairly large sound clip (280kb) which I load using the loadmovie command (Flash 4) from the main timeline into a target. I have a preloader in the sound clip movie (nothing fancy) which does a test of _framesloaded versus _totalframes.
Now when I test the main timeline movie in Flash 4 with streaming and bandwith profiler it seems to load the loadmovie immeadiately without requiring or showing the sound clip streaming in - is this normal?
Testing Failure Of LoadMovie JPG - Solution
Ok everyone, I know there's a number of posts about this, and I couldn't find anything that worked; so here's the best method I've found to do the following:
-attempt to load an external image (jpg) using loadMovie
-if not found after a moment, replace with a default pic
Here's the action script:
Frame 1:
Code:
_root.createEmptyMovieClip('theThumb',2);
_root.theThumb.loadMovie('thumbs/prod1.jpg');
Frame 2:
Code:
if(_root.theThumb.getBytesTotal()<1){
trace("no jpg there, total bytes is "+_root.theThumb.getBytesTotal());
_root.attachmovie('comingSoon','theThumb',2);
}
stop();
If anyone has a more elegant solution, please let me know. That "error loading url" in the output window kinda urks me, but I guess you have to live knowing certain things.
Success
Thanks grotesmurf and dudovcic@qrex.com, I used a combination of your posts to create the effect I needed.
Thanks a ton!!!
frankosonik
Success
Woot! I finally got the code down. Thanks for those that helped me.
It's probably nothing fancy to all of you Guru's but for me (a newbie to Flash) it's exciting. I've been working on coding a template that is VERY dynamic. ALL the text is dynamic (title, copyright info, main text, menu titles, menu items). There are four dropdown menu's, and each menu can have a user-defined number of items. Each item in the menu can either open a URL in a new window or load a text file into the main textbox, depending on what the webmaster desires.
Check it out and tell me if you find bugs. If you'd like a copy of the FLA, email me, though it's probably rather sloppy for some of you perfectionists.
This was a quickie movie. I basically just wanted to get the code right so I can use it on future projects, so it doean't look too fancy. (only two simple animations, lol)
Thanks again!!
Little Success
I am trying, with little success, to create a custom class that recognizes how many movie clips(or instances of another custom class) are within a defined area. Can anyone help me out here? I'm trying to create a game of backgammon and each Point class needs to know how many Chip classes are on top of it. How can I capture or display that? Any help would be greatly appreciated. Thanks in advance.
Bo
SendAndLoad. Success?
Hi
iuse sendAndLoad to run a asp page and populate a access database. How can i detect the success of the command sendAndLoad? When i get an error in my asp file, how can i detect that?
Thanks
Mario
Loadvariablesnum Success
hi, i'm using loadVariablesNum to load variables from a txt file into a dynamic text box in my movie. i've got it working so that everytime a link is clicked the content in the text box changes and the text box fades in. the problem is sometimes the animation to fade in happens before the variables are loaded. how can i make it so the animation doesn't play until the variables are loaded. here is my code.
ar_mc.onRelease = function() {
loadVariablesNum("arsro.txt", 0);
_root.gotoAndPlay(247);
};
any help would be great.
thx
jeremy boyd
Trying To AttachMovie With No Success
I have created an array of XML Nodes called ContainerArray. Now I would like to attach a movie clip for each of the nodes and fill text boxes inside those movie clips with information from the nodes attributes. Here is my code:
[code]function buildContainerArray() {
ContainerArray = new Array
for (i=0; i<TitleNode.childNodes.length; i++){
curContainer=TitleNode.childNodes[i];
ContainerArray[i] = new Container (curContainer.attributes.number, curContainer.attributes.name, curContainer.attributes.type);
}
makeContainer();
}
function makeContainer(){
for (b=0; b<ContainerArray.length; b++){
attachMovie("con_button", "selection"+b, b);
_root["selection" + b]._x = 15;
_root["selection" + b]._y = 90 + (b*30);
trace ("worked");
}
eval ("selection" + b).onPress = function() {
if (eval ("selection" + b).type_box.text="container") {
trace ("this is a container");
}else if (eval ("selection" + b).type_box.text="test") {
trace ("this is a test");
}
}
}
function Container (numbers, names, types) {
_root["selection" + b].number_box.text=numbers
_root["selection" + b].names_box.text=names
_root["selection" + b].type_box.text=types
trace (numbers)
trace (names)
trace (types)
}
}
[code]
It all seems to work fine except for the attachmovie. I get nothing. Any suggestions?
Trying To AttachMovie With No Success
I have created an array of XML Nodes called ContainerArray. Now I would like to attach a movie clip for each of the nodes and fill text boxes inside those movie clips with information from the nodes attributes. Here is my code:
[code]function buildContainerArray() {
ContainerArray = new Array
for (i=0; i<TitleNode.childNodes.length; i++){
curContainer=TitleNode.childNodes[i];
ContainerArray[i] = new Container (curContainer.attributes.number, curContainer.attributes.name, curContainer.attributes.type);
}
makeContainer();
}
function makeContainer(){
for (b=0; b<ContainerArray.length; b++){
attachMovie("con_button", "selection"+b, b);
_root["selection" + b]._x = 15;
_root["selection" + b]._y = 90 + (b*30);
trace ("worked");
}
eval ("selection" + b).onPress = function() {
if (eval ("selection" + b).type_box.text="container") {
trace ("this is a container");
}else if (eval ("selection" + b).type_box.text="test") {
trace ("this is a test");
}
}
}
function Container (numbers, names, types) {
_root["selection" + b].number_box.text=numbers
_root["selection" + b].names_box.text=names
_root["selection" + b].type_box.text=types
trace (numbers)
trace (names)
trace (types)
}
}
[code]
It all seems to work fine except for the attachmovie. I get nothing. Any suggestions?
ExternalInterface- Has Anyone Had Any Success
Works great on Safari, but does not work on E.I or Mozilla for Mac, but does work on E.I or Mozilla for Win.
Example:
http://islcomps.islco.com/flash/Exte...ace/index.html
The example takes what's in the input box- calls a function in the flash movie that populates the text field in the flash movie and then calls function that calls a javascript function that populates the field on the HTML page with the value in the flash field. Also, pressing the "call Js" button in the flash movie should call an alert with the content of the flash text field.
I suspect this might be a permissions or sandbox issue but really don't know.
I've set the allowScriptAccess = "always" and have also tried "samedomain" .
???
Any help would be greatly appreciated!
Joe
Success OnData? & Z-value Of Mc's
Last edited by Codemonkey : 2006-04-21 at 05:13.
hi everybody!
well, i got this code... and i'd like to personalize it more... 'cause it shows a message only if .css file fails... what about the .htm file, how can i do it?
it could be better if someone knows the way the make a link in the "load failed message" to load again those files... or just refresh de page...
ActionScript Code:
// Create a new style sheet and LoadVars object
var myVars:LoadVars = new LoadVars();
var styles = new TextField.StyleSheet();
// Location of CSS and text files to load
var txt_url = "news.htm";
var css_url = "news.css";
// Load text to display and define onLoad handler
myVars.load(txt_url);
myVars.onData = function(content) {
storyText = content;
};
// Load CSS file and define onLoad handler:
styles.load(css_url);
styles.onLoad = function(ok) {
if (ok) {
// If the style sheet loaded without error,
// then assign it to the text object,
// and assign the HTML text to the text field.
svnews.styleSheet = styles;
svnews.text = storyText;
} else {
svnews.htmlText = "<br><br><br><br><br><br><br><br><p align='center'><font color='#FF0000'>¡ERROR!<BR>CARGA DE DATOS FALLIDA</font></p>";
}
}
hope u can help me, it doesn't seem difficult
and... there is some code to make a movie clip stay over the other elements? like above in layers? 'cause i load a swf in other swf... and i need a mc stay over the elements in the main swf
thanx ni advance
cheers!
(yes, my engish isn't good )
LoadVariablesNum Success?
Heres my dilema, I'm trying to pass variables from a whole slew of text files, each one has a few variables, heres an example of one of the text files :
Code:
&question=Sample Question
&answerA=Answer A
&answerB=Answer B
&answerC=Answer C
&answerD=Answer D
&answerCorrect=A
Each question will be stored in a numbered text file, question0.txt, question1.txt, etc.. A quiz will be generated and loaded in a random order, the problem I'm having is that I want to create an array with each of these variables stored in that cell, so as question1.txt loads, array[1] stores another array of 6 things, and once those arrays are stored, the next text file is loaded, using a for loop. What I need is a way to pause the for loop untill the information has loaded and been stored from the text file, because right now its going too fast and the variables dont have time to load and be stored before the clip is loading the next text file. I know I can check for the success of a LoadVars() command, but is there a way to do this with a loadVariablesNum? or should I be doing this another way... The only stipulation is the text files, they have to be text files for updateability and scaleability issues.
Heres the code I'm using, thanks to degenerate, to generate my Array.
in the frame, where _root.questionsTotal is a variable loaded from a text file with the total number of questions as a variable.
Code:
_root.questionList = new Array();
_root.questionArray = new Array();
for(i=0;i<_root.questionsTotal;i++){
_root.questionArray[i]=i;
}
in the button
Code:
on(press){
for(i=0;i<25;i++){
var temp = _root.questionArray.length;
if(temp>0){
var rand = Math.floor(Math.random()*temp);
questionArray.splice(rand,1);
}
}
}
This all works fine, its the initial storing of all the variables that has me stumped... Any ideas? Anyone... thanks in advance, and thanks degenerate for the help so far.
If(success) Problem
Here is the code
Code:
sav.onRelease = function(success:Boolean)
{
mdm.FileSystem.saveFile(workorder.text.split("
").join("")+".txt", "Date Posted"+" " + date_proded2.text );
if(success){
mdm.Dialogs.prompt("Correct!")
firstSound=new Sound(this);
firstSound.attachSound("saveprint");
firstSound.start();
} else {
mdm.Dialogs.prompt("Error!")
firstSound2=new Sound(this);
firstSound2.attachSound("error");
firstSound2.start();
}
}
The file saves fine, but I always get the "Error!" prompt. Why is this?
A Zoom Success Story
Hi
I posted a problem on this board a while ago:
I was trying to create this effect:
when you click, you zoom into an image in such a way that the part of the image on which you clicked, is centered on the stage. When you click again, the image returns to its original size. So you can have a closer look at different parts of the image.
I did not understand any of the answers I got, so I had to figure it out for myself, and Voila! (eventually) I did it.
Im attaching the .fla so you can have a look at it, maybe some one else would find this usefull.
I'm sure my script is not the most efficient, and could be neater etc but hey, it works. So for all the newbies out there, keep trying. If I can do it, anyone can.
Cgi Email Success Page
soooo i just set up my email form on my site and it works fine. but once you type in your info and hit send a success page pops up sayin what you entered and that it was sent. i dont want this page to pop up...can i do this in my actionscripting on my button. the script as of now goes as follows:
on (release) {
subject = "Website Email";
recipient = "kurt@kurtcruse.com";
loadVariablesNum("/cgi-sys/FormMail.cgi", this, "POST");
nextFrame();
}
the address is
http://bgsugraphics.com if you wanna try it out and see what i mean
Currency Calculation...success But
i did a currency calculatio prog...that rounds the result to two positions after the decimal points.with help of the funktion posted by johnmac.but it has a problem of not displaying the secong digit after the point if its "0". i found out a solution but still it dosnt work for some numbers entered....pls take a look at the attached file and give me a solution.
Loadvars Success Problem
I am making an e-mail form through Flash.
This is my action script code on the submit button:
on (press) {
var result_lv:LoadVars = new LoadVars();
result_lv.onLoad = function(success:Boolean) {
if (success) {
trace("success");
} else {
trace("Error connecting to server.");
}
};
var send_lv:LoadVars = new LoadVars();
send_lv.email = _parent.Email;
send_lv.sub = _parent.Name;
send_lv.message = _parent.Message;
send_lv.sendAndLoad("website.com/mail2.php", result_lv, "POST");
}
The emailing works, but I always get the "error connecting to server" message. Does anyone have any idea why?
Thanks for any help
.onLoad(success) Confusion
Hi, I'm having trouble understanding this syntax. Can someone spell this out in English for me? (see also)
Code:
myLoginReply.onLoad = myOnLoad;
I know that myOnLoad is executed when myLoginReply has loaded, but I can't read this line in English, and I don't understand why it pauses until myLoginReply has executed. I would have thought onLoad would be set to whatever myOnLoad returned... which is not true?
I've also seen .onLoad(success), and I don't understand why the success argument is in there, or how it works.
Can someone interpret for me?
Whats Up With The Success Boolean?
onClipEvent(load){
var result_lv:LoadVars = new LoadVars();
result_lv.onLoad = function(success:Boolean) {
if (success) {
this._parent.result_ta.text = "AAAIIIIIIIIIIIIIIIII";
} else {
this._parent.result_ta.text = "Error connecting to server.";
}
}
var send_lv:LoadVars = new LoadVars();
send_lv.name = "GOOOOOTCHHHHHAAAAAAAAAAAAAA";
send_lv.sendAndLoad("test2.cgi", result_lv, "POST");
}
I can't see how this returns any value. Does the success boolean thing work no matter what you send the data to? The result_ta doesn't show anything, not even the error message. What am i doing wrong?
How To Determine Load Success
I'm doing something wrong here. I'm loading a string in the form of a url in order to send a variable from my flash movie. This works fine, but I need to figure out how to tell if the variables have been accepted so I can then load an xml file.
Here is the actionscript I am using... anybody have a suggestion for how to check to see if it has been sent/accepted?
Code:
function tagImage(){
var tagTerm = txtTag.text;
var tagURL = "http://blahblahblah.com"+tagTerm+;
var tagArt:LoadVars = new LoadVars();
tagArt.load(tagURL);
tagArt.onLoad = function(success) {
if(success) {
trace("successfully loaded tag supposedly");
grabIt();
} else {
trace("Error sending tag");
}
}
}
[CS3] If(success) ... Fail Issue...
I have an issue where if I have an on.Load, and it succeeds then I want to display one thing... but if it fails, I want to display another in a dynamic text box area with the var sAssistTitle.
I know this should be simple, but it's defaulting to the second and not the first message. And when I make it fail, it doesn't even display the second message.
Code:
obj.onLoad=function(success)
{
if(success){
trace("properties in the object:");
for(var i in this)
{ trace(i+" = "+this[i]);
sAssistTitle = ("It worked.");
}
}
else
{
trace("Error communicating to server.");
}
sErrorTitle = ("It didn't work.");
}
How To Determine The Success Of LoadVariables?
Hey guys, thanks for taking the time.
Before somebody tells me "Hey man use the LoadVars insted" I must say "Yes yes, I know that's the better way to load variables in flash" and I do plan to use them from now on, but since an application I have was programmed in a nasty way I do not understand at a 100%, and it uses a line to send variables to a mail form, but it uses the loadVariables function and I don't wanna mess with that, and I need to fix something quickly.
So, to my question:
I need to display a message upon the success of the loadVariables function or a different message upon failure. And the line is the following:
PHP Code:
_root.orderForm.loadVariables("http://www.domain.com/orders/checkOrder.php", "POST");
Thanks for the help!
[F8] XML Object Success - IE Different Than FireFox
I'm having a pain in the butt problem related to XML file loading...
Here is the set-up (problem described below):
var xmlData:XML = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = makeDataArrays;
And the function receives "success" variable to know everything worked:
function makeDataArrays(success) {
Finally this is the line that loads a file:
xmlData.sendAndLoad("myfile.xml", xmlData);
Here is the problem, testing on a web server: If the XML file does NOT exist, in FireFox success traces as "false". In IE 6, it traces as "true "!
How/Why is this possible? The file is not there. It should be false in both browsers. Needless to say, this is wreaking havoc on error-checking and some debugging efforts.
Firefox Flash Player version is: 9,0,115,0
IE 6 Flash Player version is: 9,0,47,0
Ondata (success) Not Working AS1?
I have used a old script for as1 for sending email's via flash/php, but the ondata script doesn't work in as2 to check whether the email has been succesful.
heres the old code:
Code:
loadVariablesNum("contact_form.php", 0, "POST");
this.onData = function()
{
for(var a in this) trace([a,this[a]]);
if(this.output=='sent')
{
gotoAndStop("success");
} else {
gotoAndStop("error");
}
how can i get this to work in as2?
Anyone Have Success With Flourine Remoting For .NET
Just wondering if anyone has used Flourine for .NET remoting,
or AMF.NET by openmymind,
or a custom NET Webservice/remoting codebase,
and if so do you have any source code, examples, etc to help me out? Thanks!
-Cameron
A No-browser Window. I Tried But No Success. Please Help.
i' ve been trying to make this effect you can see here:
http://www.u-53.de/flash.html
meaning when i double click to enter the site there's a not-browser window that opens.
i work with a book and did wrote down the java script that is suppose to give that result but nothing is happening. can you write it down for me. i have the SWF wich is the main stream and all the others SWF that compele my site.
thanks for your time
[FMX2004]duplicateMovieClip Success?
Hello,
Thanks for reading =)
I have that loop:
ActionScript Code:
for (i=1; i<this.nb; i++) {_root.bande.duplicateMovieClip("bande"+i, i, {_x:originex, _y:(originey+(bandeheight*i))});
How can i tell it that once a duplication is successfull, it creates a new sound object like:
ActionScript Code:
_root["mySound"+i] = new Sound();
???
TiA:)
PHP Mail Form Success
Ok so what I want to do is move my swf to the next page if sending an email using php was succesful. The code I have for the submit button is:
ActionScript Code:
sendButton.onPress = function(){ loadVariablesNum("mailTut.php", 0, "GET");}
How would I check to see if the email was sent succesfully. This is the php code
PHP Code:
<?
$Name = $_GET['name'];
$Email = "www.creativeimpulses.com";
$Message = $_GET['message'];
$Subject = "Test E-mail Tutorial";
$Header = "From: $Name <$Email>";
$new = mail($Email, $Subject, $Message, $Header);
?>
is there an if(success) statement in PHP or something similar? Or could I pass a variable back to flash when the mail gets sent and flash would go to the next page if the value of that variable was true..any suggestions very welcome. Thanks
PS- is the creativeimpulses.com line formatted correctly?
[FMX2004]duplicateMovieClip Success?
Hello,
Thanks for reading =)
I have that loop:
ActionScript Code:
for (i=1; i<this.nb; i++) {_root.bande.duplicateMovieClip("bande"+i, i, {_x:originex, _y:(originey+(bandeheight*i))});
How can i tell it that once a duplication is successfull, it creates a new sound object like:
ActionScript Code:
_root["mySound"+i] = new Sound();
???
TiA:)
Netscape 6 And OnLoad (success)
Weird...
If I use the "success" variable that returns via the onLoad call for LoadVars, Netscape 6 ALWAYS evaluates that as true, even when the onLoad retrieved nothing. Whereas it evaluates properly in IE 6.
So I gotta ditch the nice clean "success" style coding and just evaluate a returned variable from the file I'm trying to open up.
Not preventing me from doing anything... just weird... annoying. Anyone else experience this? I want to share the love.
Panamon
MyLoadVarsObj.onload(success) Function ?
sif the LoadVars.onLoad function in tutorial works
loadableData.onLoad = function(success){
I have used the above fucntion as outlined in the realtive Actionscript.org tutorial about the LoadVars object and have been sitting here for over 2 hrs trying to get it to work. Ive run trace("im here"); to find out where flash is getting stuck and this function is the culpurate.
Of course Im running Flash MX so no version problem, but after reading the macormedia site im not sure the above function is the appropriate use of the onLoad boolean.
Have any ideas whats wrong? (see below)
Code:
onClipEvent(load){
loadablePaylist = new LoadVars();
loadablePaylist.load("paylist.txt");
var status = null;
loadablePaylist.onLoad = function(success){
if(success)
{
//load outcome
status = "Paylist loaded";
trace(status);
trace(loadablePaylist.track_count);
var vertpos = 46;//vertical positioning of clips
var count = 0;
//convert string track_count to number
noOfTracks = new Number(track_count);
while(count!= noOfTracks){
duplicateMovieClip(_root.paylist.box,"box" + count + 1, count);
setProperty("_root.paylist.box" + count + 1, _y, vertpos);
vertpos = vertpos +_root.paylist.box._height;//increment verical positioning value
count++;
}//end loop
}
else
{
status = "Empty paylist";
trace(status);
//if no paylist maybe open dialog again, error!??
}
}//end function(success)
}//end onClipEvent()
LoadableData.onLoad = Function(success){ ?
loadableData.onLoad = function(success){ DOESNT WORK???
I have used the above fucntion as outlined in the realtive Actionscript.org tutorial about the LoadVars object and have been sitting here for over 2 hrs trying to get it to work. Ive run trace("im here"); to find out where flash is getting stuck and this function is the culpurate.
Of course Im running Flash MX so no version problem, but after reading the macormedia site im not sure the above function is the appropriate use of the onLoad boolean.
Have any ideas whats wrong? (see below)
Code:
onClipEvent(load){
loadablePaylist = new LoadVars();
loadablePaylist.load("paylist.txt");
var status = null;
loadablePaylist.onLoad = function(success){
if(success)
{
//load outcome
status = "Paylist loaded";
trace(status);
trace(loadablePaylist.track_count);
var vertpos = 46;//vertical positioning of clips
var count = 0;
//convert string track_count to number
noOfTracks = new Number(track_count);
while(count!= noOfTracks){
duplicateMovieClip(_root.paylist.box,"box" + count + 1, count);
setProperty("_root.paylist.box" + count + 1, _y, vertpos);
vertpos = vertpos +_root.paylist.box._height;//increment verical positioning value
count++;
}//end loop
}
else
{
status = "Empty paylist";
trace(status);
//if no paylist maybe open dialog again, error!??
}
}//end function(success)
}//end onClipEvent()
MOVIE CONTROL HELP - Reward Upon Success
I need help with movie controls for my cartoons. I have play and pause buttons for navigating the cartoon, using simple play; and stop; commands. However, when the movie is paused everything stops but the movie clips. The movie clips will continue to loop, and as a result will become out of sequence with the movie. Help would be greatly appreciated. Ask about cash reward upon succession.
Post to Board or e-mail me @ dr_gould2000@yahoo.com
Much Appreciated
LoadClip() Fails Yet Returns Success
This is for Flash MX 2004 and Flash Player 7.
I have a main SWF file that loads external SWFs into a movie clip. The remote server mangles the server path for security reasons, so if I look at this._url in main.swf, it looks something like this:
https://www.somedomain.com/somepath/main.swf,secpath=another.domain.com+
If I load the external movie clip by merely referencing its file name (e.g., "myexternalmovie.swf"), it doesn't load, probably because the server is expecting the mangled url.
I've tried parsing the mangled URL of main.swf so that I can load the external SWF using the following absolute URL:
https://www.somedomain.com/somepath/myexternalmovie.swf,secpath=another.domain.com+
However, when I call loadClip() using this URL, it doesn't load the movie, loadClip() returns TRUE (indicating success), and the onLoadError() listener is never called.
So I tried a simple test. On my local machine, I called loadClip("myexternalmovie.swf,this_url_is_invalid" ) and the same thing happened: the clip didn't load (no surprise), yet loadClip() returned TRUE and onLoadError() never was fired. The output window shows an "Error loading URL" message, yet there's no indication in ActionScript that it failed.
So I have two questions:
1. Why do loadMovie() and loadClip() not load a movie at the following valid URL:
https://www.somedomain.com/somepath/myexternalmovie.swf,secpath=another.domain.com+
If I type this URL directly into the browser, it works.
2. Why does loadClip() indicate a success even if it can't load the URL, and why doesn't onLoadError() get called?
XMLSocket.onConnect -- Success Always False?
I'm using Flash MX 2004 and i've written a sample socket server in php. it responds when i telnet in from everywhere:
* using telnet from the Win XP command line from my desktop
* using raw telnet from puTTY from my desktop
* using telnet from the linux command line on the server
flash, however won't let me connect with and XMLSocket. XMLSocket.connect returns true but my onConnect function always receives success=false. I CANNOT FIGURE OUT WHY. How do i figure out what the problem is?
Here's my actionscript:
Code:
var host:String = 'mydomain.com';
var port:Number = 1234;
mySock = new XMLSocket();
mySock.onConnect = function(success) {
trace('this is my anonymous onConnect function');
trace(' success:' + success);
mySock.send('foobar is what i sent');
}
trace('here we go, connecting to ' + host + ":" + port);
var foo = mySock.connect(host, port);
trace('connect attempted, foo is ' + foo);
mySock.close();
the trace results are this:
Code:
here we go, connecting to mydomain.com:1234
connect attempted, foo is true
this is my anonymous onConnect function
success:false
How on earth do I figure out what this false results is for? I have put the following crossdomain.xml file at the root of mydomain.com:
Code:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM
"http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<!-- Policy file for http://www.mysite.com -->
<cross-domain-policy>
<allow-access-from domain="*" />
</cross-domain-policy>
I have also tried uninstalling flash player 9 and installing he debug version instead. the trace statements end up in flashlog.txt but this directive is totally ignored apparently:
Code:
SecurityDialogReportingEnable = true
I never get any security message or anything. I'm totally mystified.
XMLSocket.onConnect -- Success Is Always False?
I'm using Flash MX 2004 and i've written a sample socket server in php. it responds when i telnet in from everywhere:
* using telnet from the Win XP command line from my desktop
* using raw telnet from puTTY from my desktop
* using telnet from the linux command line on the server
flash, however won't let me connect with and XMLSocket. XMLSocket.connect returns true but my onConnect function always receives success=false. I CANNOT FIGURE OUT WHY. How do i figure out what the problem is?
Here's my actionscript:
Code:
var host:String = 'mydomain.com';
var port:Number = 1234;
mySock = new XMLSocket();
mySock.onConnect = function(success) {
trace('this is my anonymous onConnect function');
trace(' success:' + success);
mySock.send('foobar is what i sent');
}
trace('here we go, connecting to ' + host + ":" + port);
var foo = mySock.connect(host, port);
trace('connect attempted, foo is ' + foo);
mySock.close();
the trace results are this:
Code:
here we go, connecting to mydomain.com:1234
connect attempted, foo is true
this is my anonymous onConnect function
success:false
How on earth do I figure out what this false results is for? I have put the following crossdomain.xml file at the root of mydomain.com:
Code:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM
"http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<!-- Policy file for http://www.mysite.com -->
<cross-domain-policy>
<allow-access-from domain="*" />
</cross-domain-policy>
I have also tried uninstalling flash player 9 and installing he debug version instead. the trace statements end up in flashlog.txt but this directive is totally ignored apparently:
Code:
SecurityDialogReportingEnable = true
I never get any security message or anything. I'm totally mystified.
XMLSocket.onConnect - Success Is False?
I'm using Flash MX 2004 and i've written a sample socket server in php. it responds when i telnet in from everywhere:
* using telnet from the Win XP command line from my desktop
* using raw telnet from puTTY from my desktop
* using telnet from the linux command line on the server
flash, however won't let me connect with and XMLSocket. XMLSocket.connect returns true but my onConnect function always receives success=false. I CANNOT FIGURE OUT WHY. How do i figure out what the problem is?
Here's my actionscript:
var host:String = 'mydomain.com';
var port:Number = 1234;
mySock = new XMLSocket();
mySock.onConnect = function(success) {
trace('this is my anonymous onConnect function');
trace(' success:' + success);
mySock.send('foobar is what i sent');
}
trace('here we go, connecting to ' + host + ":" + port);
var foo = mySock.connect(host, port);
trace('connect attempted, foo is ' + foo);
mySock.close();
the trace results are this:
===trace===
here we go, connecting to mydomain.com:1234
connect attempted, foo is true
this is my anonymous onConnect function
success:false
===trace===
How on earth do I figure out what this false results is for? I have put the following crossdomain.xml file at the root of mydomain.com:
===crossdomain.xml===
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM
"
LoadVars = Success, But My Vars Are Undefined?
Hello all!
I've been working with LoadVars a lot recently and like it very much so. However, I have encountered a new problem. As always, I have searched through a bunch of threads to no avail; if this is a repeated question, please trout slap me and I'll apologize! Anywho -
I have this array that already works in my Flash project:
ActionScript Code:
angles = [0, 35, 100, 72, 72, 81];
Now I want to pull those numbers in the array from a changing PHP program. To start, I'm using a test file:
PHP Code:
&p1=0&p2=35&p3=100&p4=72&p5=72&p6=81
Then I have actions like this right before I need those pulled in:
ActionScript Code:
lv = new LoadVars();lv.onLoad = function(success){if(success){p1 = this.p1;p2 = this.p2;p3 = this.p3;p4 = this.p4;p5 = this.p5;p6 = this.p6;trace(p1); //returns a zero}}lv.load("myStupidTextFile.txt");trace(p1); //returns 'undefined'
How do I get those variables to register outside of the loadVars? There has to be a way, right??!!
XML With Flash And The Success Rate Is Not Economically
I am having hard time using XML with Flash and the success rate is not economically encouraging.
Sometime a Flash movie with XML works fine and another time a Flash Movie with XML fails and it does not provide the cause of failure. I am forced to discard the idea of using XML with Flash and use the old way of creating movies without XML.
I have attached two files the first one is a zipped file for a small Flash movie and the second one is the URL.
http://www.readverse.com/00_red.zip
http://www.readverse.com/00_red/010_colors.html
My hope is to find a way to make the creation of similar Flash movie more efficient. The way I created this Flash movie is as follows:
1 Create Flash document __ 2 Import images to library
3 use external sound files ___ 4 Convert images into buttons
5 add code to on press button ___ 6 Publish code
7 Use Macromedia Dreamweaver to include *.swf file into an HTML
I need to create several hundreds of the same process but the only differences are the images and the sound. Of course, the number of rows and cells can differ.
Examples:
Red Blue Green
_____________ Or
Blue Green Yellow White
He She His Her Parents
_____________ Or
XX YYY VVV NNN LLL BBB CCC
88 999 77 XCN J90
x88 x999 x 77
Is there a way to change the code that I have to be changed easily?
[as2][flash 8] Loadvar Success Failure
Hi peeps,
So...I think this is my first post on here and as first posts go I'm sure you guys can pick on me for asking already asked questions. But hopefully I'll ask it in that special way that provides a new spin on it.
I'm having a problem with loading a text file into the animation with 100% success. If you go to www.talkingdog.tv on the front page I have a grid schedule thing-a-ma-bob that grabs a bunch of variables in a &mon2pm=pup& formate. I loads fine on my computer and had worked fine for some time on our test site. So..I use the onLoad function and draw the grid if successful and and try to reload if not.
I was trying to simply reload the text document by calling load("blah.txt") but it never seems to grab the variables after it's gone down the failure path.
Here is the slighty stripped down version:
Code:
loadText.onLoad = function(success) {
var count = 0;
var wait = 0;
if(success){
while(loadText.getBytesLoaded() < loadText.getBytesTotal() ){
showtitle.text = "waiting:" + wait++;
}
for( var prop in this ) {
tArray[count] = new Array(prop, this[prop] );
count++;
}
loadShowGrid();
drawShowGrid();
} else {
reloadVars();
}
}
LoadVars = Success, But My Vars Are Undefined?
Hello all!
I've been working with LoadVars a lot recently and like it very much so. However, I have encountered a new problem. As always, I have searched through a bunch of threads to no avail; if this is a repeated question, please trout slap me and I'll apologize! Anywho -
I have this array that already works in my Flash project:
ActionScript Code:
angles = [0, 35, 100, 72, 72, 81];
Now I want to pull those numbers in the array from a changing PHP program. To start, I'm using a test file:
PHP Code:
&p1=0&p2=35&p3=100&p4=72&p5=72&p6=81
Then I have actions like this right before I need those pulled in:
ActionScript Code:
lv = new LoadVars();lv.onLoad = function(success){if(success){p1 = this.p1;p2 = this.p2;p3 = this.p3;p4 = this.p4;p5 = this.p5;p6 = this.p6;trace(p1); //returns a zero}}lv.load("myStupidTextFile.txt");trace(p1); //returns 'undefined'
How do I get those variables to register outside of the loadVars? There has to be a way, right??!!
Scripting A TextField.property Loop--any Success?
As far as I can determine, setting TextField field properties can't be done in the same way as using setter/getter functions for, say, TextFormat objects where a property list is applied to an object with a single method.
But in trying to build something from scratch (I'm so tired of devoting dozens of lines of the same code for each textfield), I've come this far:
PHP Code:
txtFieldPropList=new Array('.background=true','.backgroundColor=0xffffff','.type="input"')
function fieldFormat(){
for(j=0;j<arguments.length;j++){
for(i=0;i<txtFieldPropList.length;i++){
field=arguments[j]+txtFieldPropList[i];
trace(field)
}//end for...i
}// end for...j
}// end fieldFormat()...
fieldFormat('progAttribs_mc.progName_tf','progAttribs_mc.progLen_tf','progAttribs_mc.progComment_tf');
...it traces out a perfectly well-formed path for an object/property, but it doesn't actually get applied to the textfield. Has anyone figured out how to do apply TextField formatting to textfields? Is this not working because of runtime issues, or am I just missing something? (And I'm NOT talking about the TextFormat object's character formatting!! That's something else entirely...)
thanks...
Anyone Success Importing Captivate 3 Projects Into Flash CS3
I ask because it seems to be impossible to use the advertised feature of importing captivate 3 into flash cs3. I ask here after already asking (and only meeting other sufferers) in the cap. 3 forum, because it's not really an EXPORT from cap. 3, but an IMPORT into flash.
Variable Scope Question With Function(success)
I'm trying to get my poor XML file to return node values to an array so that I might tween them later on. My primary concert at the moment is that I get "undefined" once attempting to trace myArray[1] supposedly after the function should have run. Yet, it appears the function runs after as my output looks like
undefined (my trace(myArray[1]))
News Item number 1 (traced values from my loop)
News Item number 2
News Item number 3
News Item number 4
My XML is simple :
<?xml version="1.0"?>
<news>
<item>News Item number 1</item>
<item>News Item number 2</item>
<item>News Item number 3</item>
<item>News Item number 4</item>
</news>
Anyone have any input? I know it's a scope issue but I'm completely fuzzy as how to figure it out.
Attach Code
var myArray = new Array();
var output_xml = new XML();
output_xml.load("test2.xml");
output_xml.ignoreWhite = true;
output_xml.onLoad = function(success) {
if (success) {
var news = this.firstChild.childNodes;
//trace(news.length);
for (var i = 0; i<news.length; i++) {
var item = news[i].firstChild;
trace(item.nodeValue);
myArray[i] = item.nodeValue;
}
//trace(textNode.item_value);
} else {
output_txt.text = "Error loading XML";
}
}
trace(myArray[1]);
Flash Login Opens New Window On Success.
Alrighty, I've got a login script that works great with HTML/PHP/CSS. However I have a login now in a flash site, so I just pass the variables to my login.php and let the php scripts do their thing, but I am getting a conflict.
When the user presses 'Submit' I need the login destination page to open in a new window...and NOT in the flash movie. Any idea how I can do this? Thanks!
|