Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash








SetInterval Accurate?


Last edited by DeeLight : 2002-12-06 at 17:48.
























I'm having problems with setting the interval for a function........

Im using this to synchronize two soundobjects. The sound objects are exactly the same length in milliseconds.

First I get the duration of one of the loops. Then I set to interval for the function that starts the second loop exactly to the loop length.
But it doesnt seem to be stable........... sometimes it times it correctly sometimes it's a bit off.

Here's my code:
-----------------------------------------------

s1 = new Sound(this);
s1.attachSound("loop1");
s2 = new Sound(this);
s2.attachSound("loop2");
loopLength = s1.duration;
s1.start(0, 999);
// doSyncStart function
function doSyncStart() {
if (syncStart == true) {
s2.start(0, 999);
syncStart = false;
}
}
setInterval(doSyncStart, loopLength);

-----------------------------------------------
I use a button to set the variable "syncStart" to true.

If anyone can give me some insight as to why this is so inaccurate or maybe a way to optimize the code, it would be greatly appreciated

P.S. I've tried the highest movie fps rates but it didnt make much of a difference




Ultrashock Forums > Flash > ActionScript
Posted on: 2002-12-06


View Complete Forum Thread with Replies

Sponsored Links:

SetInterval Accurate?
I'm having problems with setting the interval for a function........

Im using this to synchronize two soundobjects. The sound objects are exactly the same length in milliseconds.

First I get the duration of one of the loops. Then I set to interval for the function that starts the second loop exactly to the loop length.
But it doesnt seem to be stable........... sometimes it times it correctly sometimes it's a bit off.

Here's my code:

Code:
s1 = new Sound(this);
s1.attachSound("loop1");
s2 = new Sound(this);
s2.attachSound("loop2");
loopLength = s1.duration;
s1.start(0, 999);
// doSyncStart function
function doSyncStart() {
if (syncStart == true) {
s2.start(0, 999);
syncStart = false;
}
}
setInterval(doSyncStart, loopLength);
I use a button to set the variable "syncStart" to true.

If anyone can give me some insight as to why this is so inaccurate or maybe a way to optimize the code, it would be greatly appreciated

P.S. I've tried the highest movie fps rates but it didnt make much of a difference

View Replies !    View Related
SetInterval Accurate?
I'm having problems with setting the interval for a function........

Im using this to synchronize two soundobjects. The sound objects are exactly the same length in milliseconds.

First I get the duration of one of the loops. Then I set to interval for the function that starts the second loop exactly to the loop length.
But it doesnt seem to be stable........... sometimes it times it correctly sometimes it's a bit off.

Here's my code:

Code:
s1 = new Sound(this);
s1.attachSound("loop1");
s2 = new Sound(this);
s2.attachSound("loop2");
loopLength = s1.duration;
s1.start(0, 999);
// doSyncStart function
function doSyncStart() {
if (syncStart == true) {
s2.start(0, 999);
syncStart = false;
}
}
setInterval(doSyncStart, loopLength);

I use a button to set the variable "syncStart" to true.

If anyone can give me some insight as to why this is so inaccurate or maybe a way to optimize the code, it would be greatly appreciated

P.S. I've tried the highest movie fps rates but it didnt make much of a difference

View Replies !    View Related
SetInterval Not Accurate Enough
I am coding a metronome for drummers. I need to call a function accuractly within 100 ms or less. There is a slight stutter when producing a beat every time with a milliseconds this low. I'm not sure if the mp3 file is causing the stutter. Is there anyway I can eliminate this? When is trace simple output text, I can't tell if its accurate or not to see if the mp3 is the problem.

Any ideas?

Thanks for your time!

View Replies !    View Related
Custom Objects And Internal SetInterval Loops -> A Problem Stopping The SetInterval
Let's say I had a class like this:


PHP Code:



var someVar = new Widget();

function Widget() {
    // Some variables, etc...
    this.int_someCommand = 0;
    // Activate the function on instantiation
    this.someCommand();
};

Widget.prototype.someCommand = function() {
    clearInterval(this.int_someCommand);
    this.int_someCommand = setInterval(this, 'someCommandLoop', 50);
};
Widget.prototype.someCommandLoop = function() {
    trace("THIS IS A WIDGET LOOP!");
}; 




...now, I was always under the impression that if you delete an object in Flash, the setInterval loops associated with it would die as well. But when I try to:


PHP Code:



// At some other point in my timeline...
delete someVar; 




or:


PHP Code:



someVar = new Object(); 




...the original loop is still running (I can tell just by reading the trace). How do I go about properly terminating a setInterval loop inside an Object without having to call a clearInterval()? Or is a clearInterval() the only way?

