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








Perfect Setinterval?


I want a piece of code to activate every 1000 milliseconds. However, when I check with getTimer() how many seconds actually pass between activating the function, i get a lot of 1000's but also a lot of 1009's and 1050's. How can I rewrite my function here to get it perfect?


Code:
sitime = new Object();
setInterval(sitime, "interval", 1000);
sitime.interval = function() {
box2._x+=1
lasttime = marktime;
marktime = getTimer();
timepassed = marktime-lasttime;
trace(timepassed);
updateAfterEvent;
};




ActionScript.org Forums > ActionScript Forums Group > ActionScript 1.0 (and below)
Posted on: 04-27-2006, 05:54 PM


View Complete Forum Thread with Replies

Sponsored Links:

SetInterval & LoadMovie - Not Perfect 2gether?
Using Flash MX

Heres the deal:

I have a Flash MX movie called movie1.swf . In this movie theres a setInterval call that calls a function every 8 seconds. I've tested this movie on it's own and it works fine. Basically what the setInterval does is call an image from an array every 8 seconds, fades it in, then fades it out. Bottom line is that it works fine and this movie works great on it's own.

Heres where the problem begins, when I load movie1.swf (the movie above) into another swf multiple times it begins to act whacky. Basically I have a movie we'll call root.swf. When I use loadMovie and load movie1.swf into root.swf the first time everything works fine. movie1.swf is eventually unloaded (depending on the users menu choices) using unloadMovie. Now when movie1.swf is loaded back into root.swf (in the same session) the setInterval starts to go alot faster then it did the first time around - its as if when the movie1.swf is unloaded it's setInterval call isn't cleared and it keeps running - so when movie1.swf is called back in and setInterval begins again theres 2 running or something.

Are there any known issues about this? I'm trying to find stuff on macromedia.com but no luck yet. If anyone has had this problem and can offer any solutions I'd appreciate it - I'd rather use setInterval in 1 frame instead of motion tweening a bunch of graphics through hundreds of frames but it looks like I'll have to do that for now until I can figure out whats going on. Oh and there are no setInterval calls in the root.swf or any other swf thats loaded into root.swf besides movie1.swf.

Thanks

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
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
PERFECT
thanks a lot!!

dirtysirus

View Replies !    View Related
This Is Perfect
Just what I need!

I've been doing lessons and tutorials (like the ones that come with Flash MX) that seem to assume you already know where everything is and can easily find it.

Someone pointed me in the direction of THIS website today, and most of the tutorials I looked at seem basic enough for me.

I need PICTURES and where something is! Not just "go to_________ and set this" etc.

I did a button tutorial and actually got it to work,(2nd try) but had to import sound from my Coffee Cup html editor- which went into the FLASH library, and I found it and dragged it onto the work area, with the frame I wanted it in selected.

Amazingly it worked! I had little choice of sounds and picked on that sounds like a cash register. One I could have picked was a cow MOO.

Either I couldn't figure out where to find the sounds in FLASH (going by the tutorial, which even had pictures) or, the tut was for another version of FLASH?

I've noticed this a few times, something won't be where the tutorial says, or will be a little bit different. Which usually stops me, but I find another to try and will get back to it.

One thing that stumped me in one, that seemed to have good, clear directions was in one place it was adding a button (to stop the action) and had a script to copy/paste. It said "add the script to (one of) the frames". Without any clue as to HOW one adds a script?

Since then I have seen clues about this, so maybe either adding a keyframe and right clicking (for options and a place to paste the script) or just right clicking and finding options?

Plan to go back and try it again at some point.

But that's what I mean about the tutorials, some of them will say "select a certain frame and add the sciript to it". (for example) like how on earth do you do THAT?

I look in all the tools and right click everything I can think of and look in FLASH HELP (Index) etc.

Some things I have worked out on my own. Some I gave up on for now.

I've been interested in this for a long time, but haven't really gotten into learning it till last week. And I think it's kind of addictive

I've been sitting up till 1-2 AM (like I did when I was learning to make webpages, finding all the ways it didn't work) Just trying to get something to WORK!

I got a ball to bounce across the screen. And a button to click. And also a ball to go around a word, but it does't go behind it on one side. I got confused with that, too. I think I have the idea, though. You have to delete the frames (on one of the layers)so the ball does't SHOW when it goes over that part.

I don't know how much I'm learning but I'm starting to feel a little smarter

And it's such a great feeling to finally get something to work!

One more question (for now) when it's done, I save it and publish it- do I have to copy all the layers onto one? (ONE tutorial I did said this at the end) THEN save it and click PUBLISH.

When I got to my html editor to upload it, there are 3 files with the name of the flash. One is the html one, one is the fla file and I don't know what the other is. Maybe the image in some way?

I have discovered all 3 have to be uploaded for it to show on the webpage.

So, I guess that answers my own question about that.

I have to get off this computer and get something else done, and see if I can still walk.

~ Carrie

View Replies !    View Related
The Perfect Fade
praystation has the perfect fade but i have tried many ways to get this...scripting etc. does anyone know how......

View Replies !    View Related
Help With The Perfect Menu
I've been searching for just the right nav for a site I'm building for a non-profit free of charge. Bit of a flash newbie so flashkit has been great. I came across my ideal menu at www.weca.net Does anyone know if they did this in-house or if an agency created it? Anyone have a similar menu laying around?

