ActionScript 2.0 :: Looping Functions, It Just Skips To The Last Instance
Jul 2, 2008
I am using Actionscript and the problem I am having is the I am running a for loop to execute a function which loads the variables from XML and then another function to load an external SWF which will load the variables from the first function. Here is the code snippet
for(i=0;i<2;i++) {
createproduct();
displayproduct();
}
Currently, createproduct will create a series of arrays with the new data. The displayproduct() function pushes the data out into a image loader. However, my guess is that the loop is executed so quickly, that the data becomes the last instance in the for loop and therefore displays the same(last instance) data for both displayproduct function. Is there any way to have a function wait till the previous function completes? That way when I fun the script, it will show up 2 instances of the image loader with the appropriate data.
View 3 Replies
Similar Posts:
Mar 30, 2009
I thought looping through functions would be pretty easy but i've been working on it for some time now and haven't managed to make it work.What i wanna do is:1) Run function 12) After 40 secs run function 23) After 80 secs run function 34) After 120 secs run function 45) After 160 secs run function 1 again6) Back to step 2Maybe i confused you with these steps, what i mean is i wanna run a function and wait 40 secs before running the next.And basically i want this to go on forever. I've tried some stuff with setTimeout and setInterval, maybe i used them in a wrong way, but as i said i didn't manage to make it work.
View 2 Replies
Jun 22, 2009
Like I said in the title. I want to loop my background/a single element, while my people can click on the nav bar and look at stuff on the website.I attached what i was working on. The headphones will be fading in and out between a few different pairs. Mean while I need the nav bar fuctional and not changing besides when they click.
View 3 Replies
Jun 17, 2009
this a sample code that im currently using...but i need to find a way do this long script, as simple as possible...
[Code]...
different buttons have different functions, so how can i add the functions by looping them?
View 2 Replies
Sep 11, 2009
For accessing the variables later on, i need to set the var of a looping instance outside of the looping function. I've tried get but it still loop once.
Code:
private var menuTitle:TextField=new TextField();
public function titles():void {
for (i; i<4; i++) {
[Code]....
View 5 Replies
Dec 3, 2007
When I want to loop through instance names like: "tile1", "tile2" etc. I use a code like this:
PHP Code:
for(var i=0;i<=10;i++){
this["tile"+i]._x=300;}
But when I put these MC's inside an MC (which I've named: "ground") for some reason this code:
PHP Code:
for(var i=0;i<=10;i++){
_root.ground.this["tile"+i]._x=300;}
doesn't work. Is there a way to loop through all the objects inside a movieclip without giving each one an instance name?
View 4 Replies
Oct 19, 2005
im trying to use a function in a timeline to identify a symbol and do some stuff with it.
on the movie clip
onClipEvent (load) {
_root.test(_name);
}
[Code]....
i've tried some different things, such as eval, but can't get anything to work.
View 1 Replies
Jan 15, 2009
Im new to AS3.[code]I have above code in a movieclip which i have Exported as a Class.But when i run it says "Constructor functions must be instance methods".
View 4 Replies
Jun 14, 2009
I'm using flash and the error message "Constructor functions must be instance methods." appears for the following code:
invsibleBtn.addEventListener(MouseEvent.CLICK,onClick);
function onClick(event:MouseEvent):void { navigateToURL(new URLRequest [URL]New to action script coding.
View 13 Replies
Jul 20, 2010
I am trying to link buttons in Flash to placeholders on the time line, but keep getting this error message, any ideas what it means
View 2 Replies
Jun 24, 2010
I keep getting that error when i try to compile and the only script I have in it is this:
[Code]...
View 6 Replies
Jul 18, 2010
I am follwoing a tutorial on linda.com about creating a website in Flash everything was going well until i started trying to copy the action script in the online examples now I keep getting this error message and can't figure out how to get rid of it:
[Code]...
View 7 Replies
Jan 18, 2011
I have a 6 frame .swf that is for some reason jumping to the 3rd frame upon loading. This problem occurs in every browser except IE. I'm using AS2. This is the actionscript for the first frame:
stop();
var SKUName = _root.SKUName;
var ProductImage = _root.ProductImage;
var ProductPrice = _root.ProductPrice;
[Code]....
The 6th frame just contains a stop(); action.
View 2 Replies
Sep 6, 2011
I have a flash movie. There is a timeline and a frame with some code.The problem is that Flash skips this frame with code sometimes. It does this absolutely randomly. It can loop 100 times and skip it on 101st. It can skip it on 3rd run.I'm using AS3, always put all the code in separate file. But what should one do if he needs to put EventDispatcher into one of the frames, for example? There is no guaranty that the code will be run.
View 1 Replies
May 9, 2009
This is a bit of an odd-ball problem. I've created a website 524 frames long, but am creating the pre-load bar *after* the website is done. I could move all the frames a few over, but this would require remapping all my many, many buttons. What I've done then, is told Frame 1 to go to Frame 525, and put the preloader there. I should note the site works perfectly without the pre-loader, I just want it to be smooth once it makes it online.The following code is being used for the first frame (frame 525) of the pre-loader:
bytes_loaded = Math.round(this.getBytesLoaded());bytes_total = Math.round(this.getBytesTotal());getPercent = bytes_loaded/bytes_total;this.loadBar._width = getPercent*100;this.loadText = Math.round(getPercent*100)+"%";if (bytes_loaded ==
[code].....
View 3 Replies
Dec 29, 2010
I have a slide show that works totally fine when it's on my machine, however, once it's published to web, instead of having a smooth transition between External SWFs, it skips and shows white background with loader for a sec.. Not only when it's loading first time, but all the time.Here's the code:
package [code]............
View 2 Replies
Oct 8, 2010
I have 3 scenes.
Scene 1 is a sitelock scene. If true goto scene 3 and stop. Else goto scene 2 and stop.
The good: It works and goes to scene 3.
The bad. It loads everything on scene 2 and then goes to scene 3 with player 10.
Every object created with actionscript on scene 2 is created on scene 3.
View 2 Replies
Jan 29, 2006
I'm trying to use the tutorial found here: url...for my site. I always thought that this tutorial looked easy and recommended it to many friends. But now that I'm using it myself it seems to jump to 7% and go from there.
View 2 Replies
May 9, 2007
I've built a preloader that works fine locally, when downloading files from the web address supplied. But when I post it live, the preloader shows a frame of 100% then shows the image before it has fully loaded. It 'pops' in. The link to the 'faulty' site is [URL]
The preloader code I am using for each quadrant is:
[Code].....
View 2 Replies
May 26, 2011
When my streaming videos start they will buffer and begin to play as normal. However, as soon as the vid starts buffering again a problem arises. Basically what is happening is that Flash is buffering the video to a certain point, but instead of resuming playback from the point where the vid paused it now jumps instantly to the end of the newly buffered area without playing the vid portion in between. Which essentially means that it skips merrily through the video and never stops buffering.
View 3 Replies
Oct 9, 2009
So, this is a copy of another post I made, but I get a sneaking suspicion I put the post in the wrong forum:[URL]..The summary:
The Socket class in flash player sometimes, for some users (across all sorts of OS and Browsers) will not ask for the policy file from port 843 first, but instead will go straight to the port of the outgoing request, which in this case is our game server, who doesn't really understand the request.
In every case so far the user *is* using the latest version of flash too, so it's not an issue without outdated policy methods, which would have been my first guess.For most people it works just fine, but I posted a log in the thread for one of the non-working players. It's pretty mysterious, and I haven't found a fix yet... though I'm going to experiment with some work arounds.
View 5 Replies
May 26, 2011
When my streaming videos start they will buffer and begin to play as normal. However, as soon as the vid starts buffering again a problem arises. Basically what is happening is that Flash is buffering the video to a certain point, but instead of resuming playback from the point where the vid paused it now jumps instantly to the end of the newly buffered area without playing the vid portion in between. Which essentially means that it skips merrily through the video and never stops buffering. That said i'd prefer to get to the root of the prob, particularly if this is a codec/keyframe issue, since i could then re-export the vids appropriately.
View 2 Replies
Nov 10, 2011
I'm doing a very simple interactive screens. The timeline has 5 frames, each one with some MovieClips with "onRelease" events associated and some animations... very simple.
I'm publishing it has FP7 & AS2 (mandatory)
Surprisingly everything went fine from start to finnish, even on testing.
But when I was delivering this test version, something weird happened. I have Chrome by default has my browser, and I also tested with Firefox. On these two it works fine. The problem is when you test on IE.
In this browser the SWF skips to the second frame and stops when it loads, acting normal again. I can go back to the first frame and everything looks good.
At the beggining of each frame I have a stop(), and there's no other gotoAndStop events unless on buttons, nothing is triggered by actionscript.
I had the 10.2.159.1 version and upgraded to 11.0.1.152 (the latest)... the problem persists.
Meanwhile a simple timeout seems on 1st frame seems to solve the problem, but I wonder if this is a bug with AS2 on Flash Player specially on IE?
View 4 Replies
May 26, 2011
I am pretty new to scripting and Flash and streaming vid is proving a massive headache at the mo. Have bashed through most of my problems but this one has got me stumped, scripting skills not up to the task. When my streaming videos start they will buffer and begin to play as normal. However, as soon as the vid starts buffering again a problem arises. Basically what is happening is that Flash is buffering the video to a certain point, but instead of resuming playback from the point where the vid paused it now jumps instantly to the end of the newly buffered area without playing the vid portion in between. Which essentially means that it skips merrily through the video and never stops buffering. That said I'd prefer to get to the root of the prob, particularly if this is a codec/keyframe issue, since I could then re-export the vids appropriately. I am using mpg4 (.mov) with H264 compression and keyframes at 1 sec intervals.
View 2 Replies
Oct 6, 2009
Users are also given a set of thumbnails for extra feedback and navigation (here's what I currently have: As you can see, I have a button on my main stage named "portfolio". It has a simple "on (release)" function that goes to frame 2 (frame 2 is when my artwork portfolio displays).I have some code placed on frame 2, in a separate "actions" layer(very simple stuff):
stop();
onEnterFrame=function() {
_root.thumb_movie.gotoAndPlay("book");
[code]......
View 1 Replies
Mar 20, 2009
Does creating a new instance of an Object that uses an identical name to an older instance, delete the previous instance? Or should the original instance be deleted first? The code uses a ridiculous amount of XML vars. Isn't it less memory intensive to parse the XML and save the properties to an Object, and then delete the XML Object, rather than keep the XML Object around and reference it's child nodes directly? Is it better form to break up a huge XML file (>600lines/3200vars) into smaller chunks?
View 1 Replies
Jul 27, 2010
what are the best settings to export .mov file? I have 1280x720 movie and I can export it no problem but sometimes it skips or gets stuck when I play it. I'm not sure if it's my video card or the actual file. I was using the H.264 setting and compressor quality best.
View 1 Replies
Apr 12, 2011
We are running FMS 4.0 to stream on-demand MBR videos using the OSMF player. We have noticed that occasionally during playback the video freezes, while the audio skips back a few seconds and starts playing. Once the audio catches up, the video unfreezes and resumes normal playback.
View 2 Replies
May 16, 2010
I am building an interactive portfolio in flash using actionscript 3 and I have inserted an swf file of a project I have completed in the past. My problem is that for some reason when I preview the portfolio and select the game it simply skips through every screen as though not registering its actionscript. The project is also in actionscript 3 if that matters.
View 1 Replies
Mar 9, 2009
I have a page which has an intro animation which lasts 314 frames and finishes with a button. When you click the button it takes you to a separate html page with a scrolling photogallery. When I click the 'back' button in the photogallery it takes me back to the first html page with the intro animation.
How do I make sure that when I click the back button it skips the first 314 frames (bearing in mind I am returning from a separate html page)?
View 4 Replies