Thanks.

View Replies !    View Related
How Accurate Is GetTimer()?
I'm working on a tetris clone and I'm trying to decide on the top of scoring system to implement. I think I'm going to go with a score that depends on the time it takes for the tetris piece to reach the bottom of the screen.
Anyways, my question is how accurate is GetTimer()? A lot of stuff is happening indepedent of the timeline FPS, so if I assigned the value of GetTimer() to a variable once I drop a new tetris piece and then subtracted this from the value of the same tetris piece once it stops falling, am I going to get an accurate measure of the time it took for the tetris piece to fall?

View Replies !    View Related
[F8] Specifying More Accurate Cuepoints?
Hey all,
Im trying to call a function at certains beats in an mp3. To do this I want to use cue points and to type them manually for control. However, I cant get the timing more accurate than in seconds using actionscript, it doesnt seem to understand sat 2.5 as opposed to 2. Maybe the syntax is wrong? This is the code I am using to do it.


var aCuePoints:Array = [{cue:3, msg:"Cue point 1"},
{cue:5, msg:"Cue point 2"},
{cue:7, msg:"Cue point 3"},
{cue:9, msg:"Cue point 4"}
]

var sndMusic:Sound = new Sound();
sndMusic.loadSound("Neverending.mp3", true);

var nCuePointCheck:Number = setInterval(checkCue, 1000);

function checkCue():Void{
for(var i:Number=0; i<aCuePoints.length; i++){
if(aCuePoints[i].cue == Math.floor(sndMusic.position/1000)){
trace(aCuePoints[i].msg);
break;
}

}
}

As you can see the cue points are at 3, 5, 7 seconds etc but i need them inbetween.

Any help would be MUCH appreciated!
I dont know any XML either and embedding them into the movie makes them difficult to alter.

View Replies !    View Related
More Accurate Slider
Hi

I'm trying to make a slider that is very accurate. Currently, I have one that is 300 pixels wide, and I'm using the offset of the hand (._x) property to determine where the handle is. Clearly, the large the slider, the more accurate it gets.

But I need more accuracy with a slider the same size. I need more significant digits. As it stands, if I were to display the percentage of the slider position (offset / 300px), it gives me .33, .66, 1, 1.33, etc. I need more accuracy for what I am doing.

How would I go about doing this? Is there a way I can make is more accurate?

Thanks in advance,
Alexandre

View Replies !    View Related
Number Not Accurate
i=-5

while(i<=5) {
trace(i);
i+=0.1;
}

I'm using MX, but the result not increase 0.1. How to solve it?

View Replies !    View Related
Use Counts Accurate?
kornfused...

I am trying to get a big flash file organized, but when I choose the "Select Unused Items" in the library palette drop down menu, Flash identifies a lot of items which have use counts more than zero in the use count column.

I'm wondering which is correct and why this is happening?

View Replies !    View Related
Accurate Scoring
Id like to track a user score after they drag a series of objects to the correct location. Ive come up with the following way but this solution increases and decreases the score simply if the mouse is clicked on the object. Does anyone know of a way to prevent this?

Ive attached a sample to clarify what I mean.

Thanks

View Replies !    View Related
Accurate Hit Counter
Hi,

I'm in the process of creating a hit counter (number of visitors counter) using Flash. I already seen the PHP based counter here on kirupa.com but it is not accurate enough as it will increment upon each page refresh. I would like to get a more accurate statistic about the number of different visitors rather than the number of page loads.

What I was thinking about was getting and storing the IP addresses and only incrementing the counter if the IP address is not yet known. This will give a higher accuracy but is still not perfect. Does anyone have any better idea?

Many thanks in advance for your help!

View Replies !    View Related
Can't Get Accurate Mc Height
Hi

I am attempting to put a vertical menu bar, each made up of a text fields inside a mc. The mcs and text create fine, but I am having "FUN" trying to position them vertically.

In the snippet below you can see that I go round a loop and format the mcs etc - all works. However, when I use trace(linkBtn._height) I get the same value for every button and some are right, some are wrong.