Please e-mail if you can help! Thanks! kp003a4345@blueyonder.co.uk

View Replies !    View Related
Ummm... Its Not Perfect
http://www.delaforcephotoworks.com/weddings.html

btw 56k ers please be aware that there is a full song to be loaded... may take some time!

thats what i have, it works great, but its not exactly how i want it
currently everything loads into a container_mc and the slideing pannel is ontop of that in another layer... but when you click the buttons below just for a split second you see the background miage... how do i get the slider to go over the image 1st and then change . that way it allows a smooth flow between images

View Replies !    View Related
Making Perfect Gif
i want make perfect gif file from my swf.......
Bcause currently i am not not getting gif file which is animating as
good as swf and also good colors too.......

what should be the properties in publish setting for perfect gif file

View Replies !    View Related
The Perfect Preloader?
Is it possible to really preload the entire movie?

I ask this because some of the stuff I am doing, the preloader will completely load, play for about 2 seconds and have a slight pause or seem jumpy. My file sizes range from 10k - 35k.

Does anyone know what might be causing this?

Thanks so much for your help!

/z

View Replies !    View Related
Picture - Not Perfect
Hi all!!
something strange is happening to my images. My image files are in movie clips and I use an easing equation in AS2 to tween them into the stage.

When I test the moving using Control - test, the images are displayed perfectly. But when I export the swf and view the movie in IE7, the images are all jagged and distorted.

Any suggestions? anyone? will be much appreciated!

Cheers!

View Replies !    View Related
Perfect Circles?
In the Flash IDE, is it possible to draw perfect (or at least better than the circle tool) circles? I ask because I'm applying math-based physics to an arc and it doesn't quite match up to the visuals in the background.

View Replies !    View Related
The Perfect Rollover
Hi, i'm not so familiar with as3 but i decided to take the step and forget as2.
I am now trying to make perfect rollovers. Not the play over on rollover and play out on rollout but play forward on rollover and play backwards on rollout.
Why? because if you have a long animation on that rollover and you go quickly over the button with your mouse the forward and backward technique is the only way to have something that doesn't skip frames.
I found some code on this forum that did almost what i wanted :

var whoami:MovieClip;
var over:Boolean;
over = undefined;

button1.addEventListener(MouseEvent.MOUSE_OVER,ove rHandler);
button1.addEventListener(MouseEvent.MOUSE_OUT, outHandler);
button2.addEventListener(MouseEvent.MOUSE_OVER,ove rHandler);
button2.addEventListener(MouseEvent.MOUSE_OUT, outHandler);
button3.addEventListener(MouseEvent.MOUSE_OVER,ove rHandler);
button3.addEventListener(MouseEvent.MOUSE_OUT, outHandler);
button4.addEventListener(MouseEvent.MOUSE_OVER,ove rHandler);
button4.addEventListener(MouseEvent.MOUSE_OUT, outHandler);



function overHandler(e:MouseEvent):void {
over = true;
whoami = MovieClip(e.currentTarget);
whoami.addEventListener(Event.ENTER_FRAME, playForwards);


if (over) {
whoami.dispatchEvent(new Event("overEvent",true, false));
}
}

function outHandler(e:MouseEvent):void {
over = false;
whoami = MovieClip(e.currentTarget);
whoami.addEventListener(Event.ENTER_FRAME, playBackwards);
}

