[MX04]load XML And Loop Movie
Hi, I'm trying to create a certain effect.
I was wondering if anyone had any tutorials or codes that I could use for what I'm trying to do.
I'm trying to have a video playing in the background, but able to stop the rest of the movie. And on each frame I need to load things into text fields through a .xml file.
I guess the first/most important thing would be how to get the XML loaded into the text fields.
so far I have an XML file that has fields: title info contact
and dynamic text fields
how do I get the information to load into the text fields?
FlashKit > Flash Help > Flash Newbies
Posted on: 05-31-2007, 04:26 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
[MX04] Imported SWISH Movie To Flash Doc And Only Want To Loop 1 Time Within My Movie
I have a flash movie that I am working on. This is my situation:
- I brought a movie from SWISH max to create an effect to this one tag line
- I exported that movie and imported it into a flash mx 2004 document
- When I preview it dont stop looping!
- I tried creating a setting for it on the SWISH application that says "stop playing at end of movie" but i think it overrides that once its brough over to Flash MX.
Any suggestions how I can take care of this problem withi flash? Thanks!
[MX04] Why Does A Movie Clip Sometimes Loop, Sometimes Not?
Hi, very new to flash.
I've created a movie clip of one shape tweening into another, over 1 second.
I added 'stop' Action to the last frame.
I placed this movie clip on frame 1 of my overall timeline, looks good when I test it - but when I then drag more of the same movie clip from the library and put it onto different frames, like frame 5 and 10, these ones loop over and over, while the first one doesn't.
I tried checking each one, yep the stop action is in there, same as the first. I tried putting them on different layers, tried duplicating and re-naming the library item, nup.
If I add them to the same frame as the original, this doesn't happen. But...why?
It defies logic!
Wanna punch my screen and go back to drawing flip-books.
If someone could help, that'd be sweet!
[MX04] Movie (partly Infinite Loop) As Mouseover, How?
Hello,
This is my first post here and also one of the first things I am doing in flash
I am having a hard time creating a mouseover with a movie in it... and creating the movie itself is not getting anywhere as well, as the first part of the movie is not an infinite loop and the part after is...
Here is a .gif with about what I mean.
As you can see the yellow buttons fade to red ones, this has to happen only once, but after that there will be an infinite loop with the text glowing...
When the mouseover ends it is supposed to fade back to the yellow it started with.
The sketch I did may be a bit unclear, as it's very fast, but with the explanation I provided, I think you should be able to understand me.
Thanks in advance for any help given,
Niels
Mx04: Load Movie Loads Behind My Swf?
hi i'm having a problem with a load movie command,
basically on my mainline i have this code;
stop();
_root.emptyClip.loadMovie("01a kitchens-cont.swf");
The swf is then substituted for different files when different actions are reached (a button sends them to a certain frame which then gives the above command except swapping the '.swf' to another .swf)
I assumed that by loading in a movie and then loading another one in it replaces it as i haven't set any level except some of my swf's are loading in behind some of my other swfs. anychance of some guidence?
I've included the fla!
thanks for any help!
[MX04] Load Movie Once On Many Pages
I have a flash banner and its the same banner for 3 web pages. I want the introduction to only load once and the last frames to load on click of new web links. Any ideas?
[MX04] Preloader, Then Load Movie Clips Help
I am having trouble with the actionscript here. Preloader works fine, then goes to movieclip1 (slide1) which then plays.
But then I want it to play movieclip2, which is an external mc, and then from movieclip2 (slide2) I want it to cycle back to movieclip1 and play.
Can anyone help me with this?
I'm attaching the (not completed and inserted smaller jpegs for the purpose of uploading) file here...
BIG NOTE: There's a third actionscript file you need but it won't let me upload it.
Take the code below and create a file called Preloader.as, save it to the root.
class Preloader extends MovieClip{
private var target_mc:MovieClip;
private var progress_mc:MovieClip;
private var pct_str:String;
private var dispatchEvent:Function;
public var addEventListener:Function;
public var removeEventListener:Function;
function Preloader(){
// initialize with EventDispatcher so the preloader can broadcast events
mx.events.EventDispatcher.initialize(this);
}
public function startPreload(t:MovieClip){
// set a reference to the timeline that is loading
target_mc = t;
// reveal the preloader clip
this.gotoAndPlay("IN");
}
private function onAnimateIn(){
this.stop();
// this is called from the preloader mc timeline on the last frame of the 'in' animation
// starts checking the load progress of the target movie clip on each frame
this.onEnterFrame = this.checkLoadProgress;
}
private function checkLoadProgress(){
// get the total bytes and the loaded bytes of the target clip
var bl = target_mc.getBytesLoaded();
var bt = target_mc.getBytesTotal();
// calculate the percentage of bytes loaded
var pct = bl/bt;
// get the current frame and total frames of the progress clip
var cf = progress_mc._currentframe;
var tf = progress_mc._totalframes;
// calculate the frame that corresponds with the load percentage
var f = Math.ceil(tf * pct);
// if the current frame of the progress mc is less than the value of f then let the clip play
// otherwise, stop the progress clip to wait for f to catch up with the current frame
// this prevents the animation from jumping ahead if the target clip is loading faster than
// your progress animation
if(f > cf){
progress_mc.play();
}else{
progress_mc.stop();
}
// set percent display in preloader_mc based on percentage of frames that have played
this.pct_str = (Math.round(cf/tf * 100)).toString();
// if the clip is entirely loaded, and the progress clip has played all the way through
// then the preloading is complete
if(bt > 20 && bl == bt && cf == tf && progress_mc){
onPreloadComplete();
}
}
private function onPreloadComplete(){
// stop the check load call
this.onEnterFrame = null;
// animate the preloader
this.gotoAndPlay("OUT");
}
private function onAnimateOut(){
this.stop();
// dispatch event that tells any listeners that the preloader is done
dispatchEvent({target:this, type:'onPreloaderOut'});
}
}
[MX04] Load / Unload Movie Clips
I am loading external SWFs on my main flash file.
For every External SWFs:
They also have multiple levels. There is a base SWF and then 5 levels of other external SWFs there.
So- i load an external SWF on my main flash and that external SWF also has its own external SWFs.
This is how i do that:
on my main flash file.. i create a blank MC:
this.createEmptyMovieClip("blank1", this.getNextHighestDepth());
Now, by default i load my first external MC there (ExtMC1)
_root.blank1.loadMovie("ExtMC1.swf");
Now i have a button (Button2) and when it should be clicked- it should replace ExtMC1 with ExtMC2.
_root.blank1.loadMovie("ExtMC2.swf");
This just don't work because it does replace the base file for ExtMC1 but the external SWFs within ExtMC1 remains on the main flash file..
so i use this instead:
button2.onRelease = function() {
unloadMovieNum(1);
unloadMovieNum(2);
unloadMovieNum(3);
unloadMovieNum(4);
unloadMovieNum(5);
_root.blank1.loadMovie("ExtMC2.swf");
};
so basically i clear all the levels first and then load my second MC (ExtMC2.swf).
similarly to load my third MC i use this on button 3:
button3.onRelease = function() {
unloadMovieNum(1);
unloadMovieNum(2);
unloadMovieNum(3);
unloadMovieNum(4);
unloadMovieNum(5);
_root.blank1.loadMovie("ExtMC3.swf");
};
is there any better way of doing the same- it does work but the issue is, when the first MC (ExtMC1) is loading and click on the button 2 to load the second MC (ExtMC2) - it takes a lot of time.. so i need an effective way of doing the same.. please help.
[MX04] Pre-Loader And Load Movie PROBLEM
Hello,
So i have a movie with a preloader from following this great tutorial: http://www.hypergurl.com/blog/flash/...preloader.html
I did everything right, and he did too. It's just that, my movie itself won't load. Its a quite large file, about 200 MBs on www.trixmasta.com uploaded through FTP. When I open the swf file itself on my computer it opens in a while, and streams fine. But opening through a url online, took over 10 mins still not loading the swf. By loading though a media player I created, and a "loadMovie" statement the movie would stream quite nicely in my swf media player file, only problem was that it stopped a few times to load the swf from my website. Therefore I wanted to create a pre-loader, and i did so. It worked all the way up to towards the end of the tutorial. Then it stopped working, I don't know why, and how. Thats the problem, when I 'Test Movie' it in flash, it loads but barely, plays at like 100 times slowed down. Then I tried putting this media player swf online at www.trixmasta.com and, the movie didn't load at all.
My fla is attached, and the online swf media player is:
http://www.trixmasta.com/RH%20Media%20Player.swf
and the raw file being loaded is:
http://www.trixmasta.com/How%20to%20SSH.swf (200 Mb's file, very large to load).
Load Movie But Now I Want To Go Back To Parent And Play A Frame MX04
I have three swfs:
a.. slide1.swf (parent)
b.. slideshow2.swf
c.. namemov.swf (the logo I want to appear after the slideshow plays)
On slide1.swf I have a preloader, then it has part of a slideshow. Then I
load slideshow2.swf. That plays. Now, on slideshow2.swf's last frame, I want
it to go to slide1.swf and play frame "name". At which point I want
slideshow2.swf to play and loop while namemov.swf is loaded on a higher
level.
Final result is you see a slideshow, then the name appears while the second
part of the slideshow loops underneath it.
I have been trying, and trying, and trying to do this but every time I get
to slideshow2.swf it just loops in on itself.
PLEASE, PLEASE HELP... : (
[MX04] Load Movie Clip...wait...load Another Movie Clip
ok...i'd like to do this all in actionscript if possible...on one frame.
one character (headshot). at timed intervals, the character would do something different...repeat.
[code]function antics() {
mc_Antics.start(0,0);
clearInterval(anticstime);
}
anticstime= setInterval(antics, 1000);
function antics2() {
mc_Antics2.start(0,0);
clearInterval(anticstime2);
}
anticstime2= setInterval(antics2, 2000);[code]
I don't know actionscript well at all, so is this just stupid? Any ideas on how to do this? It's not working right now...
[F8] Movie Load Loop
Hello,
Is there a way you can load a (CS3) movie from flash 8 without it looping?
I have been having this issue. Everytime I load a movie that was published with ActionScript 3, my movie would loop and not stop. I have setup the stop at the end of the timeline but to no avail. If I change the publish settings to to ActionScript 2 it will work fine but it has to be in AS3 as I have got a new form running in it.
Here's the code:
stop();
loadMovie("sections/contact.swf", "loadcontact");
can anyone help?
thanks
Loop Movie, But Load XML Once
Background:
I am tasked with building a vertical news scroller that reads from an xml file and loops indefinitely.
Problem 1:
I have figured out how to scroll static text and I am now working on loading the xml which I also have done. The problem I am having with loading the xml is that if the movie loops, it is loading the XML each instance of the loop. How can I load the XML only on the initial load and still loop the movie?
Problem 2:
When working with static text, scrolling is simply a matter of doing a motion tween. When working with XML, the data will not be a fixed length, so doing a motion tween will have 2 problems. First, the original text object will have a fixed height which will either have blank space when the XML returns less than enough to fill it, or will have hidden text when the XML returns more that it can hold. Can I dynamically adjust the height of a text object to fit the text that has been put into it? Once I figure out how to dynamically change the height we have the second problem. If the tween was built to scroll 10 records over 200 frames and the XML now returns 100 records, the scroll will be 10 times too fast. Can I dynamically adjust how many frames the tween will operate over?
Loop Movie, But Load XML Once...and More
Background:
I am tasked with building a vertical news scroller that reads from an xml file and loops indefinitely.
Problem 1:
I have figured out how to scroll static text and I am now working on loading the xml which I also have done. The problem I am having with loading the xml is that if the movie loops, it is loading the XML each instance of the loop. How can I load the XML only on the initial load and still loop the movie?
Problem 2:
When working with static text, scrolling is simply a matter of doing a motion tween. When working with XML, the data will not be a fixed length, so doing a motion tween will have 2 problems. First, the original text object will have a fixed height which will either have blank space when the XML returns less than enough to fill it, or will have hidden text when the XML returns more that it can hold. Can I dynamically adjust the height of a text object to fit the text that has been put into it? Once I figure out how to dynamically change the height we have the second problem. If the tween was built to scroll 10 records over 200 frames and the XML now returns 100 records, the scroll will be 10 times too fast. Can I dynamically adjust how many frames the tween will operate over?
Disable Loop On Movie Load
At the end of my introduction, I call the next clip, which contians my main site with:
Code:
loadMovieNum("second.swf", 0);
My problem is that the loaded clip contantly loops. I tried
Code:
stop;
and
Code:
loop=false;
Nothing works..I tried it on both the intro and second movie.
How can I stop this endless loop of the second clip?
Thanks!
Load 5 Seperate .swfs Into A Movie By Using A For Loop
Hi i want to Load 5 seperate .swfs into a movie by using a single for loop.
Ideally i was looking for a script that refurred to a folder which you could put as many .swfs into as you wanted and they would all be loaded into a single movie at random locations on the screen but i realise this would involve lots of hard coding and i am not sure who would be willing to help me but i thought i would give it a try
Alan
[MX04] Loop Loop Whoops
Hi,
I know this might be really simple but I'm having a problem with my movie continuing to loop even though I've put the stop() function anywhere and everywhere I can think of. Basically, I have some mc's in Frame 1 which perform some calculations in AS. At the end of one of the calculations, I have _root.gotoAndStop(2) (which I'm assuming is telling the playhead to move on to the next frame in the main timeline).
I've put in key frames in the second frame for the same mc's to perform some different calculations which are dependent on variables from Frame 1's calculations. After running through the calculations, the movie won't stop looping and I can't figure out why.
Can anyone suggest a course of action? Thanks in advance.
Movie Takes Forever To Load With Sound Loop
I made a movie. it loads fine unitl I add the sound loop. The movie is 369 KB the sound loop is 256 KB. Anyone tell me why this is pls. Here is the URL
http://www.fcflashesfreshmanfootball...shesintro.html
[MX04] Loop Mp3?
Hi,
I have a mc named LoopSound_mc and some buttons on the same timeline .
if I use this code attached to LoopSound_mc to load an MP3 into my movie
Code:
onClipEvent(load){
var mySound:Sound = new Sound(this);
mySound.onLoad = function(success:Boolean){
if(success){mySound.start(0,999);}
}
mySound.loadSound("China.mp3", false);
how can I make a button stop JUST mySound
how can I make a button load a new mp3 into mySound
oh the new mp3 still should loop
thanks, mark
[MX04] Help With For Loop
hi, hope you can help me with this,
I'm just practicing the "for" loop, I have a button on stage, and everytime I click on it it supposed to change the array number, but I'm struggling
here is the code;
var nameTitle:Number = 0;
var nameList:Array = new Array("name0", "name1", "name2", "name3", "name4");
showname.text = nameList[nameTitle];
button.onRelease = function() {
for (nameTitle=0; nameTitle<nameList.length-1; ) {
nameTitle++;
}
showname.text = nameList[nameTitle];
};
but it doesnt work ?
--------------------------------------------
thanks in advance.
[MX04] Loop
Hi
I am trying to create a game simular to Tic Tac Toe.
To do this i am going to make it so when you click one of the squares the var number is added too eg.
PHP Code:
on(release){ _root.myVar.+=1; }
and then i would use
PHP Code:
if(myVar == 1;){//do whatever }
But for that too work it would have to go on the next frame. And I would want it to work all on one frame. So i need to know how to loop it so it checks every second or whatever. Can some1 help or if that wouldnt work tell me what i would need to do thanks.
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
[MX04] Please Help Loop Problem
Hi,
I have a looping problem with my movie. I am performing some calculations in 2 different frames and when it gets to the 2nd frame the movie won't stop looping. I have no clue what or why its doing that. I've tried putting the stop() function everywhere but nothing works. This is very urgent so any help will be appreciated!
I've attached the file with this post.
Thanks,
DeMarhc
[MX04] For Loop Trouble... Please Help.
hello everyone.
(please excuse my english)
im writing the codes of a dinamic page display of comments section, on wich page i have 10 coments on each page. the initial part goes all right. but when i press the buttom to the link of the final page it just doesnt show anything. can you please take a look on my code:
Code:
stop();
traedata = new LoadVars();
traedata.load("http://www.marttells.com/swf/comentarios.php");
traedata.onLoad = function(success){
currentcuadro="cuadro2";
total = traedata.registros;
totalpag = traedata.registros/10;
redondo = int(totalpag);
decimal = totalpag - redondo;
if(decimal > 0){
totalpag = int(totalpag+1);
}
if(decimal < 0){
totalpag = redondo;
}
_root.conte.attachMovie("vacio","empty",10003);
cordenadax = 4.3;
cordenaday = 5.2;
_root.conte.empty._x = cordenadax;
_root.conte.empty._y = cordenaday;
if(total < 10 && total !== undefined){
for(n=0; n<total; n++){
if(currentcuadro=="cuadro1"){
currentcuadro="cuadro2";
}else{
currentcuadro="cuadro1";
}
_root.conte.empty.attachMovie(currentcuadro,"coment"+n,100+n);
_root.conte.empty["coment"+n]._y = _root.conte.empty["coment"+n]._y + (_root.conte.empty["coment"+n]._height * n);
_root.conte.empty["coment"+n].aut.text = traedata["autor"+n]+":";
_root.conte.empty["coment"+n].coment.text = traedata["comentario"+n];
_root.conte.empty["coment"+n].fecha.text = traedata["fecha"+n];
}
}
if(total >= 10 && total !== undefined){
for(o=0; o<10; o++){
if(currentcuadro=="cuadro1"){
currentcuadro="cuadro2";
}else{
currentcuadro="cuadro1";
}
_root.conte.empty.attachMovie(currentcuadro,"coment"+o,100+o);
_root.conte.empty["coment"+o]._y = _root.conte.empty["coment"+o]._y + (_root.conte.empty["coment"+o]._height * o);
_root.conte.empty["coment"+o].aut.text = (traedata["autor"+o])+":";
_root.conte.empty["coment"+o].coment.text = traedata["comentario"+o];
_root.conte.empty["coment"+o].fecha.text = traedata["fecha"+o];
}
}
ultimosdatos = (total - (totalpag * 10));
if(ultimosdatos < 0){
ultimosdatos *= -1;
}if(ultimosdatos > 0){
ultimosdatos = 10 - ultimosdatos;
}if(ultimosdatos == 0){
ultimosdatos = 10;
}
ultimoboton = totalpag - 1;
for(i=0; i<totalpag; i++){
_root.paginas.attachMovie("pag","pagi"+i,20+i);
_root.paginas["pagi"+i].nopag.text = i+1;
anchopaginas = _root.paginas["pagi"+i]._width * totalpag;
_root.paginas["pagi"+i]._x = _root.paginas["pagi"+i]._x - anchopaginas + (_root.paginas["pagi"+i]._width * i);
_root.paginas["pagi"+i].iniciofor = (_root.paginas["pagi"+i].nopag.text * 10)-10;
_root.paginas["pagi"+i].finalfor = _root.paginas["pagi"+i].iniciofor + 10;
if(i !== ultimoboton){
_root.paginas["pagi"+i].onPress = function(){
_root.conte.empty.removeMovieClip();
_root.conte.attachMovie("vacio","empty",10001);
_root.conte.empty._x = cordenadax;
_root.conte.empty._y = cordenaday;
for(p=this.iniciofor; p<this.finalfor; p++){
if(currentcuadro=="cuadro1"){
currentcuadro="cuadro2";
}else{
currentcuadro="cuadro1";
}
_root.conte.empty.attachMovie(currentcuadro,"coment"+p,500+p);
_root.conte.empty["coment"+p]._y = _root.conte.empty["coment"+p]._y + (_root.conte.empty["coment"+p]._height * p);
_root.conte.empty["coment"+p].aut.text = traedata["autor"+p]+":";
_root.conte.empty["coment"+p].coment.text = traedata["comentario"+p];
_root.conte.empty["coment"+p].fecha.text = traedata["fecha"+p];
}
}
}
//*************** TROUBLE PART **************************
if(i == ultimoboton){
_root.paginas["pagi"+ultimoboton].onPress = function(){
_root.conte.empty.removeMovieClip();
_root.conte.attachMovie("vacio","empty",10005);
_root.conte.empty._x = cordenadax;
_root.conte.empty._y = cordenaday;
for(m=this.iniciofor; m<total; m++){
if(currentcuadro=="cuadro1"){
currentcuadro="cuadro2";
}else{
currentcuadro="cuadro1";
}
_root.conte.empty.attachMovie(currentcuadro,"coment"+m,1000+m);
_root.conte.empty["coment"+m]._y = _root.conte.empty["coment"+m]._y + (_root.conte.empty["coment"+m]._height * m);
_root.conte.empty["coment"+m].aut.text = traedata["autor"+m]+":";
_root.conte.empty["coment"+m].coment.text = traedata["comentario"+m];
_root.conte.empty["coment"+m].fecha.text = traedata["fecha"+m];
}
}
}
}
}
is that i cannot have two for loops on the same statement? please help...
[MX04] Onpress Within Loop? Heeelp
Hey everyone
Can't figure this out:
Code:
for (i = 0; i < 5; i++)
{
this["button"+i].onPress = function()
{
trace(i);
}
}
The problem is, that all the button traces 5 - offcourse because the variable i is 5 at the end of the for-loop. But I want all of the buttons to trace their respective loopnumber???
[MX04] Another For Loop Which Doesn't Work
Hallo,
I'm trying to write an attach - remove mc piece within a for loop, and after a lot of puzzlement I've found that at least part of my troubles are due to the fact that something like this, (see code below) does not work.
>>>>>>>>>>>>>>>>>>>>>>>
for (i=0; i<10; i++) {
var vf = 10 + i;
_root.attachMovie("filter_v", "filter_v", 100+i);
_root.filter_v._x = 300 + 10 * i;
_root.filter_v._y = 400 - 10 * i;
trace (vf + " vf");
_root.filter_v.onLoad = function()
{
trace(vf + " vf in onload");
_root.filter_v.gotoAndStop(vf);
_root.filter_v.removeMovieClip();
}
}
I see all traces outside the function, and then, inside the onLoad function, just the last one, once (see the traces below). The mc I'm attaching is just a square running over a vertical band, and if the remove line is commented it appears, just once, in the last position of the loop,, and stopped as required. But whether or not the remove line is kept, nevertheless some instances of the mc are displayed, all in (0,0) and running. I know there are more than one band in the same position because the vertical band has alpha = 15.
Can anyone help, please?
The traces are:
10 vf
11 vf
12 vf
13 vf
14 vf
15 vf
16 vf
17 vf
18 vf
19 vf
19 vf in onload
Thanks,
graechus
[MX04] Create Array In Loop
On the root of my project I have an array '_root.artistList'. This array lists the names of several text files that are essentially arrays themselves. I would like to gather one of the variables from each of these text files and put it into a new array. I am having trouble figuring out how to get the array to populate. It seems to be recreating the array through each iteration of the loop. Maybe its a variable scope thing? I'm a bit green in this area. Here's the code, running in a MC on the main time line.
Code:
var titleList:Array = new Array(); // create a new array to store the art titles
varReceiver = new LoadVars(); // create an object to store the variables
for (i in _root.artistList) {
varReceiver.load("art/" + _root.artistList[i] + ".txt"); // load the variables from the text file
varReceiver.onLoad = function(){ // trigger something - when the variables finish loading
trace(this.title); //shows the correct value each time
titleList[i] = this.title; // add this title to the array
};
}
trace(titleList); // shows nothing
[MX04] How Do You Loop Individual Layers?
I have three layers that all have different frame rates. I want to be able to loop the faster layer while the slower layers catch up. Is this possible?
Right now all the layers run together and the faster layer stops running until the slower ones are done.....
[MX04] Motion Tween Loop
hi i was wondering if there is a way to loop a motion tween or put a motion tween in a movieclip and loop that. if anyone could tell me how that would be great.
Thanks in advance
[MX04] Stupid FOR LOOP Question.
Hello everyone.
i know it sounds stupid, but i want to ask:
i got a movieclip inserted on my main time line called "paginas", and i added the following:
Code:
for (i = 0; i < anynumber; i++){
var myPagi = _root.paginas.attachMovie("pag", "pagi" + i, 20 + i);
}
The question is, how can i then remove the content of "paginas" with actionscript to start this same process again.
please help
[MX04] Loop Not Looping Correctly...
Hi,
I am using the code below to load images onto the stage of my MX200 project...
It's variables load fine into the loadVars object and the loop runs fine to a point. I just added images named MyImg14, 15 and 16, all sized to 640 by 460, which I'd expect to fill the last row of the stage. These last 3 don't appear.
Can anyone see why they wouldn't?
Ta..
PHP Code:
myVars = new LoadVars();
myVars.load("TotalImages.txt");
myVars.onLoad = function(){
var TotImgs=number(myVars.TotMyImgs);
//Calculate number of images per row.
if(Math.floor(Math.sqrt(TotImgs))==Math.sqrt(TotImgs)) {
RowTotal=Math.sqrt(TotImgs);
} else {
RowTotal=Math.ceil(Math.sqrt(TotImgs));
}
//Calculate scaling factor, image width and height.
ScaleFactor=(640/RowTotal)/6.4;
ImgWidth=640*(ScaleFactor/100);
ImgHeight=460*(ScaleFactor/100);
//Initialise positioning variables.
XPos=0;
YPos=0;
RowCount=0;
for (var ImgLoop=0;ImgLoop!=TotImgs; ImgLoop++){
if(RowCount==RowTotal) {
YPos=YPos+ImgHeight;
XPos=0;
RowCount=0;
}
XPos=RowCount*ImgWidth;
ImgNum=ImgLoop+1;
refClip = _root.createEmptyMovieClip("ImageHolder"+ImgLoop, Imgloop);
refClip.loadMovie("MyImg"+ImgNum+".jpg");
refClip._xscale=ScaleFactor;
refClip._yscale=ScaleFactor;
refClip._x=XPos;
refClip._y=YPos;
RowCount++;
}
};
[MX04] How Do I Remove An MC Generated With A Loop When A Condition Is Met?
Hey gang,
I've created a loop that generates some MC instances and sets them playing within a random grid. The MC has another MC within it with an instance name of "dropMC" that is tweened.
I need for the generated MC to be removed when the "dropMC" instance reaches the _y coordiate of 500 on the main movie. I thought I wrote the script correctly, but it's not working. Can anyone tell me what I'm missing?
code: condensation = function () {
var condensationNum = Math.round(Math.random()*4)+1;
for (i=0; i<condensationNum; i++) {
attachMovie("drops", "dupMC"+i, i);
_root["dupMC"+i]._x = Math.round(Math.random()*200)+500;
_root["dupMC"+i]._y = Math.round(Math.random()*155)+195;
var scale = Math.round(Math.random()*50)+50;
_root["dupMC"+i]._xscale = scale;
_root["dupMC"+i]._yscale = scale;
}
this.onEnterFrame = function() {
if (_root["dupMC"+i].dropMC._y == 500) {
removeMovieClip(_root["dupMC"+i]);
}
};
};
Any help is most appreciated!
-Sandy
[MX04] Comparing Array Data -spiral Loop Of Code
Hi Guys and Girls,
Say I have an array [loadlist] with 7 empty entries in it. I am trying to generate a random sequence of numbers 0-7 and entering it, but no doubling up on any of the numbers.
Code:
for(k=0;k<7;k++){
//generate random number
randomnumber=Math.round(Math.random()*7)
//check aganst existing entries in loadlist array
for (i=0;i<7;i++){
//if match found
if(loadlist[i]==randomnumber){
...and this is where I can't comprehend what's next. What's the code for repeating all of the above again (as many times as it takes!) until it finds the correct number?
Code:
}
}
}
If I have gone about this in the first place, which I am starting to suspect, can someone please point me in the right direction? Also if this question belongs on the newbies page please let me know.
Thanks,
[MX04] Simple For Loop, And Button Movement Wont Work
This is so weird....the loop of MC's I have arent being detected...I'll show you what I mean...
I have a flash file attached here.
I have a little game. When you rollover any of the buttons, they're supposed to become invisible and add a point to a variable. And when the variable equals 80, you win.
Basically this makes it so, when the user moves their mouse over the picture (eating the pizza) it also looks like they are eating the pizza.
The code for my loop is here: (and can be found on the first frame of my file)
PHP Code:
stop();
numPizza = 80;
function hitPizza() {
for (var n = 0; n<=numPizza; n++) {
pizza = "pi"+ n;
_root.pizza.onRollOver = function() {
trace("hit");
_root.pizza._alpha = 0;
_root.pizza._x = 1000;
_root.eat_pizza += 1;
};
}
}
this.onEnterFrame = function() {
hitPizza();
};
I dont know what went wrong in the code, I've checked it multiple times. And if this code doesnt seem to be helpfull to fix the problem, please check out the file attached.
oh yah, my test buttons are called 'pi1' 'pi2' 'pi3', etc...
Make One Element Loop Without Making Enitre Movie Loop?
i'm trying to make one element continue looping without making the entire movie loop... here's what i mean..
i have a layer that i've name actions which i've asigned a stop(); to at the end of the animation. but i want the red pulsating dot to continue looping/ animating ... to give you an even better idea, here's the swf file...
http://www.push1.com/roster_art_gal.swf
cheers!
[MX04] Load Swf Into MC Of Other Swf
I know this fairly simple request but im a noob and not sure whats going wrong.
I basically want a button on SWF A to Load Swf B onto an MC/ Frame on the Main swf.
I can tell the button to jump to a target frame on the main swf tried but cant get the other swf to load
on(release){
_level0.gotoAndPlay("target1");
loadMovie ("carlisle2.swf", "container");
}
I then tried laoding it into an MC called container on the timeline of main SWF
container.loadmovie("my.swf")
that didnt work either.
Any suggetions, ahvnt been able to come up with anything. Thanks
[MX04] How .. .. To Load A Clip
Hi,
one funny problem; i know how to load external swf, but don't know how to load internal movie clip.
Say, i have a movie clip 'mainBttns' in the library, and have an empty loader clip 'loader_mb' created somewhere on the stage, with the instance name 'loader_mb' as well.
What ActionScript should i add to a button, to load (play) this 'mainBttns' clip?
And also what AS to unload this clip out of that spot, when some another clip should jump in?
Many thanks
[MX04] Can't Load XML In A Class
Flash MX 2004 Pro (mac)
ActionScript 2
I'm trying to generate a bar graph from an xml file. I have an empty movie clip with an AS class name of "BarGraph". The idea is for this class to parse the XML and then use attachMovie to add instances to the stage. I'm able to add the instances ok, but for some reason the xml fails to load, so I just get 5 bars on the stage that have no data passed to them, so they do not resize appropriately.
Here's the code from the BarMovie.as file:
(NOTE: the parsing is a bit convoluted due to the format of the file I'm using, but I have verified that it works when plased in yhe AS for frame 1 of the movie)
code:
class BarGraph extends MovieClip {
private var barConstructorParameters:Object;
private var value:Number;
private var numBars:Number = 5;
private var leftEdge:Number = 50;
private var rightEdge:Number = 500;
private var chartWidth:Number = rightEdge - leftEdge;
private var FMPFlash_xml:XML;
private var chartData:Array = new Array();
private var chartLabel:Array = new Array();
private function BarGraph() {
//load and parse the XML file
loadXML();
//add a new bar for data set
for (var i = 0; i < numBars; i++) {
attachMovie("bar","bar" + i, i).barInit(i, chartData[i]);
}
}
public function loadXML():Void {
FMPFlash_xml.ignoreWhite = true;
//setup load handler to invoke parsing function
FMPFlash_xml.onLoad = function (success) {
trace("success");
if (success) {
processData(FMPFlash_xml);
}
}
// load the xml file
FMPFlash_xml.load("filemakerFlash.xml");
}
// parsing function
public function processData(xmlDoc_xml) {
for (var i = 0; i < numBars; i++) {
chartLabel[i] = xmlDoc_xml.firstChild.childNodes[3].childNodes[i].attributes.NAME;
chartData[i] = xmlDoc_xml.firstChild.childNodes[4].firstChild.childNodes[i].firstChild.firstChild.nodeValue;
trace("data = " + chartData[i]);
}
}
}
[MX04] Silent URL Load
hello all
I've made a flash page and I want when a user view my flash a url loads in the flash silently
i've tryed getURL method but when the URL loads in the flash the page changes but I don't want the page change .think I want to log user IP by loading a php or sth like that.
- I don't want to use iframe outside of the flash like getURL("http://myurl","htmlframe");
- I don't want to to solve it in html codes (OUT of the flash).
I just want the url loads silently in the flash.
Please Please help me
Thanks
[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
[MX04] External .jpg Load And Fade...
I have been using Flash for little while and am fairly confident in most things I have to accomplish visually. When it comes to action scripting though, I am pretty much lost.
I work for a small newspaper in Washington. I made this little "order photos" button that resides in a gutter of our site.
(http://www.kitsapsun.com - Right hand side, halfway down, on the blue rail)
My goal, is to be able to create a folder on our server that the photo journalists can simply drop in their six or seven photos into it and have the .swf just calling it's photos from this folder.
I *believe* this is possible, but I can't seem to find a tutorial that will help me fgure out the solution.
Any help would be greatly appreciated!
[MX04] Interrupting The Load Of A Soundclip
I'm working with non-streamed MP3s but this question applies to any external assets...I'm creating a photo album with soundclips that play with each photo...as the user navigates to the next photo, a new non-streamed MP3 loads up. I'm having a problem when the user navigates too fast, or switches to a thumbnail gallery (which, in actionscript, stops all sounds from playing, but not necessarily loading)...Anyway, things get all gummed up and unpredictable. Is there a command I could call that would halt the loading of a sound file that's currently in the pipe?
[MX04] Load Data From An External Jsp
[MX04] external xml wont load
If I have the xml load directly from the flash (ie, I have it go directly to the site, instead of through 'proxy.php'), it will load the data from the xml, but when I have it go through a php script, nothing shows up, the text field is completely blank, it doesnt even say "Couldn't Load".
here is my flash file script:
Code:
Code:
xmlGetBtn.onRelease = function(){
var xmlProxy:XML = new XML();
xmlProxy.ignoreWhite = true;
xmlProxy.onLoad = function(bSuccess:Boolean):Void {
if(bSuccess) {
xmlDataBox.text = this;
}
else {
xmlDataBox = "Couldn't Load";
}
};
xmlProxy.load("Proxy.php")
}
and the php script looks like:
PHP Code:
PHP Code:
<?php
$dataURL = "http://www.w3schools.com/xml/simple.xml";
echo readfile($dataURL);
?>
I have tried every tutorial and script I could find, but nothing seems to work.
Also, is it possible to load external data into flash from a .jsp?
Thanks alot if anyone can help me try to solve this problem.
[MX04] XML: I Just Want To Load ONE Image With ONE Caption.
I've found tons of slideshows (and successfully created them!) so I don't know what I'm doing wrong! I just want this file to import ONE image with ONE title and caption into a flash file.
XML:
<daTextBox>
<daTitle><p class="title">COLOR</p></daTitle>
<daContent><p class="content">The less color a diamond has, the more valuable it is. Diamonds are graded on a scale from D (colorless) to Z (light yellow).</p></daContent>
<daPic>graphics/cut.gif</daPic>
</daTextBox>
Actionscript: (or maybe it would be easier if someone suggested how they would do it in SIMPLY!)
Actionscript starts and then...//load in XML
daTextBoxContent = new XML();
daTextBoxContent.ignoreWhite = true;
daTextBoxContent.load("cut.xml");
daTextBoxContent.onLoad = function(success) {
if (success) {
daXMLTitle = this.firstChild.childNodes[0].childNodes;
daXMLContent = this.firstChild.childNodes[1].childNodes;
daXMLPic = this.firstChild.childNodes[2].childNodes;
//load css
var format = new TextField.StyleSheet();
var path = "flash.css";
format.load(path);
format.onLoad = function(success) {
if (success) {
//set the style sheets
daClip.containerMC.daContent.styleSheet = format;
daClip.containerMC.daTitle.styleSheet = format;
//assign the appropriate text and image
daClip.containerMC.daContent.text = daXMLContent;
daClip.containerMC.daTitle.text = daXMLTitle;
daClip.containerMC.daPic.image = daXMLPic;
} else {
daClip.containerMC.daContent.text = "Error loading CSS file!";
}blah blah blah on the rest of the code...
[MX04] Load SWF Files But They Don't Work
Hey guys I'm pretty new to flash.
My problem is this - I have loaded external swf files into my main timeline using the following code -
on (release) { this.box.loadMovie("ElliesMatchingGame.swf", 1);
}
The movie loads (images etc) but the coding doesn't seem to work. The external swf is using simple coding as well, just drag and drop MCs-
on(press) {
mysound = new Sound();
mysound.attachSound("blue");
mysound.start();
startDrag(this);
_root.answer1="";
}
on(release) {
stopDrag();
if (this._droptarget == "/blue") {
_root.answer1="Correct";
_root.answer2 = "";
_root.allCorrect +=1;
gotoAndPlay(2);
}
else{
_root.answer2 = "wrong";
_root.answer1 = "";
gotoAndPlay(3);
}
}
I'm sure i'm doing something really simple wrong! But can anyone help?
[MX04] Load Library Images
I really dont know to much flash but I need a way to load images that are inside the library on demand. Lets say I have three area (I dont know how to make) I want to look in a xml file (I can do that much) read it to tell what images should go into what boxes. I can do this using external jpgs but I want the images to be inside the library how can I do that?
[MX04] Load MC Into MC (stage Instances)
Is anyone familiar with a way in which to load an MC (background) on the stage, into another MC (backgroundHolder) on the stage?
Normally I'd use a linkage identifier, however in this instance I want a large MC asset to load at a particular point in the movie rather than export it in the first frame. I figured that one of the following methods should work, but sadly not ...
_root.backgroundHolder.attachMovie("background");
_root.backgroundHolder.loadMovie("background","bac kground",1);
I'd really appreciate anyone with a working method.
[mx04] External Xml Wont Load
First of all, I'd like to say sorry for posting this more than once in a different thread.
If I have the xml load directly from the flash (ie, I have it go directly to the site, instead of through 'proxy.php'), it will load the data from the xml, but when I have it go through a php script, nothing shows up, the text file is completely blank, it doesnt even say "Couldn't Load".
here is my flash file script:
Code:
xmlGetBtn.onRelease = function(){
var xmlProxy:XML = new XML();
xmlProxy.ignoreWhite = true;
xmlProxy.onLoad = function(bSuccess:Boolean):Void {
if(bSuccess) {
xmlDataBox.text = this;
}
else {
xmlDataBox = "Couldn't Load";
}
};
xmlProxy.load("Proxy.php")
}
and the php script looks like:
PHP Code:
<?php$dataURL = "http://www.w3schools.com/xml/simple.xml";echo readfile($dataURL);?>
I have tried every tutorial and script I could find, but nothing seems to work.
Also, is it possible to load external data into flash from a .jsp?
Thanks alot if anyone can help me try to solve this problem.
Movie Clips In For Loop Onlydisplaying In 1st Loop
Hi there! I'm new at this so excuse if I'm being stupid.
I'm creating a game which I'm looping through an array and inside the loop I'm playing clips. The clips display only the first time the loop is being run. Here is the actionscript. PLEASE SOMEONE HELP ME... I'M DESPERATE!!!
code:
on (release) {
var myClips = new Array("Fletter", "Lletter", "Aletter", "Mletter", "Eletter");
var myClipsNewName = new Array("mov2", "mov3", "mov4", "mov5", "mov6");
var myClipsValue = new Array (10, 11, 12, 13, 14);
var cnt = 0;
for (var t = 0; t<4; t++) {
for (var i = 0; i if (cnt == -1) {
cnt = 0;
}
var temp = myClips[cnt];
attachMovie(myClips[cnt],myClipsNewName[cnt], myClipsValue[cnt]);
updateAfterEvent();
trace(myClips[cnt]);
if (i == Total-1) {
myClips.splice(cnt, 1);
myClipsNewName.splice(cnt,1);
myClipsValue.splice(cnt,1);
if (cnt == myClips.length) {
cnt = 0;
}
break;
}
cnt = cnt+1;
if (cnt == myClips.length) {
cnt = 0;
}
}
}
}
edit: jbum added as tags
[MX04] DESPERATE External Xml Wont Load
If I have the xml load directly from the flash (ie, I have it go directly to the site, instead of through 'proxy.php'), it will load the data from the xml, but when I have it go through a php script, nothing shows up, the text field is completely blank, it doesnt even say "Couldn't Load".
here is my flash file script:
Code:
Code:
xmlGetBtn.onRelease = function(){
var xmlProxy:XML = new XML();
xmlProxy.ignoreWhite = true;
xmlProxy.onLoad = function(bSuccess:Boolean):Void {
if(bSuccess) {
xmlDataBox.text = this;
}
else {
xmlDataBox = "Couldn't Load";
}
};
xmlProxy.load("Proxy.php")
}
and the php script looks like:
PHP Code:
PHP Code:
<?php
$dataURL = "http://www.w3schools.com/xml/simple.xml";
echo readfile($dataURL);
?>
I have tried every tutorial and script I could find, but nothing seems to work.
Also, is it possible to load external data into flash from a .jsp?
Thanks alot if anyone can help me try to solve this problem.
|