Strangley If I pick one specific button out using the if(i==6) {... it tells me a different height (which happens to be correct)

What's going on? And more importantly, how do I get the correct heights.

Thanks in advance

Edward



Code:
for (var i:Number = 0; i < RootNode.childNodes.length; i++) {
//get the text for the designMenu links
linkText = RootNode.childNodes[i].firstChild.nodeValue;
if (i == 0) {
designMenu.text = linkText;
designMenu.setTextFormat(btnRollOff_fmt);
designMenu.antiAliasType = "advanced";
designMenu.embedFonts = true;
trace(i + "=" + designMenu._height);
} else {
//bring in a movie clip that will form the link
var linkBtn:MovieClip = attachMovie("link_mc", "linkBtn" + i, getNextHighestDepth()); linkBtn.createTextField("linkTxt", getNextHighestDepth(), 0, 0, 169, 0); linkBtn.linkTxt.setNewTextFormat(btnRollOff_fmt); linkBtn.linkTxt.autoSize = "left";
linkBtn.linkTxt.wordWrap = "true";
linkBtn.linkTxt.border = "true";
linkBtn.linkTxt.antiAliasType = "advanced";
linkBtn.linkTxt.embedFonts = true;
linkBtn.linkTxt.text = linkText;
trace(i + "=" + linkBtn._height);
if (i == 6) {
trace("number" + i + "=" + linkBtn._height);
}
}
}

View Replies !    View Related
[MX] Very Accurate HitTest
I require a accurate hitTest for my movie.

I have 2 odd shaped movie clips, a "ball" and a "square" (with a bit cut out).

I need to know if the two movies are over lapping. The problem is I can find this out using the following AS



ActionScript Code:
<font size="2">//on the ball movie cliponClipEvent(enterFrame){       if (this.hitTest(_root.square))    {        trace("hits the square");    }}</font>



When I do this it gives the trace when overlapping the Binding Box and I need it to be very exact over the actual shape and contours of the Movie Clip.

Your help would be very much appreciated.

View Replies !    View Related
Accurate Scoring
Id like to track a user score after they drag a series of objects to the correct location. Ive come up with the following way but this solution increases and decreases the score simply if the mouse is clicked on the object. Does anyone know of a way to prevent this?

Ive attached a sample to clarify what I mean.

Thanks

View Replies !    View Related
Accurate Buttons?
Basically I have a button that when you mouse over plays a movie clip. WHen you mouse out, the movie clip stops playing. However, no matter what combinations on rollover, dragover, dragout, I am finding that sometimes if you move fast enough over the button the on dragout, mouseout whatever combinations don't work and the movie clip still plays, even if you are no longer over the button.

I've seen in several sites features like this (its very commonly used), but how do they get theirs to work in all situations?

Any help would be appreciated!

View Replies !    View Related
Accurate Representation
I have a flash file which has a canvas size of 1024x768. Some elements in the background are much larger than that. When playing this file via the published html file on 1024x768 screen resolution, some of it i cut off obviously due to the toolbars and such and when playing with higher screen resolutions, the aforementioned background isn't cut off at 1024x768. Is there a script or a different way of publishing which will provide an accurate representation of what the file will actually look like when played in full screen mode via the web?

View Replies !    View Related
HitTest Not Too Accurate
Okay, creating a game where one object hits another. When I simply say

object1.hitTest(object2)

hitTest registers true even in cases where the objects aren't touching. As long as they're near each other, a hit is registered. So I tried

object1.hitTest(object2._x,object2._y,true);

This reverses things. Now, the two objects don't register a hit in situatiions that they should. They need to hit each other really well. Any ideas how to make the collisions more accurate? Thanks in advance.

View Replies !    View Related
Tween Class, Does It Use Setinterval? Getting Strange Setinterval Type Problem
I have a gallery with small thumbnails. Upon clicking a thumbnail, I am using the Tween class to pull clips from an array and fade them between each other, loading the clips into a container.

When I click the thumbnail it loads the .swf fine and plays the Tween Class animation just as it's supposed to, however if I click any other thumbnail and go back to that first one the timing gets totally screwed up and the fades get jittery and overlap each other, much like it does with setInterval if you don't clear the intervals.

Is there a way to clear the Tween Class? Does it's timer run on setInterval?


This is the code I am using for the tween class


Thanks!


Code:
import mx.transitions.Tween;
import mx.transitions.easing.*;

//content movieclips put into an array
var mcArray:Array = new Array(content1, content2);
for (var k in mcArray) {
mcArray[k]._alpha = 0;
}

// tween class has something called "OnEnterFrameBeacon" and it is added to the stage
// when we import the as file, so I wanted to get rid of it.
var n:Number = 0;

function playFades() {
if (n<mcArray.length) {
var tween_handler1:Object = new Tween(mcArray[n], "_alpha", Strong.easeIn, 0, 100, 1, true);
tween_handler1.onMotionFinished = function() {
//trace("motion finished by "+mcArray[n]);
//n++;
var tween_handler2:Object = new Tween(mcArray[n], "_alpha", Strong.easeIn, 100, 0, 3.5, true);
tween_handler2.onMotionFinished = function() {
//trace("motion finished by "+mcArray[n]);
n++;
playFades();
};
};
} else {
n = 0;
playFades();
}
}
playFades();

View Replies !    View Related
Is GetTimer Actaully Accurate
Im using GetTimer in my movie, but it seems to fluctuate.

Should it be completely accurate, or can it vary like the framerate does?

Anyone else notice this, or is it something Ive done wrong?

View Replies !    View Related
How Can I Provide ACCURATE HitTesting?
i hav my "level" mc and my "character" mc. each frame the variable "fall", with equals 10, is added to "character"'s _y. but if the character is like 4 pixels above the level, the character lands 6 pixels in the ground. does anybody kno how 2 prevent this? im using this code on the level:
onClipEvent (enterFrame) {
with (character) {
if (level.hitTest(_x, getBounds(_root).yMax, true)) {
_y -= fall;
}
}
}

View Replies !    View Related
Bandwidth Profiler, Is It Accurate?
Is the bandwidth profiler accurate, in terms of its 56k setting? It seems a fair bit slow. If not what is a good average bytes per second on a 56k connection.

Also, if anybody knows the average bytes per second for a DSL and Cable connection. On average

Thanks

View Replies !    View Related
To Pull Only The Accurate Amount.
I am with a small problem, is the following one, I have my main file that this calling 10 swfs external, example in frame 1 calls one swf, in frame 150 calls another one, in frame 230 calls another one and thus it goes until completing the 10 swfs, I am using something thus for each swf "tran1_mc.loadMovie(_root.i11)", in the HTML if I to place 10 swfs it pulls normal, all certainty so far, but if in my HTML to say only it to pull 3 swfs, it pulls these 3 swfs and the remaining portion is blank, what necessary to make it is when to finish to show to this 3º swf it comes back to the first one, somebody has an idea of as I can make this?

View Replies !    View Related
Xmouse And Ymouse Not Accurate
I have a problem... I have a game that's getting rather complex, and I'm switching the controls over from a keyboard method, to a mouse method. The idea is to have the character's rotation automatically adjusted so he's always facing the mouse. (Which I've got working fine)

The problem is, the mousex and mousey are not updating properly. How I'm pulling the information is like this:
code:
onClipEvent(load) {
_root.cursor = new Object;
_root.cursor.interval = function() {
_root.cursor.x = _root._xmouse;
_root.cursor.y = _root._ymouse;
updateAfterEvent();
}
setInterval(_root.cursor, "interval", 1);
}


Now, when I put this movieclip & script in to a new fla that doesn't have the processing overhead that my game does, the cursor.x and cursor.y stay updated just fine (because it's updating them every 1 miliseconds, instead of at the normal frame rate). However, when it's in my game, If I move the mouse quickly, I can "leave flash behind", meaning that my cursor is across the screen, yet flash still thinks that the mouse is still sitting idle where I just left it.

This isn't just a matter of flash "catching up" because of processor load, because I can sit there forever and the variables will not update. I have to move my mouse around for it to return the correct data.

What I am assuming is happening, is that the _xmouse and _ymouse variables only update themselves when flash notices the mouse has moved, and if the processor is busy with other things, the _xmouse and _ymouse might not update. Am I correct in this? And if so, is there a way to force flash to update it's _xmouse and _ymouse variables, regardless of whether flash thinks the mouse has moved or not?

Has anyone else had a problem like this?

Thanks,
Chris

View Replies !    View Related
Frames Not Accurate When I Play The .fmw
Hi, I have a problem when I export my movie. First, I will explain what the fmw contains.

Two chapters (chapter one works fine)
In the second chapter I have:
background sound (me speaking)
background video
Images and video clips up in the corner.

This might sound like alot, especially since I have a big video, but listen to the problem first. What I want to do is that the pictures and images in the corner should appear at the exact moment when I say certain stuff. So I moved them in the layers and previewed the chapter each time to get it exactly right. Later, when I previewed the entire .fmw including the first chapter everything was totally out of sync by many seconds. I did a bit of checking, and as it turned out, the images doesnt appear at the correct place when I only preview the second chapter. So I tried to put the second chapter in a seperate file and export it standalone, but even then it doesnt appear correctly. The images only appear on the exact frame when I export it together with the first chapter, which makes it impossible to keep working on it since I dont want to watch through the first chapter for every time I test it.

Oh, another thing I noticed is that the problem lies in that the images appear too late. Which means, if I want to switch images after 120 frames (10 seconds), it might actually switch after 148 frames (12 seconds) when I play the preview of chapter 2.

View Replies !    View Related
Limits Of Accurate Timing?
Hi, I'm trying to create a drum machine.

To do this I need to be able to accurately trigger drum sounds every sixteenth note, or around once every 125ms, even more often at higher tempos.

I've created a timer at this interval to play the sound, but even with some error correction I read about (checking against getTimer and compensating) it's pretty inaccurate.

Is there any way to reliably play sounds at this small interval?

Thanks for any help!
Brian

ps. I'm new to making internet apps. If this is beyond what Flash is designed to do, are there other products/languages that could handle this?

View Replies !    View Related
100% Accurate Countdown Timer?
Hi,

BACKGROUND
I need to make a countdown timer in Flash that will countdown in seconds to the next whole hour and then will reset and countdown to the following next hour
The timer needs to be 100% accurate.

QUESTION
Is it possible to create a countdown timer in actionscript which will be perfectly accurate - ie. will always be identical when compared with actual rea-life time, irrespective of the hardware, processing of applications done on a client machine?

If this is not possible, is it possible to include in the code a detection of when the timer becomes inaccurate and then further code to get it back on track to correct the inaccuracy?

Any code examples/links to tutorials regarding above issues would be greatly appreciated.

Thanks

View Replies !    View Related
Accurate Preloader For FLV Streaming
Hi Everyone,

I'm working on accurate preloader for FLV video... The problem is that since it's streamed video it starts to play once it buffers enough of it (usualy around 8% to 15%)... So this 8% to 15% is the 100% of the loader bar but since it's changes from video to video I'm trying to find out how I can get this percentage before hand to estimate total size of preloading segment... Is there any way to do it in AS 2.0 (or AS 3.0)? How much of the FLV does Flash needs to preload to start playing video?

I'm using Flash CS and AS 2.0 for this project...

Any hints, thoughts, links and resources will be greatly appreciated...

Thanks for your time,
Peter

View Replies !    View Related
BitmapData.hitTest() How Accurate?
I am using BitmapData.hitTest() and want to know why it is not accurate.
and the next question will be, how to make it accurate.


Code:
public static function pixelHitTest(mc1:MovieClip,mc2:MovieClip):Boolean {
var mc1bd:BitmapData = new BitmapData(mc1.width, mc1.height, true, 0);
mc1bd.draw(mc1);
var mc2bd:BitmapData = new BitmapData(mc2.width, mc2.height, true, 0);
mc2bd.draw(mc2);
if (mc1bd.hitTest(new Point(mc1.x, mc1.y), 0xFF, mc2bd, new Point(mc2.x, mc2.y))) {
return true;
} else {
return false;
}
}


here is the link to show that it is not accurate.
http://www.geocities.com/arian_m3/bitmaphittest.swf

thank you in advance

View Replies !    View Related
Accurate Collision Detection (AS3)
i draw some random shaped on a movie clip using MovieClip.graphics tools. now i want to detect collision of that shape with another movie clip.

hittestobject() on movieclip only does the bounding box detection. can anyone help me to do more precise detection as bounding box detection is useless in my case.

View Replies !    View Related
Strange: If Evaluation Not Accurate...?
I'm observing a strange occurrence. When I evaluate for the following:
Code:
//Create Logo Holder & Position
if(Stage.width > 210 && Stage.height > 210){
_level0.attachMovie("Logo", "LogoClip1", 1, {_x: 0, _y: 0});
_level0.LogoClip1._alpha = 50;
}
else{
_level0.attachMovie("LogoTile", "LogoClip2", 1, {_x: -15, _y: 5});
_level0.LogoClip2._alpha = 50;
}
I would assume that if my movies dimensions we set to 209 x 209, my second case would execute. However, after some testing I've determined the result is that case 1 will not execute until my movie dimensions are set to 311 x 311. This is weird.

Below is my entire move script:
Code:
//Disable Context Menu
Stage.showMenu = false;

//Set Stage
Stage.scaleMode = "noScale";
Stage.align = "TL";

//Import path
var vidPath = path;

//Create Logo Holder & Position
if(Stage.width > 210 && Stage.height > 210){
_level0.attachMovie("Logo", "LogoClip1", 1, {_x: 0, _y: 0});
_level0.LogoClip1._alpha = 50;
}
else{
_level0.attachMovie("LogoTile", "LogoClip2", 1, {_x: -15, _y: 5});
_level0.LogoClip2._alpha = 50;
}



function positionLogo1(clip) {
clip._x = Math.round((Stage.width/2)-(215/2));
clip._y = Math.round((Stage.height/2)-(60/2));
}

//Create HolderMC & Load sample
var j:MovieClip = this.createEmptyMovieClip("Holder_mc",0);
var mcl:MovieClipLoader = new MovieClipLoader();
var mcl_listener:Object = {};

mcl_listener.onLoadInit = function(target_mc:MovieClip) {
target_mc._visible = true;
positionLogo(_level0.Logo);
}

mcl_listener.onLoadProgress = function(target_mc:MovieClip,bl:Number,bt:Number) {
trace(target_mc + " has loaded: " + bl + " of total: " + bt);
}

mcl.addListener(mcl_listener);
mcl.loadClip(vidPath,j);

positionLogo1(_level0.LogoClip1);

stop();
But I don't see what could be causing that kind of oddity.

Any clues?

View Replies !    View Related
100% Accurate Countdown Timer?
Hi,

BACKGROUND
I need to make a countdown timer in Flash that will countdown in seconds to the next whole hour and then will reset and countdown to the following next hour.
The timer needs to be 100% accurate.

QUESTION
Is it possible to create a countdown timer in actionscript which will be perfectly accurate - ie. will always be identical when compared with actual rea-life time, irrespective of the hardware, processing of applications done on a client machine?

If this is not possible, is it possible to include in the code a detection of when the timer becomes inaccurate and then further code to get it back on track to correct the inaccuracy?

Any code examples/links to tutorials regarding above issues would be greatly appreciated.

Thanks

View Replies !    View Related
Flv Seek Control Not Accurate
i am trying to write a function that will play a segment of an flv.

I am using a blank movie clip called "timer" to keep track of things and pause the video at the appropriate time


ActionScript Code:
var my_nc = new NetConnection();
my_nc.connect(null);
var ns = new NetStream(my_nc);
vid_holder.attachVideo(ns);
function loadvideo(what, startTime) {
    vid_holder.attachVideo(ns);
    ns.play(what+".flv");
    ns.onStatus = function() {
        ns.seek(startTime);
        ns.onStatus = null
    };
}

function playToFrom(file, startTime, endTime) {
    loadvideo(file, startTime);
    timer.onEnterFrame = function() {
        currentTime = ns.time;
        if (currentTime>=endTime) {
            ns.seek(endTime);
            ns.pause();
            this.onEnterFrame = null;
        }
    };
}

it seems when i call

ActionScript Code:
playToFrom("game1", 10, 15);
it seeks to 10.99 (almost a second late)

does anyone have any information or a link that might be helpfull.

thanks.

View Replies !    View Related
++ Most Highly Accurate Preloader ++
Anyone know any links/.flas/examples of preloaders that you think are very accurate???

View Replies !    View Related
To Pull Only The Accurate Amount.
I am with a small problem, is the following one, I have my main file that this calling 10 swfs external, example in frame 1 calls one swf, in frame 150 calls another one, in frame 230 calls another one and thus it goes until completing the 10 swfs, I am using something thus for each swf "tran1_mc.loadMovie(_root.i11)", in the HTML if I to place 10 swfs it pulls normal, all certainty so far, but if in my HTML to say only it to pull 3 swfs, it pulls these 3 swfs and the remaining portion is blank, what necessary to make it is when to finish to show to this 3º swf it comes back to the first one, somebody has an idea of as I can make this?

View Replies !    View Related
What's More Accurate? GetTimer Or On EnterFrame?
Hello everyone,

I’m creating a video editor in flash. In the timeline I use getTimer and setInterval to measure the time. My question is: is this accurate enough. If not what should I use.

I tested onEnterFrame and setInterval together, onEnterFrame is taking longer to get to 5 seconds.

Maxgrafx

View Replies !    View Related
Preloader - Works But Not Accurate...
Hello, I made the preloader from the tutorial on this site...
The one that shows a bar and a percent of what is loaded...

It works but the bar will be about half way across when it says it is at like 80%...

Is that just processor lag or something?

Here is the site...
http://www.videolinktechnologies.com/new/

Thanks...

View Replies !    View Related
100% Accurate Countdown Timer?
Hi,
BACKGROUND
I need to make a countdown timer in Flash that will countdown in seconds to the next whole hour and then will reset and countdown to the following next hour
The timer needs to be 100% accurate.
QUESTION
Is it possible to create a countdown timer in actionscript which will be perfectly accurate - ie. will always be identical when compared with actual rea-life time, irrespective of the hardware, processing of applications done on a client machine?
If this is not possible, is it possible to include in the code a detection of when the timer becomes inaccurate and then further code to get it back on track to correct the inaccuracy?
Any code examples/links to tutorials regarding above issues would be greatly appreciated.
Thanks

View Replies !    View Related
Accurate Timing Function
I'm writing a function that basically imitates the Timer Class in AS3 but minimizing the discrepancy between intervals (see here). The problem is that the minimal discrepancies there are with this function have a cumulative effect and I need the timer to stay as close to on the beat as possible rather than getting slightly further away each time.
So i need a way to reset the timer to where it should be if there are any discrepancies. The basic code is:


Code:
function timer(i:Number, n:Number) {
var timeNow:Number;
var timeLast:Number = 0;
var c:Number = 0;

root.addEventListener(Event.ENTER_FRAME, gen);
function gen(e:Event):void {
timeNow = getTimer() - timeLast;
if (timeNow >= i) {
timeLast = getTimer();
c += 1;
trace(c+", timeNow: "+timeNow);

if (c == n) {
root.removeEventListener(Event.ENTER_FRAME, gen);
}
}
}
}
timer(1000, 0);
I've tried a couple of different ways of adjusting the next interval if the timer runs slow to set it back on track but i can't seem to get anything to work.

Any help much appreciated

View Replies !    View Related
++ Most Highly Accurate Preloader ++
Anyone know any links/.flas/examples of preloaders that you think are very accurate???

View Replies !    View Related
To Pull Only The Accurate Amount.
I am with a small problem, is the following one, I have my main file that this calling 10 swfs external, example in frame 1 calls one swf, in frame 150 calls another one, in frame 230 calls another one and thus it goes until completing the 10 swfs, I am using something thus for each swf "tran1_mc.loadMovie(_root.i11)", in the HTML if I to place 10 swfs it pulls normal, all certainty so far, but if in my HTML to say only it to pull 3 swfs, it pulls these 3 swfs and the remaining portion is blank, what necessary to make it is when to finish to show to this 3º swf it comes back to the first one, somebody has an idea of as I can make this?

View Replies !    View Related
100% Accurate Countdown Timer?
Hi,

BACKGROUND
I need to make a countdown timer in Flash that will countdown in seconds to the next whole hour and then will reset and countdown to the following next hour
The timer needs to be 100% accurate.

QUESTION
Is it possible to create a countdown timer in actionscript which will be perfectly accurate - ie. will always be identical when compared with actual rea-life time, irrespective of the hardware, processing of applications done on a client machine?

If this is not possible, is it possible to include in the code a detection of when the timer becomes inaccurate and then further code to get it back on track to correct the inaccuracy?

Any code examples/links to tutorials regarding above issues would be greatly appreciated.

Thanks

View Replies !    View Related
Accurate Collision Detection
Last edited by Nutrox : 2004-12-01 at 13:21.
























Hi guys.


This is another one of those "could I be doing this better" kinda questions

I need to work out accurate collision detection between objects in a 2D game. I am using hitTest() to check for collision between objects but this has it's limits and problems.

The main problem is that the objects are moving and they could be over-lapping each other when hitTest() returns true, and I need to avoid that over-lapping.

The way I'm doing this at the moment is to check for a collision using hitTest() and then running a loop that "reverses" the objects position until hitTest() returns false (at which point the two objects will appear to be touching and not on top of each aother).

Here's a simple example of how this is working... mcA is moving from left to right.. mcB is static.


ActionScript Code:
this.onEnterFrame = function():Void
{
    mcA._x += 10;
 
    if(mcA.hitTest(mcB))
    {
        while(mcA.hitTest(mcB))
        {
           mcA._x -= 0.5; // shift mcA until no hitTest is found
         }
     }
}

The problem is I'm a bit worried that doing things that way will eat up CPU if there are quite a few objects on screen. Each object will be able to move in any direction so there will be a lot of checking to do.


Does anyone know of any other techniques/methods that could be used for accurate detection?


Cheers.
Si ++

View Replies !    View Related
To Pull Only The Accurate Amount.
I am with a small problem, is the following one, I have my main file that this calling 10 swfs external, example in frame 1 calls one swf, in frame 150 calls another one, in frame 230 calls another one and thus it goes until completing the 10 swfs, I am using something thus for each swf "tran1_mc.loadMovie(_root.i11)", in the HTML if I to place 10 swfs it pulls normal, all certainty so far, but if in my HTML to say only it to pull 3 swfs, it pulls these 3 swfs and the remaining portion is blank, what necessary to make it is when to finish to show to this 3º swf it comes back to the first one, somebody has an idea of as I can make this?

View Replies !    View Related
Frame-accurate FLV Control?
Quick question for the FLV gurus - I have an applicaiton that plays video clips sequentially, as soon as the last frame of video 1 ends, video 2 starts, loops for a variable number of times, then loads video 3, etc. Each transition is seamless.

This can be accomplished easily by embedding the flv's on a timeline, but of course I would prefer to control everything with script. My problem is I have not been able to get frame accurate results - for example if I need video #2 to start playing as soon as the last frame of video #1 ends, I get small pauses if I use either the netStream.onStatus or netStream.time methods to check for the end of the first video.

This is an DVD-ROM disc-based project so there is no issue of network latency, although of course the videos do need to be loaded into memory so they can start playing immediately. Again, loading them into a movie clip's timeline seems to work, but was just looking for a purely code-based approach if possible.

Thank you.

View Replies !    View Related
How Can I Make 'accurate' Mouse Over Buttons?
Can someone tell me how to make 'accurate' mouse over buttons?

em... well what I mean is this:

I can make a button... put it onto scene one and assign it mouse over and mouse out actions...

But the thing is... if you move the mouse really fast... you can miss the mouse out action... and leave the button in a state of mouse over.

I've seen it in plenty of places... where they've got some kind of 'thing'! that makes the state of a button change when mouse is out... regardless of how fast you move the mouse over.

Does anyone know what I'm talking about!?

Check out http://www.maloman.com - kewl site!

The buttons he has have the working that I want.
[Where the picture changes on the left hand side but goes back to original picture if the mouse is moved away.]

If anyone can fathom what I'm ranting on about, I'd really appreciate any help/pointers.

Thanks.


Jam

View Replies !    View Related
Mc Doesn't Play/stop Accurate
check this site
www.pasha.be

in the mean movie there's an equalizer on the bottom (right).

if you push the x the clip stops, that's okay

if you push 1 (loop1) the clip starts playing, but if you push it twice, the clip stops again...

anyone?

View Replies !    View Related
Accurate Rollovers (newb Question)
How do I draw out a box to do accurate rollovers like an image map in dreamweaver?

View Replies !    View Related
[F8] Accurate Video Buffer Percentage
Hey guys,

I'm a little stumped trying to get my buffer percentage correct for progressive flv's.

One of the workarounds that I've tried but are not quite good enough to publish is that when the video's status is switched to "buffering" I calculate the average bit rate of the video based on what has come before.

This however is not accurate enough.

Does anyone have a spot on way of doing this?

Regards,

Stu

View Replies !    View Related
Accurate/Hackproof Timer Possible In Flash?
Hi,

I am a Flash novice and am intending to get a Flash professional to develop an application which is a trivia game that will ask questions and allow users to pick the correct answers.

The time from when a user starts a particular game to the time that they finish the game needs to be recorded by the Flash player.

As I will be giving prizes to the winners of the competition - I need the application to be extremely accurate in the time recording process on the clients computer by counting down the number of milliseconds that each user takes to complete a a game.

The potential issues that I am aware of regarding developing an accurate timer:
a. Software applications and game speed adjusters designed to slow down/quicken Flash applications
b. Speed and RAM of different computers might produce inconsistencies

Is it possible to develop a timer in Flash that is:
i) very accurate (to millisecond level)
ii) hack proof - ie: not able to be manipulated by software or other hacking tricks
iii) will run consistently on different types of computers with different hardware configurations