function playForwards(e:Event):void {
if (over == true) {
whoami.nextFrame();
}
}
function playBackwards(e:Event):void {
if (over==false) {
whoami.prevFrame();
}


I liked that code very much because the same functions are used for all the buttons (overHandler,outHandler,playForwards and playBackwards) but it had a bug : when you go quickly from one button to the other, the animation doesn't have time to finish and the previous button the mouse was on stops in a position between the over and out state.
I fixed this making different functions for each button and i'm quite happy with that but now the code is much longer and if there are more buttons it will get even longer :


var over1:Boolean;
var over2:Boolean;
var over3:Boolean;
var over4:Boolean;
over1 = undefined;
over2 = undefined;
over3 = undefined;
over4 = undefined;

button1.addEventListener(MouseEvent.MOUSE_OVER,ove rHandler1);
button1.addEventListener(MouseEvent.MOUSE_OUT, outHandler1);
button2.addEventListener(MouseEvent.MOUSE_OVER,ove rHandler2);
button2.addEventListener(MouseEvent.MOUSE_OUT, outHandler2);
button3.addEventListener(MouseEvent.MOUSE_OVER,ove rHandler3);
button3.addEventListener(MouseEvent.MOUSE_OUT, outHandler3);
button4.addEventListener(MouseEvent.MOUSE_OVER,ove rHandler4);
button4.addEventListener(MouseEvent.MOUSE_OUT, outHandler4);



function overHandler1(e:MouseEvent):void {
over1 = true;
button1.addEventListener(Event.ENTER_FRAME, playForwards1);
if (over1) {
button1.dispatchEvent(new Event("overEvent",true, false));
}
}
function outHandler1(e:MouseEvent):void {
over1 = false;
button1.addEventListener(Event.ENTER_FRAME, playBackwards1);
}
function playForwards1(e:Event):void {
if (over1 == true) {
button1.nextFrame();
}
}
function playBackwards1(e:Event):void {
if (over1==false) {
button1.prevFrame();
}
}


function overHandler2(e:MouseEvent):void {
over2 = true;
button1.addEventListener(Event.ENTER_FRAME, playForwards2);
if (over2) {
button2.dispatchEvent(new Event("overEvent",true, false));
}
}
function outHandler2(e:MouseEvent):void {
over2 = false;
button2.addEventListener(Event.ENTER_FRAME, playBackwards2);
}
function playForwards2(e:Event):void {
if (over2 == true) {
button2.nextFrame();
}
}
function playBackwards2(e:Event):void {
if (over2==false) {
button2.prevFrame();
}
}


function overHandler3(e:MouseEvent):void {
over3 = true;
button3.addEventListener(Event.ENTER_FRAME, playForwards3);
if (over3) {
button3.dispatchEvent(new Event("overEvent",true, false));
}
}
function outHandler3(e:MouseEvent):void {
over3 = false;
button3.addEventListener(Event.ENTER_FRAME, playBackwards3);
}
function playForwards3(e:Event):void {
if (over3 == true) {
button3.nextFrame();
}
}
function playBackwards3(e:Event):void {
if (over3==false) {
button3.prevFrame();
}
}


function overHandler4(e:MouseEvent):void {
over4 = true;
button4.addEventListener(Event.ENTER_FRAME, playForwards4);
if (over4) {
button4.dispatchEvent(new Event("overEvent",true, false));
}
}
function outHandler4(e:MouseEvent):void {
over4 = false;
button4.addEventListener(Event.ENTER_FRAME, playBackwards4);
}
function playForwards4(e:Event):void {
if (over4 == true) {
button4.nextFrame();
}
}
function playBackwards4(e:Event):void {
if (over4==false) {
button4.prevFrame();
}
}


does anybody have an idea to make this code shorter, maybe by using something similar to the previous code but still fixing the bug. I really need to find a way to make a lot of buttons without writing tons of code.
Another thing i'd like is to have a hand cursor on those buttons, i know i can place a transparent button inside the movie clip but i don't like that, i tried to use useHandCursor but couldn't get it to work.

View Replies !    View Related
Picture Perfect
Hey guys...real simple question here!

IN the "cool sites" section there's this post...

http://www.purdesign.ca/

If you enter the flash site you'll notice the big,bright,beautiful background pics
of plants (cool idea)

My question is ...What is the best way to achieve such great looking pictures in Flash?
I've tried photoshop "save for web" gif,png format and jpeg. When imported into flash my pics lose thier vibrance and look "washed"

Anybody?

View Replies !    View Related
Perfect Timing
after much deliberation over my goldfish, I'm lost!
nothing seems to work!?

Just for a test run, I have 2 MC's, 1 is of a bland fish swimming happily, and one is is the same fish, fast asleep... I enter the code,


Code:
onClipEvent (enterFrame) {
time=new Date();
seconds = time.getSeconds()
minutes = time.getMinutes()
hours = time.getHours()

if (time.hours >13) {

gotoAndPlay(2);

}
}
in frame 1... and

Code:
onClipEvent (enterFrame) {
time=new Date();
seconds = time.getSeconds()
minutes = time.getMinutes()
hours = time.getHours()

if (time.hours >14) {

gotoAndPlay(1);

}
}
before even testing, I checked for errors, and the output gave me...

Quote:




**Error** Scene=Scene 1, layer=actions, frame=1:Line 2: Clip events are permitted only for movie clip instances
onClipEvent (enterFrame) {

Total ActionScript Errors: 1 Reported Errors: 1




which threw me off course, So I tried removing the onClipEvent, and well the output was fine, but it was 13:20 and the fish was still awake!?

OK, question time

1) Why wont my fish go to sleep?... (i.e fix my code!!!)

2) At the moment he goes to sleep after 1PM (13 hours)... but what if I want him to sleep at say 1:35 (13 hours, 35 minutes) how would that fit in the code??

THANKS!

View Replies !    View Related
Perfect Circle
After taking Senoculars (wonderful) trig tutorial, I started messing with trig, and came up with a method to make a perfect circle using ActionScript. Check it out!

View Replies !    View Related
The Old Perfect Fade
I'm using the perfect fade for a menu. It's not fading in, it's sliding it. On the rollover, the menu slides out, then the buttons appear at the end.

Everything works fine until I rollover the buttons. They frantically blink on the Rollover. It's almost like the mc is trying to go to the prevFrame but can't.

Anyone know of anyway to make this stop?

View Replies !    View Related
The Perfect Preloader
http://www.versusmediagroup.com/kirupa/preloader/

Okay first off I am not going to even try to take credit for this great preloader. I got it from the Macromedia Developers site and its free there but I have been looking for one that had this much freedom and here it is.

When you open the '.fla' file you will see, in the library, a movie clip called progress_mc. The great thing about this preloader is that you can put whatever animation you want and it will play it as the preloader and it will slow it down as needed. It also playes the entire movie clip so you see it smoothly go all the way threw your animation.

