-
Satori
Replied:
(
7/13/2004
At
8:23 PM)
I ran a little long in my article, but I wanted to explain what I meant by managing the loading of images and SWF files with the LoadVars object. In Flash MX, when you load an external image or SWF, you have no way of knowing when the image has loaded completely. The onLoad event of a MovieClip doesn’t work correctly. A simple and elegant way around this is to use the LoadVars object to load an image. Such as:
-
asdf
Replied:
(
7/14/2004
At
12:13 AM)
This sounds interesting, and I'd like to be able to utilize this technique. However,I'm not sure i correctly understand it. If the goal is to know when the image has been loaded, there are a couple problems with the implementation as stated here ...
-
nuno mira
Replied:
(
7/14/2004
At
12:21 AM)
I wasn't aware of that method to load images and movies, but it would have been useful...
-
Alexei Startsev
Replied:
(
7/14/2004
At
3:22 AM)
Thank you for your article!
-
Bob
Replied:
(
7/16/2004
At
3:02 AM)
Very helpfull article.
-
Satori
Replied:
(
7/16/2004
At
4:38 PM)
You're right, I meant "LoadMovie" not just "Load" in my comment. Checking for a change in width/height, only works if you are loading a movie once. If you are making a slide show of clips that are the same size, that doesn't work.
-
Satori
Replied:
(
7/19/2004
At
11:15 PM)
I'm not sure that I understand what you are trying to do. If you load a movie into another movie clip, it's variables will load with it. You should be able to place it on the stage anywhere you like. If you can be more specific or send me a FLA file showing my what you are trying to do, I'll try to help.
-
John Dwight
Replied:
(
7/21/2004
At
7:33 PM)
I use LoadVars to load my latest content SWFs into my index page's blank base SWF. The base SWF merely sets the frame rate, and loads the real SWF via LoadVars and a text file containing the new SWF's URL.
-
Sean
Replied:
(
7/25/2004
At
11:25 PM)
Similar to Kamal's question but more specifically:
-
Satori
Replied:
(
7/26/2004
At
12:15 AM)
I’m not sure if I understand Kamal’s question, but I’ll try to answer both questions about loading data and content at the same time.
-
VALERIO
Replied:
(
8/1/2004
At
9:41 PM)
VALERIO HUAMANI
-
Nelis
Replied:
(
8/23/2004
At
2:50 PM)
I am trying to build a chatroom in flash using PHP and maybe MySQL for the back-end... Anybody have any idea about checking for new data from database or a text file?
-
Karthikeyan
Replied:
(
5/8/2005
At
6:27 PM)
Sir,
I need to grab a dynamic image in flash from a URL "http://xxx/yyyy/zzzz.exe"( Server ) at particular position.please send the code to my mentioned mailID.Or Suggest me it's urgent.
ThankS
Karthik
-
Aaron Becker
Replied:
(
6/17/2005
At
11:17 AM)
I spent more than a day trying to find appropriate code for such a simple action. Thank you for all your help! I have several other questions that you might be able to help me with:
-Do you know how to load images into a dynamic text field?
-Do you know how to make active links within the dynamic text field?
-Do you know how to create a built-in Quicktime in a Flash doc?
Thanks again for everything,
Aaron
-
Gavin Scott
Replied:
(
8/12/2005
At
7:57 PM)
I am trying to "animate" a dynamic text field. But I loose visibility when I either skew the Movie Clip that holds it, or make the movie clip move. Do you have any suggestions?
-
Sachin Srivastava
Replied:
(
8/13/2005
At
2:51 PM)
Dear Sir
I have made one presentation in flash in which I have desined movie where I have taken 4 buttons that I want to call some differnt scene, but it doesnt work. It doesn't go to the other scene. I tried the same thing when I created a scene where I have designed 2 buttons to call different scenes but now it works. Please let me know if I can send you my movie that I'm working on.
Thnx & rgds
Sachin Srivastava
-
Greg
Replied:
(
8/29/2005
At
11:32 PM)
Hi, Satori
Is there a way to pass the name of a file to my movie, right now I have it hard coded with the name, how do I pass it name of a file instead
var quizItems=new Array();
var myData=new XML();
myData.ignoreWhite=true;
myData.onLoad=onQuizData;
myData.load("http://www.faithavenue.com/quiz.xml");
stop();
-
Satori Canton
Replied:
(
8/30/2005
At
1:52 AM)
Hi Greg,
There are a variety of ways to dynamically pass the name of the file into a flashMovie. The easiest (for me at least) is just to add is as a perameter in the object embed tag (where you embed the swf on the page). Where you declare the swf such as "myMovie.swf" you would change to "myMovie.swf?movieToLoad=myOtherMove.swf"
When the movie starts, you'll have a populated variable called movieToLoad on the _root timeline. You can then loadMovie(movieToLoad) and "myOtherMovie.swf" will load. Remember there are two declarations of the swf in the object and embed tags (so you need to make this change in both).
Alternatively you could use the variables and flashvars method described here:
-
kavitha
Replied:
(
10/12/2005
At
10:04 PM)
I need to grap files (image as well as text ) for photogallery from server as well as from own computer (any destination) i need it urgently please send me code or similar example to my email address sun_kavi17@rediffmail.com
-
mahesh
Replied:
(
10/24/2005
At
5:26 PM)
how to dynamically change swf banner
i have three files here.
i want to randomlly change this file
so, can u tell me how to do this
which script i use for this work
this is urgent
pls, reply
-
Manuel
Replied:
(
11/7/2005
At
6:38 PM)
you made my day, thank for the idea with the onData event!
greetings from germany
-
Govind
Replied:
(
11/8/2005
At
3:06 PM)
Hi,
How to send/Recive the Flash textfield values in to/from PHP?.
Below i have given given My coding. But it doesn't work.please tell me where i am wrong?
lv = new LoadVars();
lv.realname = realname.text;
lv.onLoad = function() {
var userv=lv.userval
trace(userval);
}
}
lv.sendandLoad("http://localhost/Myflash/userval.php", lv, "POST");
-
Greg
Replied:
(
11/9/2005
At
1:22 AM)
try putting quotes around your file name.
lv.realname = "realname.txt";
-
Govind
Replied:
(
11/9/2005
At
9:42 AM)
Hi,
Thanks for your reply. But it again shows error.Actually what I need is, in my flash file i have two Text Fields.
One is for giving input (username) and another one is for show a result.
When I press a button this input value should go to PHP file and check this name is exist or not. If exists “username already exists” message should show in the showmessage field, otherwise it shows message “not exist”.
Below I have given my coding,
On (press)
{
lv = new LoadVars();
lv.username = _root.username.text; // assign input value to Loadvariable
lv.onLoad = function() {
_root.showmessage.text=lv.showmessage; //return output to showmessage field
}
lv.sendandLoad("http://localhost/Myflash/userval.php", lv, "POST");
}
I have just written simple PHP coding
$passIn = "" ;
$passIn .= "&showmessage=" . “Use exists” ;
echo $passIn;
?>
Please tell me where I am wrong?.
-
shirley
Replied:
(
11/10/2005
At
10:53 PM)
hi Sartori
what about to pass some vars from an asp.file to an swf.movie?
Say I want to send my swf.movie to frame 1 or frame 2 by cliccking onto different text-links on my asp.page?
Is this a quite straightfoward process??
(So far I was only able to achieve this by using a quite complicate system of redirect files)
Thanks Shirley
-
Satori Canton
Replied:
(
11/11/2005
At
12:24 AM)
Hi Shirley,
If you wanted to change the state of a Flash movie from external links (like going from frame 1 to frame 2 by clicking on a text link in a web page), you would use JavaScript to call a function inside of your Flash movie.
If you're using Flash MX 2004, you'd be best off to use the Flash JavaScript Integration Kit - http://osflash.org/flashjs. If you're using Flash 8, you can use the new ExternalInterface object. You will find it documented in the Flash help files. A quick summary of it can be found at http://blog.deconcept.com/2005/08/16/external-interface/.
-
shirley
Replied:
(
11/11/2005
At
9:38 PM)
thanks Sartori
I found on this issue another very useful tutorial at
http://www.informit.com/guides/content.asp?g=flash&seqNum=340&rl=1
shirley
-
robin
Replied:
(
11/11/2005
At
11:56 PM)
funny -- using the faimous sentence that contains all alphabet letters: "The quick brown fox jumps over the lazy dog."
-
shirley
Replied:
(
11/16/2005
At
4:17 AM)
robin be more specific!
who is the fox
who the lazy dog
and who is
fa i mous!!!
anyway after having played around with both the integration kit and the new ExternalInterface Class I am still a bit stock. Quite a lot of limitation there. Still not so straigtfoward task to call and controll flash movies from outside; especially if your flash movie sits outside the html file hosting the javascript.
Anyway ... we will get there
we ll see
Shirley
-
David
Replied:
(
11/21/2005
At
3:22 AM)
Hello, I have a problem, both LoadVars and XML on my webpage's flash always return false when they try to load data from my webpage. I can't seem to get it to load anything from within the webpage, but it works outside a webpage in Flash Player. Any help?
-
Satori Canton
Replied:
(
11/21/2005
At
4:17 AM)
David,
It sounds like you're having a cross-domain security issue. Flash can load data across domains when running on your desktop, but when it's in a browser, the security sandbox is much tighter. Here is some info:
http://www.google.com/search?hl=en&lr=&safe=off&q=flash+cross+domain+policy&btnG=Search
If you don't have control over the remote domain, you'll need to use something to proxy the data to you (like Flash Remoting, ASP, PHP, ColdFusion, etc.)
-
David
Replied:
(
11/21/2005
At
4:41 AM)
The link didn't help much. I still only can see the loaded content inside Flash only (using Test Movie and Projector). I have control over my webserver, I am using PHP to create the XML and send it. But since that works in a Flash App, that doesn't seem like the problem. It only fails when loaded in Flash Player as a SWF or loaded as published. Im at such a loss here.
-
Satori Canton
Replied:
(
11/21/2005
At
6:53 AM)
David,
It sure sounds like a sandbox issue. If you want, contact me directly (send me your files) and I'll have a look at them.
satori@actionscript.com
-
David
Replied:
(
11/21/2005
At
8:59 AM)
I tried a few more different ways for linking the files and I got them, you were right that there was a cross-domain error. Thanks for the help.
-
Lakil ESSADY
Replied:
(
11/25/2005
At
6:22 PM)
hi,
I am trying to load imagenes of the directory and it works to me with this Array:
var img_array=["mini_0", "mini_1", "mini_2", "mini_3", "mini_4", "mini_5", "mini_6", "mini_7", "mini_8", "mini_9", "mini_10"];
but I want to know if I can put this Array in txt external and load it of this form:
vars.txt==
&img_array=mini_0", "mini_1", "mini_2", "mini_3", "mini_4", "mini_5", "mini_6", "mini_7", "mini_8", "mini_9", "mini_10"
ActionScript:
loadVariables("vars.txt", _root);
thanks!
-
Mark L
Replied:
(
11/28/2005
At
9:37 AM)
I'm not sure if this is a sandbox security or what but I can't seem to figure out why when I try to load a file (LoadVars or XML) from localhost it returns an: error loading URL. But if I paste that url in the address bar of safari or firefox it works fine. I've tried changing the settings from, Access local files only to Access network only and still same problem. Wasn't sure if this was a Mac (10.4.3) and Flash 8 issue or what. Any suggestions?
-
Mark L
Replied:
(
11/28/2005
At
7:58 PM)
Found the problem, and if you're on a Mac and run any type of firewall config tools just to make sure it's not blocking Flash making calls to http...
-
Govind
Replied:
(
11/30/2005
At
12:43 PM)
Hi,
I have done Flash panning successfully. For this i have exported movieclip on run time. Now all the images are rotating. Here my question is When i click any image I want to stop the the rotation.
Please tell me the solution..
Thanks!
-
Govind
Replied:
(
12/1/2005
At
9:59 AM)
Hi,
I have done Flash panning successfully.I have using the same code what they given in below link
http://www.kirupa.com/developer/actionscript/camera_panning.htm
under "Merry-go-round of Spinning Images"
It's running successfully. It coutinously rotating. But i want to stop the rotation when i click the Image.
i have tired so many ways to stop the rotation. But i couldn't do successfuly.
Please tell me your ideas.
Thanks!
-
alex
Replied:
(
12/5/2005
At
11:33 PM)
I am trying to use this feature in my scrolling text box, and I can't seem to get it to work. It just doesn't read the code correctly; when I export it I get the "_level0.containerMC.text1" message, which I take as meaning the script is not being read corectly. Forgive me if it is something really obvious, I am 14 and just starting out.
Thanks, Alex
-
Akhila
Replied:
(
12/7/2005
At
8:36 AM)
Dear Mr. Satori,
I have problems in the simple task of loading movie in Flash My intention is to create a picture gallery. I am not able to see the pictures on stage whne the program is tested
Can u help me plese? I am working with Max 2004
this.pathToPics = "bollywood/";
this.pArray = ["imag0.jpg", "imag1.jpg", "imag2.jpg", "imag3.jpg", "imag4.jpg", "imag5.jpg", "imag6.jpg", "imag7.jpg", "imag8.jpg", "imag9.jpg"];
this.fadeSpeed = 20;
this.pIndex = 0;
// MovieClip methods ----------------------------------
// d=direction; should 1 or -1 but can be any number
//loads an image automatically when you run animation
loadMovie(this.pathToPics+this.pArray[0], _root.photo);
MovieClip.prototype.changePhoto = function(d) {
// make sure pIndex falls within pArray.length
this.pIndex = (this.pIndex+d)%this.pArray.length;
if (this.pIndex<0) {
this.pIndex += this.pArray.length;
}
this.onEnterFrame = fadeOut;
};
MovieClip.prototype.fadeOut = function() {
if (this.photo._alpha>this.fadeSpeed) {
this.photo._alpha -= this.fadeSpeed;
} else {
this.loadPhoto();
}
};
MovieClip.prototype.loadPhoto = function() {
//specify the movieclip to load images into
var p = _root.photo;
//------------------------------------------
p._alpha = 0;
p.loadMovie(this.pathToPics+this.pArray[this.pIndex]);
this.onEnterFrame = loadMeter;
};
MovieClip.prototype.loadMeter = function() {
var i, l, t;
l = this.photo.getBytesLoaded();
t = this.photo.getBytesTotal();
if (t>0 && t == l) {
this.onEnterFrame = fadeIn;
} else {
trace(l/t);
}
};
MovieClip.prototype.fadeIn = function() {
if (this.photo._alpha<100-this.fadeSpeed) {
his.photo._alpha += this.fadeSpeed;
}
else {
this.photo._alpha = 100;
this.onEnterFrame = null;
}
};
// Actions -----------------------------------------
// these aren't necessary, just an example implementation
this.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
this.changePhoto(-1);
} else if (Key.getCode() == Key.RIGHT) {
this.changePhoto(1);
}
};
Key.addListener(this);
-
Moss
Replied:
(
12/22/2005
At
8:58 PM)
Hi,
I have created most of my website, but i am having problems when loading a game (.swf file) onto my webpage (also written in flash). How would you load an the game (.swf source from external website) into my flash document and position/size it?
-
Satori Canton
Replied:
(
12/23/2005
At
2:54 AM)
Moss,
You're probably not going to be able to load SWFs from outside of your domain unless you can set up a cross-domain security policy file on the remote server.
-
kamary cyfrowe
Replied:
(
12/29/2005
At
8:56 PM)
Very good site. You are doing great job. Please Keep it up….!
-
jeff dereszynski
Replied:
(
1/5/2006
At
6:10 PM)
Satori, awesome article.. but my problem is a little different. I have 1.swf which loads inside main.swf and in 1.swf I have a dynamic text file which pulls info from a .txt file, how can i make a link in the text file link to 2.swf and have it load in main.swf, right now it just opens in a new window
jeff
-
Satori Canton
Replied:
(
1/5/2006
At
8:13 PM)
Hi Jeff,
If you search Flash Help for asfunction, it will show you how to call a function from an HTML text link. Basically, you structure your anchor tag as <a href="asfunction:_root.myMethod">my link</a> to execute a root level function called myMethod.
**caveat: _root level functions are something you should steer away from, but for simple illustrative purposes, it's the easiest way to demonstrate the idea.
-
Maureen Feeley
Replied:
(
1/5/2006
At
8:53 PM)
Mr. Canton,
I have a flash movie that dynamically creates a drop down menu from an XML file. The buttons are very large as the menu will be used in a touch-screen application. It all works very well as long as the button is identified with text. I have now been instructed that I will need to substitute the text for images and I can't seem to get the images into the movieclip. You said it is possible to use LoadVars() to place images into textbox via XML. Can you provide an example?? If you wish I can send my .fla, .xml files for you to take a look at.
Best regards, and many thanks in advance.
-Maureen
-
Satori Canton
Replied:
(
1/5/2006
At
9:11 PM)
Hi Maureen,
You could load an image into a text field if the field is HTML enabled. If so, you can use an image tag in the HTMLText to load an image or SWF. For example:
this.createTextField("my_txt", this.getNextHighestDepth(), 10, 10, 160, 22);
my_txt.html = true;
my_txt.htmlText = "<img src='myImage.jpg' />";
-
Maureen Feeley
Replied:
(
1/5/2006
At
11:35 PM)
Mr. Canton,
Thanks for your reply to my question.
I am working in Flash MX and the textfield does not have an option I can set to enable html. Is it still possible if I set it to html in code as described in your reply? Or do I need to purchase Flash 2004 to do this?
Thanks again for the timely reply.
Best regards,
-Maureen
-
Satori Canton
Replied:
(
1/6/2006
At
2:31 AM)
Hi Maureen,
If I remember correctly, <img> tag support was implemented in Flash Player 7, so you won't be able to use this in Flash MX. The Flash MX text field can display HTML, but not this particular tag. You'll definitely be limited in your options in Flash MX.
-
Maureen Feeley
Replied:
(
1/6/2006
At
1:03 PM)
Many thanks for your reply.
Best,
-Maureen
-
Siddhartha Nihalani
Replied:
(
12/20/2006
At
11:15 AM)
i m loading external text into a dynamic text field. i need to resize the text box depending on where the user clicks.... the content, the position as well as the size of the text box change. how do i do this??? the text box is inside a movie clip. i m not able to access the text box property using
mymc.mytext._height=mymc.mytext._height + 20;
though i m able to change position by changing the movie clip x,y co ordinates....
but, if i change the movie clip height, the text shrinks or stretches... which i dont want....
can u please help....
-
narender reddy
Replied:
(
2/10/2007
At
6:06 AM)
hi
i have a problem, i want to load a .swf file on the context area when ever i select a particular option from combobox. for eg: when i select "car" option that i have to display the car movie file, and when i select aeroplane then car movie has to clear and at the same place aeroplane has to display and viceversa..
can anyone help me please.....
thank you,
-
Mike Hakak
Replied:
(
3/22/2007
At
5:11 PM)
Hello,
My mind is rattled with this problem:
there are two servers, one with a bunch of ads (jpgs, swf) on it - I call this server "A server", and the other has the application - I call this server "P Server".
I am trying to load the ads onto the application, however I am unable to do so for the swf files. It works fine for jpgs, but fails on swf files.
I thought it might be a cross domain issue, but there is a policy file on "A server". I try to load a swf ad from "A server" into level0 of the flash file on "P server" and that works, so I think the crossdomain.xml is working. Yet, when I try to load the file into a movieclip the app never completes.
here is basically the run down:
function adLoad() {
this.theAd = _level0.createEmptyMovieClip("ad"+this.myNum, this.myDepth);
var loadAdInfo = new LoadVars();
var thisobj = this;
loadAdInfo.onLoad = function(success) {
if (success) {
thisobj.url = this.url;
//I even tried to hard code the location of the file
this.theAd.loadMovie("AServer/laxit/test.swf");
} else {
thisobj.defaultAd = true;
}
}//LoadAdInfo;
System.security.allowDomain("AServer");
loadAdInfo.load(this.theAdURL);
}//adLoad
A Little explaination:
The loadVars tries to load a php call(this.theAdURL)
the php call returns the value "url=test.swf";
I don't really use this yet, but it will become neccessary later for targeting types of ads. But loadInfo.url will be test.swf just for kicks on why I am trying to load the swf from within a loadvars onLoad function.....
can you suggest some areas that I may have overlooked that may be causing this loading issue??
Kind regards,
Mike Hakak.
-
Marcus Measley
Replied:
(
3/26/2007
At
11:00 AM)
Hey there.. was so glad to find this article.. as it mentions
"The method above is only useful if you are loading multiple named variables as in:
myText=The quick brown fox&myText2=jumps over the lazy dog&myNumber=235&myBoolean=true;"
..which is exactly what i want to do. However.. I am having a hard time doing it.
I have one text field, with the instance name "DETIALS" and I am loading from an external file... which works great... if I hard code the variable that is being displayed. But, what I need to do is change the variable displayed based on userinteraction... like this..
-user chooses photo one...and text displayed as:
Photo One Details: blah blah blah
-user chooses photo two...and text displayed as:
Photo Two Details: yeah yeah yeah yeah
I have the text file set up with the variables like this example:
photo01=Photo One Details: blah blah blah
&photo02=Photo Two Details: yeah yeah yeah yeah
...make sense? I just cant seem to tell the text box to change the variable expected.
any help would be great!
Take care
-
ernie bryant
Replied:
(
4/2/2007
At
3:56 PM)
I've been working on some ASP.net sites, particularlty some MOSS 2007 sites, and i was wondering if there was a way to import the dynamic content created by MOSS into a flash menu. I've embedded flash objects in the sites before, but i've never been able to get dynamic content from MOSS to flash.
-
ola lekan
Replied:
(
5/25/2007
At
7:44 PM)
i want you to be sending actionscript and site of the week to my email.
Thanks
-
ola lekan
Replied:
(
5/25/2007
At
8:03 PM)
i want you to be sending actionscript and site of the week to my email.
Thanks