* I do not want to use the server's time because if a user has a slow connection or the server is slow this will not produce accurate results.

Your thoughts and advice will be much appreciated!!

View Replies !    View Related
Building An Accurate Clock/timer?
I'm trying to build a countdown timer using setInterval. I have it set to call the necessary function once per second.

Unfortunately, the timer falls behind about 3 seconds per minute. This is just in a bare bones test that I wrote -- I wouldn't be suprised if it dragged even more on the final application. I tested this on another computer and the results were the same.

I need a more accurate timer. Is there a better way to go? (Without making calls to the server?) I guess I could play around with the interval settings (once every 800 milliseconds or such) but that's such a hack.

View Replies !    View Related
Whas Is The Most Accurate Way To Make A Metronome
I'm sure this has come up in one form or the other.. In terms of music, the timing in flash is horrible. 1ms may not make much of a difference visually, but when it's syncronizing to music, the tiny flaws add up.

So, what's the most accurate way to time events? I tried doing getTimer() at the start of the routine, and finding the difference per 1ms and checking how many hald notes fit in that time. Works, but still, I wish there was an accurate clock to begin with.

The other thing I thought of, was to use the onSoundComplete, since for some programs (like max/msp) audio rate processing is more accurate. I tried looping a 1ms wav file, only to find out that the sound can only loop at a max rate of.. well, muh larger than 1ms intervals. But atleast it's pretty steady.

Anyone have any ideas?

View Replies !    View Related
Copyright © 2005-08 www.BigResource.com, All rights reserved