Again i did not create this code here is a link to who did...write him and tell him how much you love him!

http://www.macromedia.com/devnet/mx/...preloader.html

View Replies !    View Related
Perfect Background
This is driving me crazy. Im doin a FBF and I wanna have a 100% picture in the background. Th problem is, when I scale the flash I want the picture to scale "untouched" with it.

Good examples:
http://www.diesel.com/
http://www.gskinner.com/site2_5/

Ok example
http://www.setvariable.com/elastic/

NO GOOD EXAMPLES:
http://www.secondstory.com/
http://www.revolvercreative.com/flash.html

can somebody PLEASE help me - Im goin crazy!!!

View Replies !    View Related
What Is The Perfect Size?
what is the perfect size i should work with? im not too fimilar about sizes and stuff this is going to be for a webpage. Should i be working with a 800x600 template ? and if so does that mean i just set it as 800 x 600 on flash or does it need to be bigger. Kinda confused..like what is the header for the size of this site now? thats the size i need

View Replies !    View Related
Almost Perfect Menu
So I made this perfect menu (at least for me ) it does just what I need:
it can be totally configured with XML, it's horizontal and I can define for each button it's size and position. Even I figured out how to do a separation item.

May I say this is my first script?! Well, the first I do heavy modifications, since it's based on the "squirrell finder".

BUT I just can't make it do the link . I think I'm close, cuase it does open a window, but it comes up that nasty "undefined".

I have burned my eyes agains't the monitor doing this thing, and I'm proud, cause I learned a lot, but when it comes to vars... I'm stupid.

Please help me out. It's late, I need to sleep and I just remembered I have a conference call with a client tomorrow morning (thank god is nor related to this)... and I need to get this done.

I just noticed the link thingy work on a iexplorer window, but it doesn't when I open just the swf.... why is that? O.o?

P.S: if you notice any other wrong thing on this script, please tell, I wan't to learn. Also feel free to use it anywhere you want or do whatever you want with this.

View Replies !    View Related
How To Do A Perfect Load Of A GIF ?
i have a GIF and i want it to be loaded dymanicly from XML with
Code:
loadMovie("url", loader_MC);
there are 2 issues:
the GIF isn't playing. my GIF has 4 stages (frames) but when loaded, it stays only on the first one. i need the GIF loaded and begin looping all 4 frames... what's happeing ?
i want the loader_MC to be resized everytime i resize my Stage. i did this:

Code:
var myListener:Object = new Object ();
myListener.onResize = function () {
loader_MC._width = Stage.width;
loader_MC._height = Stage.height;};
Stage.addListener (myListener);
The GIF appears distorted, turned upside down and the _x axis very wrong and out of page... what's happening, again?

thanks a lot

View Replies !    View Related
Easing But Not Perfect
i add ease for my MC but it doesn't work elasicly. so what is the problem?
here is my code.

ActionScript Code:
cir.onEnterFrame = function(){    this._x = this._x + (_root._xmouse - this._x) * .2;     this._y = this._y + (_root._ymouse - this._y) * .2; }


and here is the i copied from onesome's AS.


ActionScript Code:
cir.onEnterFrame=function(){    if (_root._xmouse == this._x){        this._x += _root._xmouse;        this._y += _root._ymouse;        isFollowing = true;    }else if (isFollowing){        speedx = (_root._xmouse - last_xmouse) * .8;        speedy = (_root._ymouse - last_ymouse) * .8;        this._x = _root._xmouse + speedx;        this._y = _root._ymouse + speedy;        isFollowing = false;    }else{        speedx += (_root._xmouse - this._x) * .8;        speedy += (_root._ymouse - this._y) * .8;        speedx *= .7;        speedy *= .7;        this._x += speedx;        this._y += speedy;    }    last_xmouse = _root._xmouse;    last_ymouse = _root._ymouse;}

but i think this one is so old. and i tried alot.
but i cann't get. any suggestions?

View Replies !    View Related
The Perfect Sounds
Hey.
Most people will argue that the final touch needed to make your site perfect, after you've managed to make it visually appealing that is...
is to make / get / apply the sound effects that make your site stand out.

In my opinion this applies to most everything that has to do with interactivity. Users don't only want to see the effect of their interactions but also hear the effects (especially important in any type of game)...

I dont want to even try to count the hours ive spent on trying to find the perfect sound (given that im not that good at creating them myself).
Most of the sound effects given out as 'Free' are crap and basically the same sound as the next 847345 sites offer...

I was hoping that we... my fellow kirupians, could device the ultimate list to Free or VERY cheap sound libraries (the good ones atleast)...

basically give me you links so i dont have to search so damn much!
(preferably with short description)

Chiao
//VoS

View Replies !    View Related
Perfect Circle
After taking Senoculars (wonderful) trig tutorial, I started messing with trig, and came up with a method to make a perfect circle using ActionScript. Check it out!

View Replies !    View Related
Looking...4 A Perfect Host
no idea where to post this so sorry its most likely in the wonrg place but i'm looking for a host where i can have a custom url, at least one e-mail, no ads, and enough space to handle a complete flash website. the cheaper the better. thanks

View Replies !    View Related
The Old Perfect Fade
I'm using the perfect fade for a menu. It's not fading in, it's sliding it. On the rollover, the menu slides out, then the buttons appear at the end.

