Waiting Untill Loaded
Hi,
I am loading a XML text file in to a variable:
ActionScript Code: var TreeData:XML = new XML; var xmlString:URLRequest = new URLRequest("TreeData.xml"); var xmlLoader:URLLoader = new URLLoader(xmlString); xmlLoader.addEventListener(ProgressEvent.PROGRESS,showProg); xmlLoader.addEventListener(Event.COMPLETE,initData); function showProg(evt:Event):void { trace("In Prog"); } function initData(evt:Event):void { trace("TreeData XML Load complete"); TreeData = XML(xmlLoader.data); trace("TreeData trace = "+TreeData.toXMLString()); //var numOfCategories:Number = TreeData.Category.length(); //var CategoryArrays:Array = new Array(numOfCategories); }
After this code I have some code that uses the XML data. How do I make the program pause untill the XML file has loaded in to the variable and just then continuing with all the rest?
Thanks, Guy
ActionScript.org Forums > ActionScript Forums Group > ActionScript 3.0
Posted on: 05-30-2008, 03:08 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Nothing Loading Untill The Audio Has Loaded.
i'm having trouble with my audio player. it's not letting anything else load until it's finnished loading. can flash only load one thing at a time? i've not had any troubles with it before and i've just been re-cycling old code from other sites i've done. you can veiw the site here: http://discochimp.com/disco2-2/
this is the code to load the audio thats encapsulated in a swf:
Code:
_root.container.unloadMovie()
_root.createEmptyMovieClip("container", 1);
loadMovie("audio.swf", "container");
container._x = 5 ;
container._y = 55 ;
_root.eq1.gotoAndStop(1);
_root.disc.gotoAndStop(2);
this is the code to load the movieclips:
Code:
on (release) {
loadMovie("home.swf", "contents");
loadMovie("homegraff.swf", "_root.image");
_root.title.text = "Welcome to discochimp.com"
}
cheers in advance for any help on this.
DC.
Pre Loader Doesnt Display Untill 60% Loaded
Hi all
Relative newbie here. Can't figure this out my preloader doesn't display until about 60% loaded?
Heres the A.S.
Any ideas?
Thanks Bill
stop();
textVar = "..::LOADING::..";
loaderInt = setInterval (Lbar,10) ;
function Lbar () {
percentInst.text = Math.round(getBytesLoaded()/getBytesTotal()*100) + "%";
if (getBytesLoaded() >= getBytesTotal()) {
play();
textInst._visible = false;
fill_MC._visible = false;
strokeMC._visible = false;
percentInst._visible = false;
clearInterval (loaderInt);
}
fill_MC._xscale =(getBytesLoaded ()/getBytesTotal ()*100);
}
Need A Code To Delay An MC From Loading Untill Previous MC Is Loaded
Is there any way to put a delay tag in between this code just so that the user can see the unload?
What happens is that it happens all together so the user cannot see the effect
on (release) {
_root.placeholder2.gotoAndPlay("Out");
_root.placeholder2.loadMovie("services.swf");
}
Thanks
Waiting Until All Images Are Loaded
Hello,
I have a function where I load multiple images using the Loader class and load() method. I don't want the function to exit until all the images have been loaded, or I want a way to know when all the images are loaded. Unfortunately, the load() method retuns immediately, and you have to use an event listener in order to know when an object has completely loaded (using contentLoaderInfo.addEventListener(Event.COMPLETE, func)). Is there a good way to do this?
Thanks.
[MX] Preloading Images Or Waiting Until Loaded Before Continuing.
I have 2 questions and was wondering if any of you helpful bods would be able to answer them.
1) Is there a way to pre-load images for use in an MC?
I have project that takes user input, uses this to fill an array with http address of a bunch of images. It then cycles through the images, loading them into my MC which I've set to fade in, wait a few seconds then fade out. The images are just flashing up, which I think is due to the MC fading in but not waiting for the image to be loaded into the MC first.
2) Is there benefit or requirement to unload an image from an MC?
This is after the MC has been faded out, the Actionscript loads the the next image from the array into the MC before going back and fading back in again. I'm not sure if this is relevant, just thought I saw somewhere, an unloadMovie command.
Waiting For Data To Be Loaded Before Firing Function
Help, I'm having a hard time, sorting this online.
On the first (and only frame) of my movie the following code exists
Code:
introCopy = new LoadVars();
introCopy.load("test.txt");
introCopy.onLoad = function() {
CaseHeading.text = introCopy.heading;
CaseBody.htmlText = introCopy.contents;
};
function PicGall() {
numMenuItems = introCopy.no;
i = 1;
addItemInterval = setInterval(addNextItem, 5000);
// increase number to increase pause.
}
function addNextItem() {
loadMovie(("Images/"+_level0.ButTopic+" "+_level0.ButCop+"/"+i+".jpg"), "PicHolder");
trace("Images/"+_level0.ButTopic+" "+_level0.ButCop+"/"+i+".jpg");
trace("this is no:"+introCopy.no);
if (++i == numMenuItems) {
i = 1;
//loops, otherwise use clearInterval(addItemInterval);
}
}
PicGall();
//this calls the function
Now I know somehow I've got to get PicGall to only run when it nows the info is loaded.
How would I ask it to check if that variable (which is one of the first variables in the text file) has loaded?
Is there a way without a clipEvent or anything like that?
Waiting For Externally Loaded Jpeg To Load Before Proceeding
Hi,
I am externally loading a jpeg to my flash movie. However, I need the movie to wait till the picture is loaded before moving on. I know this can be easily done but I'm not sure of the code. I got this so far:
loadMovieNum("pic url", 2);
Thanks,
Scott
Loaded Movie Still Causes "Waiting For Mydomain.com" Or "Transferring Data From..."
I'm using loadMovie to load a remote SWF (which is just an SWF movie like an FLV movie with no code in it). The SWF is being served up by a php page using readfile. I've tried setting the html header type as both
application/x-shockwave-flash
and
application/octet-stream
but in all browsers the parent Flash player seems to be causing the browser to keep waiting for more information ("Waiting for..." in IE and "Transferring data from..." in Firefox). How can I make it so that the loadMovie process completes successfully and the browsers stop looking for data?
Play Untill
Hi there,
A question... is it possible to do the following?
We have two flash movies in two different frames (take a look at neutral.mrmedia.nl) if you press "assortiment" at the menu the movie assortiment (left corner) should start (this of course happens). As soon as you press one of the underlying products (e.g. wasmiddelen), the movie assortiment should fluently go to the section wasmiddelen. We are already able to send a command from the menu.swf to the assortiment.swf. Problem is that assortiment.swf is not built with actionscript. It has different lables for every product.
Question: Is there a function like Play (from current frame) untill you reach the lable. In case of the former situation... play from the current frame till you reach the label wasmiddelen. Can someone tell me how to work around this problem?
Regards,
Jurgen
It All Worked Fine Untill
I am using swish lite and have created a little intro
www.uspfilms.com/wargames.swf
but when it loads everything it is meant to type on screen is all garbled ?? and the sound dosn't play!?
any suggestions?
Robbie
Mc Play Untill Finished
Hello,
I've made a button with a mc on it, so when i get over it with the mouse it plays the movieclip. But it plays as long as the mouse is on the button. But i wanna have it play till the movieclip is on his end. So the movieclip must not stop when the mouse isn't on the button pls help me.
I´ve looked at the rollOn an the rollOff things but i cant get wise out of it...
Besides I cant for some strange reason put a fla or a zip file as an attachment. (sorry for my bad english)
Greets Error
Combo Box Won't Close Untill
i have several combo boxes all are movie clips with different names. i have them physically on the stage..and coded inside main action script starting in first frame of level 1.
_root.memselect.setChangeHandler("toggleMemorials");
function toggleMemorials() {
if (_root.memselect.getValue() == "AA005") {
_root.designtext_mc.carvetext2.text = "AA005 7 x 10.5";
_root.carvetext.text = "AA005 7 x 10.5";
unloadMovie(_root.display);
loadMovie("AA005-CM.swf", _root.display);
} else if (_root.memselect.getValue() == "AA007") {
_root.designtext_mc.carvetext2.text = "AA007 4.25 x 6";
_root.carvetext.text = "AA007 4.25 x 6";
unloadMovie(_root.display);
loadMovie("AA007-CM.swf", _root.display);
i have several els if statements .. ending with
a last else if statement and close correctly
the drop down box stays open i click the first several selections and it doesn't close unless i click the part of the box where it shows what has been selected. after all those i click a certain one and it will work normally.. all the statements are identical copy and paste and change selection statement to coincide with the value being entered. does n e one know what could cause this problem. it works on other movies i have done but not this one or one other;). the statements do run correctly . just will not close. thanks for the help.;)
Sway
Preload Not Visible Untill 98% ?
Hi all
Im attemting to preload amovie which is 590k - not massive. I have a preload on the first frame. Flash doesnt seem to display anything ont he stage untill it has loaded 97/98%? Got any ideas?
TIA
Repeat If-action Untill True?
Hey,
This prob is a stupid question, but is there a way to repeat an if-action untill it's statement is true?
I need this cuz I'm making a modified version of a SnakeGame and I need to know if I can place the food where there is no wall or something, this is the code:
code:
j = random(10);
i = random(10);
if(map[j][i] == 1){
placeFood();
} else {
j = random(10);
i = random(10);
//this is where it should repeat...
}
Hope I made myself clear,
SaphuA
Preloader NOT Showing Untill Nearly Complete.
hi all,
I have what it looks like a minor problem with my preloader....
I have a news.swf that implements a preloader with the following action script on the second frame:
stop();
// this will be called when the preloader finishes animating out
function onPreloaderOut(){
preloader_mc.removeEventListener("onPreloaderOut", this);
gotoAndPlay("SITE");
}
// add this timeline as a listener to listen for the 'onPreloaderOut' event
preloader_mc.addEventListener("onPreloaderOut", this);
// tell the preloader to start preloading this timeline
preloader_mc.startPreload(this);
I also have a preloader.as file that does all the work for the preloading.
My problemm is that beacause I inherited this class file I am not 100% sure how it works.
Right now, when it downloads the swf movie it doesn not show the preloader at all until about 80-90% download. the problem with this is that it doesn't tell the user that the movie is been downloaded therefore forcing the user to cancel.
it needs to display loading from 0%.
files are attched.
you help is appreciated.
unisa
My Preload Screen Is Black Untill 70%?
Hello,
I'm very frustrated. I have a series of flash movies that load in movie clip (using the loadmovie funciton into an empty mc).
In the past, I've never had a problem with this -- I click on a button to load the next movie, and you see the next pre-loader.
Now, I get a black screen that doesn't show the preloader screen untill it's at at least 70-75% loaded??
Can anyone help me out?
Thanks so much!
-AX1
Load FLV, But Not Untill Button Is Pressed
Hi I have a movie which is about 250KB, but when I integrate my FLV movie (which is to be played ONLY IF a button is pressed) its about 1,3 MB.
My question is then, is it possible to load the movie externally from my server when the button is pressed (and how?) - so my original movie load quickly but the FLV only loads IF the button is pressed?
How do I load a FLV (or a new SWF) into the main timeline of my main movie?
Cheers, will appreciate ANY help.
Mads
[F8] Waint Untill OnCLipEvent Has Finished?
Hi I'm making a childrens game where you throw mudd arround.
Now I throw the mudd - and when I insert the MC displaying the mudd I have an onClipEvent on it.
Now on my main timeline i want to calculate the coordinate of the mudds impact (when the onClipEvent has finished) - I dont know if it's possible to do a wait untill onClipEvent finished, then give me the coordinates of the mudd.
I get the coordinates of when I release the throw of the mudd, not the actual impact?
Anyone now how to wait for the onClipEvent to finish - Then run ie. function CalculateImpact();
Cheers,
Mads
Play Untill Frame Lable
I have a movie clip called colour. In the movie clip there are several layers with differnt graphic symbols that alpha fade in and out. I have 4 buttons for, 1 for each colour and what I want them to do is to make the movie play untill it reaches a frame lable.
For example.
The user clicks the blue button, the colour movie clip plays through the red and green and stops on the lable BLUE. then the user clicks green, the movie clip plays through blue and red stoping on the lable GREEN.
Does anyone know how to actionscript those buttons so that they stop on the corresponding lables? Or even what wording i should use to search google?
thanks in advance
Will
Buttons Hang Untill Mousemove
whats up with that?
i noticed this before on one of them old type scrollbar components
but now i have a button that needs to be repeatedly clicked and now its happening on there too
after 1 click the button doesnt listen anymore it seems untill mouse has moved
any solution or workaround for this?
Button Dont' Work Untill Press F5
hi guys~
thanx for you kindly help guys!!!
i have just made this website for myself!! i have a button, once clicked it tells a movie that sits inside the scene to play!!
when i am testing it in flash player everything works perfectly fine!!! but somehow when i upload it onto the web, the button don't work, unless you press F5 to fresh the whole website!!!(wired!!) anyone know why that occurrs???
thanx again!!
Jason
Movie Stops Untill Button Get Clicked
Hello,
I once saw (I ever do not remember what Flash it was) you can make a frame stop till a button get clicked.
Can somebody explain me how to make that?
Tnx & greetz,
Big_Boss_Man
Help With Random Images So None Repeat Untill All Have Shown
Hi, I was wondering if anyone can help me with this problem.
I using the following script to randomly attach Movie clips to a empty mc;
//
clipNum = Math.floor((Math.random()*99)+1);
//
name = "img"+clipNum;
//
imageholder.attachMovie("img"+clipNum, name, 1);
I'd like to show all the photos before any of them repeat, (in other words all the photos play only once and only get repeat once all of the 99 fotos have been seen).
I've seen the script using the 'splice' method but I can't get it to work;
nums = new Array();
for (i=0;i<5 - 1;i++) {
nums[i] = i;
} //make an array we'll use for our random numbers
rand = nums.splice(random(nums.length),1)[0]; // gets a random number
//but splice also erases that number from the array so it can't be used again
//then attach that movie
_root.attachMovie("img" + rand, "img1" + rand, rand + 100);
Does anyone have any ideas?
Thanks,
Lenny.
How To Stop The Timeline Untill Swf Fully Downloaded?
im trying to hold my timeline untill my splash swf is fully downloaded in the main.swf by
stop();
myMCL.loadClip("splash.swf", 4);
How can i do this and then get the timeline to play when it is fully loaded.
i have tried using a trigger file where it fully downloads everything in the splash.swf library but when it meets the key frame in the timeline for the splash.swf it downloads it again?
any help would be very grateful
baz
[MX04] AS1.0 - Hiding The Scrollbar Untill Needed
Hi,
I have a dynamic text field that loads text from an external .txt file. I have attached the scrollbar component to that text field. Is there a way to hide the scrollbar untill the text is overflowing and the scrollbar is needed?
This is a Flash UI Component Set 2 scrollbar and I am exporting in AS1.0.
Thanks in advance.
Mike
[MX04] AS1.0 - Hiding The Scrollbar Untill Needed
Hi,
I have a dynamic text field that loads text from an external .txt file. I have attached the scrollbar component to that text field. Is there a way to hide the scrollbar untill the text is overflowing and the scrollbar is needed?
This is a Flash UI Component Set 2 scrollbar and I am exporting in AS1.0.
Thanks in advance.
Mike
Load Movie Wont Work Untill The Second Time....
heres the site i'm working on-
http://home.mchsi.com/~cinumann/
when you go to the pertfolio, and click on one of the links, it is supposed to load a seperate swf with pics and a description in it, but instead it only loads bits and peices of it, and you have to go back and click a second time to get it to load properly...
anyone know what the problem could be?
Cant Interact With Any Flash Website Untill I Click Page
I noticed today that every flash site i have been on when the site intially loads it has a outlined border and the whole swf in the page is clickable.
Once clicked everything is ok, but i need to click the page first before i can interact with the content. This is everything from small flash banners to fully fledged flash sites. Has anyone else came across this today?
Cant Interact With Any Flash Website Untill I Click Page
I noticed today that every flash site i have been on when the site intially loads it has a outlined border and the whole swf in the page is clickable.
Once clicked everything is ok, but i need to click the page first before i can interact with the content. This is everything from small flash banners to fully fledged flash sites. Has anyone else came across this today?
Dynamic Controlling Xml Untill Data Loads Comlple
Hello everybody
i am here with a problem it is when i am loading xml locally it works fine but when i put it on server i am unable to control flash movie until the xml file get fully loaded.so what should i do to know wheather the data is fully loaded or not.
I know there is a method xml.onData but how to apply it dont know exactly
Thanks in advance
[MX04] Drawing A Line At A Certain Angle Untill It Hits A Wall
ok, i am making a top down game and when the player shoots a gun i want there to be a line drawn coming from him and it should stop being drawn when the line touches a wall
eg: if the player is right next to the wall the line will be very short if he shoots at the wall, but if he shoots the other direction then the line will be very long before it hits the other wall...
i thought about doing this by sending out an invisible probe mc that moves in the angle untill it hits a wall and then drawing a line from the player to the probebut that would use a lot of processing power if there could be a player and up to 20 enemies shooting machine guns which fire extremely fast... major hit on performance...
i just need the code that draws a single straight line that stops when it hits a wall with an instance name of wall, but i can't just put the walls on the top layer and hope they cover any excess line up, bcause there could be a wall in the middle of the map...
any help?
How Can I Make Images Not Load Untill The Page They Are On Is Visited In Flash Movie?
Hey guys,
I have a question... for a website Im making, the whole site is a single flash movie--for this reason, everything in my site loads at the same time. All the images on all the different pages have to load at the beggining of the movie, since the whole movie is loaded at once. I was wondering how I can make it so images (etc) only load when the page they are on is visited. Thanks for the help.
Waiting
Hi,
Can anyone tell me if there's a way of making the movie stop for some time and then keep going without adding extra frames???
Thanks
Waiting
When a button is pressed, is there a way to wait a few seconds before a command is executed?
Waiting A Second
I have a small if statement within a normal program. Seeing as the if statment is within an MC it is evaluated 18 times a second(I think). While the rest of the script follows this normal guideline, what I would like is for once this If statement has been evaluated as true and the action carried out, for it not to be allowed to happen again for the duration of 2 seconds.
Is this possible? If so how would someone go about it?
Thanks for your time.
As3 Waiting
I am needing to wait about 30 seconds at the end of a time line, and then play again from a selected frame. Any one have any idea how to do this?
In Flash cs3 using Actionscript 3.
thanks,
IET
Waiting For Variables
i am loading variables from an asp file and need flash to wait till they are loaded to use them.
this in itself is not too hard, but i need to do it all in one frame:
load variables;
wait till loaded;
use variable;
see?
i have tried do while statements that are supposed to wait for a "check" variable to = something, but they just loop infinitely.
anyone here know if this can work, or does every thing else stop loading during the loop?
thanks,
later
Waiting For Sounds
Hi!
I have a Problem! I have a Flash with animation and sound. Ok - thats no Problem - but I need a perfect timing for sound and animations! I jump to a keyframe and play it. The keyframe contains a sound and an animation. 200 Frames later I must jump to the next Keyframe - wich contains again sounds and animation.
When someone looks this Flash with a fast PC, the sounds overlaps.
I need a function to wait for the sound. I couldn't stop the sound because there is a voice - not a loop!
Have someone a idea?
Greetz bOOt
P.S.: Sorry 4 my bad english!
Waiting For Variables...
Hello everybody
Can anyone tell me if there's a way to delay the playhead in a MC untill external text files has been FULLY loaded. I'd very much like to do it without using the onClipEvent (data) script. I'm thinking there must be some sort of "if" statement that can do this.
BTW, I'm using Flash 5...
Waiting For Help And No Answer
Hi..
I have a problem with the fscommand (exec,)
But I think that it will be better to tell you what I doing exactly so you can give me the right answer for my problem..
1- I use flash mx
2- I designed some kind of tourist guide which will be published on cd
3- I have 3 main .fla
- Presentation .fla
- Menu .fla
- 3 items each one in a separate .fla
I converted the presentation .fla to presentation.exe and the rest of the .fla to .swf
Until now every thing goes fine and all the files can call each other
But..
I decided to convert the rest of the SwF (menu.swf and the 3 items) to .exe files
Why?
1- to protect the swf files from importing or downloading from the cd – I know that even the protected swf could be cracked and I spend hours in this project – and the exe files will be more difficult to expand it.
2- To avoid any Possibility that the swf will not work – I know that the flash projector works even there is no flash player on the computer.
3- I think it looks more professional to use the projector files – I tried to convert all the swf to the macromedia director but it failed.
So where is the problem??
1- I put at the last frame of the presentation .fla the fscommand (“exec”, “menu.exe”)
I made a folder and I named it fscommand and I put on it the menu .exe
When the presentation.exe arrive to the last frame the menu .exe opens in another flash player and I want it to replace the presentation.exe flash player as we can say on 0 level.
2- where I put the 3 items .exe ? if you call them from the menu.exe with the fscommand (“exec”,..)
I must put the three exe files inside another fscommand file and how you will call the menu from any item using the fscommand (“exec”,..) ?
Main folder
| --- presentation.exe
| --- fscommand folder ( which contains )
| ----1- menu.exe
| --- 2- fscommand folder ( which contains )
| --- 1- item1.exe
| --- 2- item2.exe
| --- 3- item3.exe
I am waiting for your advice
Thank you
Client Is Waiting HELP
OK, I created a slideshow for a client, and when he views it, the slideshow freezes at the same point each time. However, when I view it, (and any one else I've sent the link to) it works fine, what might the problem be????
Waiting Before An Action....
Is there a way in actionscripting to wait a certain amount of time before performing an action? For example, I want it so that when a button is pressed, it waits 5 seconds and THEN goes to a certain frame - is this possible? Thanks!....
Oh yeah - and I'm using MX...
Waiting For Movieclip
Hello Everyone,
I'm having a minor problem and was wondering if anyone can point me in the right direction.
Basically, I have a movie setup, so that when a button is clicked, and animation happens - then some invisible objects become visible.
The code I'm trying is:
box_bg.gotoAndPlay("maximize");
txtNote._visible = true;
box_scroll_up._visible = true;
box_scroll_down._visible = true;
The problem is that the other objects are become visible before the animation is done (its only a short 5 frame animation).
Is there anyway to make flash wait?
Thanks
James
Waiting Your Oppinion...
I wait for your oppinion regarding this site...
www.flamingoboys.ro
suggestion and critics are welcome...
thank you
Valeriu
Waiting Within A Script
i have a few hyperlink buttons that link to other pages the hit state has sound file attached but when i click the button the page is loaded before the sound has chance to play, so i was wondering if there is a way to pause a script for x number of seconds
Waiting For An Interval
When calling an interval in this manner:
code: fadeInt2 = setInterval(fadeClipOut,50,progBarHolder_mc.load2) ;
I want to wait for the interval to complete before executing the next line of as:
code: progBarHolder_mc.load2.progBar_text_loaded = text
How do I wait for the Interval to finish?
Thanks
EDIT: or even add a simple delay in code like: code: fadeInt2 = setInterval(fadeClipOut,50,progBarHolder_mc.load2) ;
waitFor(300) //how long to wait in ms for next line of code
progBarHolder_mc.load2.progBar_text_loaded = text
|