Everything works fine until I rollover the buttons. They frantically blink on the Rollover. It's almost like the mc is trying to go to the prevFrame but can't.

Anyone know of anyway to make this stop?

View Replies !    View Related
Perfect Curves....
Last edited by Kindsage : 2004-09-06 at 04:52.
























Friends,
i'd like to know a simple way to create a perfect curving arc between any two points, provided their x and y coordinates are known. By a perfect curving arc, i mean that a curve which bends nicely in the middle and looks proportionate.

I belive i can use the curveTo method to do it and i've tried, but the PCA remains elusive. I'm using Flash MX.

(Need i say, that i'm pretty bad at maths....and this is like really urgent...)

Any help will be much appreciated.

Thanks a lot,
FF

View Replies !    View Related
Perfect Navagation
Does anyone have what they consider to be a perfect navagation
I understand there are many ways to code a nav, but I have never been sure if i have been doing it right.

Main Obstacle Ive run into.
Fast mouseovers may funkify the nav. Where if you mouseOver fast you may trigger onStates that dont go back to offStates. Im guessing if you go to fast flash doesnt detect that you left the button all the time.

And as far as a "perfect" nav, i was thinking...
Mouseover would trigger some simple animation. say a fade of color (fade opposed to a 1 frame hard change)
MouseOut would reverse this action (so it wouldnt just snap back to the original color, it would fade back)
OnState

Ive done all of these in the past through different means but i know some of my code is really old.
Also, ive yet to beat the fast mouseover dilema.

I actually just found this forum. I used to post on werehere and am glad to see that it looks like their is a strong alternate

View Replies !    View Related
Perfect Size And Resoultion For The Web?
what is the ideal resolution/size to set my flash movie stage at for an flash web page, also what sort of % works best when combining html and flash? i think 1% HTML and 99% flash works for me (but then again im crap @ HTML)

View Replies !    View Related
Wanna See The Perfect Preloader?
Me too


Okay, look, as long as you're here, I have a great preloader...sorta....

What I mean is that it does everything I want it too, and works good when used in a scene in the same movie it is loading, but it's not working so good when I load it into an MC, and use it to preload the main movie.

Don't get me wrong--it works, but it is very inconsistent, and normally never shows up until about 30% of the content has already loaded. That might not sound like much, but it's 1/3 of the content. Not really a good preloader, in my opinion.

Anyway, I figure it must be something in the script itself, since I tested it by creating an MC with nothing in it but a white rectangle and a "load movie" action in frame 1 to load the preloader into the MC. Well, I can see the rectangle flash for a second, so I know that the movie has loaded (i.e, replaced it), but it takes a minimum of 10 seconds for the preloader to actually show up after that, after the rectangle has disappeared, and the preloader movie is only 1k.

So, does anyone know why this is happening, and how I can get it to start preloading within the first 10% of the movie, which would be acceptable. However, I'd like to know the secret of getting it to kick in right away, if anyone knows, because I'd like to use it with smaller movies of around 50k or so. Not much use in it though, if 15 or 20k has already loaded before it shows up.

Here is the script I'm using:


totalBytes = Math.round((_root.getBytesTotal())/1024*1000);
loadedBytes = Math.round((_root.getBytesLoaded())/1024*1000);
percentBytes = Math.round((loadedBytes/totalBytes)*100);
if (loadedBytes==totalBytes) {
gotoAndPlay ("Scene 1", 1);
}


The above is placed in frame 1, of the main timeline, and in frame 2 is:

gotoAndPlay (1);

Then, I have a bar percentage loader with this in frame 1:

this._xscale = ((_root.getBytesLoaded() / _root.getBytesTotal())*100);


And this in frame 2:

gotoAndPlay(1);


That's it, and it works great, when it works great, but it isn't that often. Admitedly, I have modified this script several times, but I can't see any flaw in the logic, or in the construction of the movie.

Any ideas? Anybody?

Who knows the secret to the perfect preloader, all purpose preloader? That is to say, without me having to change my entire script. In other words, is there a better way to construct the movie with the above script, or any additional statements that should be included?

There was once an else statement:

if (loadedBytes==totalBytes) {
gotoAndPlay ("Scene 1", 1);
}else {
gotoAndPlay(2);
}

But that didn't seem to work as well as what I have now, where I replaced it with a frame loop instead.


James

He is risen!!!

View Replies !    View Related
A Perfect Circle By AS (This Is A Question Only)
How to draw a perfect circle by curveTo? I looked at the example in the MX reference but it is not that perfect. How, actually, to calculate the coordinates of controlX,Y in respect to the coordinates of anchorX, Y can draw a perfect circle just like drawing one by using drawing tools?

View Replies !    View Related
Perfect Drop Down Menus?
I wanna make a perfectly perfect drop down menu...the only problem I'm facing is the part where the dropped menu list disappears or goes back once the mouse is outside the hit area. I tried many ways but none gave the accurate result...just for reference, I've found an example of the 'perfect' menu...if anyone knows how to make it, then please explain or post up and .fla....a simple example that is....thanks...

Reference:

http://www.daihatsu.co.uk/daihatsu/frameset.do

View Replies !    View Related
Perfect Pixel Fonts....
The quick fix is to publish the movie at LOW Quality. Alternatively......

In our previous attempts, the text appeared perfect for static text, but not for dynamic text boxes( in particular with embedded pixel fonts ).

I didn't know if we could solve the problem because my dynamic text field was burried deep within nested movieclips, and I wasn't sure whether local or global positioning of the text field needed to sit on exact pixel coordinates( whole numbers ), or if the local and global positioning of all nested movieclips needed to sit on exact pixel coords( also ).

Also, I had set the autoSize property of the text field to "center", which would probably result in the _x value of the text field becoming a floating-point number.

On top of this, I was scaling some of the holding movieclips, and I know blurred text and graphics can result from the use of tweens.

It would appear that the local positioning( or when you edit the text field 'through' the library ) of the text field needs to be exact pixels. A holding movieclip that is a direct parent of the text field, also needs it's local position placed on exact pixels. When trimming some of the coords at design time( I did this by just deleting the floating-point part of the _x and _y properties, in the 'Properties' panel ), I noticed that Flash automagically would sometimes add 0.3% to the horiztontal scale( even though I had the horizontal and verticle scale 'Constrained' ). I then removed the extra 0.3%.

Aswell as making these tweaks at design time in the development environment, it was also necessary to tweak the positioning using code that would be run at run-time ( as the User Interface was being built ).

After any point that I altered the text field, or a parent movieclip, I rounded it's position, e.g.:
mcMainMenu_Title.title.autoSize = "center";
mcMainMenu_Title.title._x = Math.round( mcMainMenu_Title.title._x );

NOTE: use of Math.round() may not work properly if you try to pass an experssion

I would be interested to know if others have come across this problem, and if they can use our solution to solve it.

Credit : kode.co.uk

View Replies !    View Related
[Help]'Perfect' Artbased HitTest...
Hey,

I realy need help in making the perfect artbased hitTest. I wan't to do something with my worm's destructably ground engine. Because the ground can get any shape I'm kinda screwed in getting a decent hitTest working.
I´ve already tried this, but everytime there is just 1 thing that screws it up so I had to remove it.
Does anyone has some good advices/samples for me?

SaphuA

PS: Yes, I did read the ReadMe sticky

View Replies !    View Related
Perfect HitTesting? (Flash 5)
Hey guys. I kinda suck at flash ok? I always used the hitTest command to make collision detections between objects. but now I wanna go to something a little harder. Is there a way to tell Flash that I want the collision to be "perfect"?. I mean that it won't be a damn invisible square all around a custom objet that will touch another object. I guess you know what i mean. Anyway even if it exists I hope it's easy to do.

Thx

View Replies !    View Related
Menu Headake Can't Seem To Get It Perfect.
howdy FK, I have this problem with my menu where no matter when im getting to the end of it one of the buttons doesnt work.

download it, give it a try.
im sure its a very simple problem, im just lost!

thanks

View Replies !    View Related
Want To Set A Perfect FPS For Your Flash Movie?
What is the perfect FPS for our Flash Movies? Is it...


12? The standart fps Macromedia Flash sets for us!

25? The standart fps for PAL!

30? The standart fps for NTSC televisions!

24? The fps for movies in theaters!
31? The standart fps Holywood sets for their movies!

36? The standart fps I set for my movies!

48? 60? 72? or more higher more better?


fps stands for frames-per-second.
Frame rate determines how fast and smooth a movie will run.
For example: 12 fps means that 12 frames of the movie will be displayed every second.
15 fps means that 15 frames will be displayed every second.

This does not mean that the Flash movie will always follow the specified fps.
Reasons for running below fps:

the movie is too complex
the computer is too slow
too many programs running at the same time

Think of the fps as a speed limit.
A Flash movie is a good citizen who will never break the limit, but it may run slower than the limit.

Having all these in mind i cant figure out what is the perfect FPS for a flash movie.
So, please spend a litle time of yours to tell about what speed limit (fps) you set for your movies, and why?

Lets start with mine,

I set 36 as the standart fps for my movies. Why..?
I find it doesnt burdon my pc and the movie is running quite smoothly.
But i am still not satisfied because i am not very sure whether this is the perfect fps for a flash movie.. OK, now start writing about yours

View Replies !    View Related
Get Rid Of Gap In A Perfect Sound Loop
Hi, I have sound loop at www.aidanmack.co.uk
Its a perfect loop but flash seems to be putting a gap between the finish and start.
Why is this?

Thanks
Aidan

View Replies !    View Related
Perfect, Non Blurry Text?
Hi folks, can somebody please tell me how to achieve text in your flash site that isnt blurry? I know if you import external txt files your text is far more crisp. I have also been using pixel fonts, but still when I use text in buttons and such like it appears a tad blurry. I have also rounded up the W and H and also the X and Y axis and antialiased the text, but the problem still occurs. I have seen many Flash websites where the text always appears consistantly sharp. I must be missing a trick or so?

Hope somebody can help.

View Replies !    View Related
[F8] Perfect Size For Website
Hey,
I am making an all Flash website, and I was wondering what the concensus is on what the best size is to cater to the middle of the road screen resolution. I don't want to make anything too small just to make sure that people with low screen resolutions can view my site, but at the same time, I want to have it as large as I can. Can I get your guys' opinions?

View Replies !    View Related
Html Text Not Perfect Yet..
Hi,

I'm getting an HTML text from PHP and put it in an textfield in Flash. But the " (quotes) don't show right. Look at: http://www.vlekkie.nl/indexCMS.htm
In php i did convert the text to utf8:
PHP Code:



$rowIntro["Text"] = utf8_encode($rowIntro["Text"]); 




In flash a make this textfield:

PHP Code:



var txtFM:TextFormat = new TextFormat();txtFM.font = "Georgia";txtFM.size = 13;txtFM.bold = false;txtFM.leading = -1;this.createTextField("txtINTRO", 1, 14, 22.9, 370, 425);txtINTRO.html = true;txtINTRO.type = "dynamic"txtINTRO.multiline = true;txtINTRO.wordWrap = true;txtINTRO.htmlText = _root.introTXT;txtINTRO.setTextFormat(txtFM); 




What can i do to get the text right???
I also tried(in php) things like:

PHP Code:



$rowIntro["Text"] = urlencode($rowIntro["Text"]);$rowIntro["Text"] = htmlentities($rowIntro["Text"]); 




But this didn't work either..

Hope someone can help me, thanks in advance..

View Replies !    View Related
Cyan Please HELP The PERFECT POPUP?
Hi Guys

I'm looking to create a popup which opens a "template" html page with an image placeholder. This way you should be able to send a variable from the swf and open up the same html page each time but the image would change as you change the variable from the flash button.

Basically I have flash page containing various thumbnails and when clicked, each one will open a larger version, but I dont want to make a html page for each one so rather 'send' the filename to the html page if this is possible??

there is a similar topic at a java script forum here:

http://www.webmasterworld.com/forum91/725.htm

I was given this:

<html>

<head>
<title>Image viewer</title>
<script>
function loader(){
var my_pic = document.location.search.substring(1);
document.pic1.src = my_pic;
}
</script>
</head>

<body onload="loader()">
<img src="http://www.weav.co.uk/dj/dressing/" name="pic1">
</body>

</html>

but dont really know how to get it all to work.




This is on my button

on (press) {
// customize the window that gets opened
// 0 equals NO.
// 1 equals YES.
address = "myimage.jpg";
target_winName = "popup";
width = 300;
height = 451;
toolbar = 0;
location = 0;
directories = 0;
status = 0;
menubar = 0;
scrollbars = 0;
resizable = 0;
// sends data back to the function
openWinCentre(address, target_winName, width, height, toolbar, location, directories, status, menubar, scrollbars, resizable);
}




and this is on the timeline:

Movieclip.prototype.openWinCentre = function(url, winName, w, h, toolbar, location, directories, status, menubar, scrollbars, resizable) {
getURL("javascript:myWin = window.open('"+url+"','"+winName+"','"+"width="+w+ ",height="+h+",toolbar="+toolbar+",location="+loca tion+",directories="+directories+",status="+status +",menubar="+menubar+",scrollbars="+scrollbars+",r esizable="+resizable+",top='+((screen.height/2)-("+h/2+"))+',left='+((screen.width/2)-("+w/2+"))+'"+"')}else{myWin.focus();};void(0);");
};


I just basically want the swf file to decide which jpeg is to be loaded into the popup.html.

HELP!!!!!!

Sprite

View Replies !    View Related
'The Perfect Tween' - Problematic
Hi all,

This post refers to Joshua Davis' most excellent 'Perfect Tween', available on http://flashtothecore.praystation.com (chapter 08).

I am using it to control 7 different movieclips. I have three pictures of people, three quotes by these people and a introduction quote. What happens is that when you roll over one of the people, the following happens:

- the other two people fade out to 50%
- the intro quote fades to 0%
- the quote associated with the person you're over fades in

I have the people and quotes set up as tweened movieclips with a stop(); in the first and last frame. This is the script I have attached to an invisible 'control' movieclip:


ActionScript Code:
onClipEvent (enterFrame) {
    if (_parent.markOn) { // we've rolled over Mark
        _parent.mark_quote.nextFrame(); // let's fade in Mark's quote
        _parent.introTextAnim.nextFrame(); // fade back the intro quote
        _parent.kevin_mc.nextFrame(); // fade Kevin back
        _parent.darren_mc.nextFrame(); // fade Darren back
    } else {
        _parent.mark_quote.prevFrame();
        _parent.introTextAnim.prevFrame();
        _parent.kevin_mc.prevFrame();
        _parent.darren_mc.prevFrame();
    }
    if (_parent.kevinOn) {
        _parent.kevin_quote.nextFrame();
        _parent.introTextAnim.nextFrame();
        _parent.mark_mc.nextFrame();
        _parent.darren_mc.nextFrame();
    } else {
        _parent.kevin_quote.prevFrame();
        _parent.introTextAnim.prevFrame();
        _parent.mark_mc.prevFrame();
        _parent.darren_mc.prevFrame();
    }
    if (_parent.darrenOn) {
        _parent.darren_quote.nextFrame();
        _parent.introTextAnim.nextFrame();
        _parent.mark_mc.nextFrame();
        _parent.kevin_mc.nextFrame();
    } else {
        _parent.darren_quote.prevFrame();
        _parent.introTextAnim.prevFrame();
        _parent.mark_mc.prevFrame();
        _parent.kevin_mc.prevFrame();
    }
}

The strange thing is, this portion of the code (on it's own) works:


ActionScript Code:
onClipEvent (enterFrame) {
        if (_parent.markOn) { // we've rolled over Mark
                _parent.mark_quote.nextFrame(); // let's fade in Mark's quote
                _parent.introTextAnim.nextFrame(); // fade back the intro quote
                _parent.kevin_mc.nextFrame(); // fade Kevin back
                _parent.darren_mc.nextFrame(); // fade Darren back
        } else {
                _parent.mark_quote.prevFrame();
                _parent.introTextAnim.prevFrame();
                _parent.kevin_mc.prevFrame();
                _parent.darren_mc.prevFrame();
        }
}

It's only when I add in the other bits of code for the other people/quotes that it doesn't work.

I've done the usual tired-been-staring-at-it-too-long stuff like instance names etc. and I've been able to determine that it's picking up whether the variables (markOn, kevinOn and darrenOn) are true or false, and by putting trace() commands in various frames of the individual animations I can see that it plays every one but stops on frame 2 (even if each one has a this.play() command in frame 2).

Does anyone have experience of this or can see anything obvious I'm doing wrong?

Any help much appreciated. It's a great technique when it works!

Thanks,

J

View Replies !    View Related
Perfect Windows Like Cursor?
hi
does anyone has a good (or perfect ) windows like cursor made in flash? I mean the common cursor, but with that little shadow it has, and the shadow with transparency... just like the win2k - xp cursor...
thanksss!

View Replies !    View Related
Audio Perfect In Fla, Out Of Sync In Swf
hi,

The title pretty much describes my problem. I have a couple of sound clips playing on the main time line. The audio and imagery are synced perfectly when I play the movie in flash but when I test my movie (export to swf) the second audio clip is way out of sync (the first one is fine) both are set to stream

I have no idea why this would be happening. both files are the same bit rate, stereo, etc..

View Replies !    View Related
Perfect Drop Down Menus?
I wanna make a perfectly perfect drop down menu...the only problem I'm facing is the part where the dropped menu list disappears or goes back once the mouse is outside the hit area. I tried many ways but none gave the accurate result...just for reference, I've found an example of the 'perfect' menu...if anyone knows how to make it, then please explain or post up and .fla....a simple example that is....thanks...

Reference:

http://www.daihatsu.co.uk/daihatsu/frameset.do

View Replies !    View Related
Perfect Fade/multibuttons
I picked up code for the "perfect fade" a while ago, which I have used for buttons in te past.

The code is as follows.
On the root timeline:

stop();
mc_Bio.onEnterFrame = function() {
if(fade) {
this.nextFrame();
}else{
this.prevFrame();
}
};

On an invisible button :

on (rollOver) {
_root.fade = true;
}

on (rollOut, dragOut) {
_root.fade = false;
}




Now this all works great, but its not too modular, meaning I have to write a fair amount of code for each button.
I'm trying to make it leaner, by having a global function, but I can't get it to work properly... i think due to the enterframe. I've been unable to make it loop, and therefore it only steps forward oneframe, and back one frame.

This is probably a silly question, but anyone have an answer?
I would be quite greatful

View Replies !    View Related
Creating The Perfect Circle
using FlashMX's drawing API here's a simple way to create a perfect circle

you can store this fla and just copy the code into whatever you're doing. change the variables and presto ... you have a circle

the variables are commented so you should be able to easily figure out how you want to change them

i hope this is of use to someone

PHP Code:



_root.createEmptyMovieClip("circle", 500);
lcol = 0xFF0000;
// Line color
fcol = 0xFF9900;
// Fill color
lwid = 5;
// Line width
lal = 90;
// Line alpha
fal = 25;
// Fill alpha
x = 275;
// X-coordinate circle center
y = 200;
// Y - coordinate circle center
R = 100;
// Radius of circle
a = R*0.4086;
// Radius multiplied by constant
b = R*0.7071;
// Radius multiplied by constant
with (_root.circle) {
    lineStyle(lwid, lcol, lal);
    beginFill(fcol, fal);
    moveTo(x-R, y);
    curveTo(x-R, y-a, x-b, y-b);
    curveTo(x-a, y-R, x, y-R);
    curveTo(x+a, y-R, x+b, y-b);
    curveTo(x+R, y-a, x+R, y);
    curveTo(x+R, y+a, x+b, y+b);
    curveTo(x+a, y+R, x, y+R);
    curveTo(x-a, y+R, x-b, y+b);
    curveTo(x-R, y+a, x-R, y);
    endFill();


View Replies !    View Related
Perfect Drop Down Menus?
I wanna make a perfectly perfect drop down menu...the only problem I'm facing is the part where the dropped menu list disappears or goes back once the mouse is outside the hit area. I tried many ways but none gave the accurate result...just for reference, I've found an example of the 'perfect' menu...if anyone knows how to make it, then please explain or post up and .fla....a simple example that is....thanks...

Reference:

http://www.daihatsu.co.uk/daihatsu/frameset.do

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