Go Back   kirupaForum > Flash > Flash CS3

Reply
 
Thread Tools Display Modes
Old 11-26-2009, 12:46 PM   #1
windofdeath
Registered User
AS2: publishing bug thing?

heya all. sorry for my poor english at some points but i think your able to understand my problem anyways.

the project:
i made a project at wich i have a stage with 3 layers.

1. actions layer ( guess whats in here hehe)
2. a layer with a movieclip with the instance name "test"
3. a layer with 3 buttons. with the following instance names: knop1, knop2, knop3

when i load the flash app. my actionscript will create a movieclip inside the test MC. this movie clip is called movie + i ( a counter variable).

the first movie will be called movie0.
in movie0 ill load an image with loadMovie ('imagename', 'movie0');

on a press of 1 of the buttons, a new MC gets made ( movie1), new image gets loaded in to that.

the layer above that ( still movie0) is fading out with the following loop:

HTML Code:
test["movie"+i].onEnterFrame = function(){
		if(test["movie"+(i-1)]._alpha<=0) {
			trace('succes');
			delete this.onEnterFrame;
			removeMovieClip('test.movie'+(i-1));
			doneLoading = true;
		}		
		else {
			test["movie"+(i-1)]._alpha -= 10;
		}
	}


the strange thing:
the whole animation works PERFECT when testing it in flash with ctrl+enter.
it takes half a seccond till the image is faded. ( my FPS is set to 20)

but when i publish the movie, the first time i press a button it takes 0.5 seccond. the next it takes 0.25 , the one after takes 0.125 etc etc.

how is this possible? i had it with another app aswell? is it a bug in my flash maybe? the teacher giving me simple workshops in flash didnt know why it was, and he checked my publishing settings wich were all correct.

for an example of the app:
http://crimsonred.nl/flash/test.swf ( PS. its all .png files, so it takes a while before the new image is loaded in, didnt make a loader function yet since i first want to fix this problem, allso the test["movie"+(i-1)]._alpha -= 10; is set to -= 1; instead of 10 to make a more clear example)

thanks for helping in advance
windofdeath is offline   Reply With Quote

Sponsored Links (Guests Only) - Register | Need Help?
 

Old 11-26-2009, 01:07 PM   #2
glosrfc
Registered User
 
glosrfc's Avatar
Location Halley Research Station, Latitude 75°35' S, Longitude 26°39' W, Brunt Ice Shelf, Coats Land, Antarctica

Posts 4,159
Quote:
Originally Posted by windofdeath View Post
but when i publish the movie, the first time i press a button it takes 0.5 seccond. the next it takes 0.25 , the one after takes 0.125 etc etc.
Are you using setInterval in your code anywhere? This type of behaviour is typically exhibited when you don't clear the interval, i.e.
setInterval is fired...
...something happens...
another setInterval is fired...
...something else happens...
BUT..the original thing is still happening...

The problem is worse if your movie is playing. For example, you have a setInterval call every second in frame 12 and your movie is running at 12fps.
The first time the setInterval is called, things seem to be fine. But, 1 second later, the playhead reaches frame 12 again, so another interval is created. Meanwhile, 1 second has passed since the first interval fired, so it fires again. Now you have TWO intervals operating usually half a second apart.
When frame 12 is reached, a third interval is created but the original interval fires after 1 second too. And so does the second interval. Now the interval length is cut to one quarter of a second apart.
After just a few seconds, you can easily end up with a lot of intervals running, and each time the interval delay is cut by half, i.e. 1 second, 0.5 seconds, 0.25 seconds, 0.125 seconds

A similar thing can happen when the movie is playing and the onEnterFrame is continually being called. You start with one onEnterFrame, playhead hits the frame containing your actionscript...you have two onEnterFrame events. The playhead hits the frame containing your actionscript again...you have three onEnterFrame events. And so on. Try inserting a stop(); in your actionscript and then use play(); only once you're sure that all of the images have been loaded.

__________________
©2006 GlosRFC - Searching 8,168,684,336 brain cells

Last edited by glosrfc; 11-26-2009 at 01:11 PM..
glosrfc is offline   Reply With Quote
Old 11-26-2009, 01:09 PM   #3
windofdeath
Registered User
nopes not using any

i ut the fla online.
its a CS3 file:

http://www.crimsonred.nl/flash/poging1.fla

i know its not verry ordened and stuff but well im kinda new to flash ehehe
windofdeath is offline   Reply With Quote
Old 11-26-2009, 01:13 PM   #4
glosrfc
Registered User
 
glosrfc's Avatar
Location Halley Research Station, Latitude 75°35' S, Longitude 26°39' W, Brunt Ice Shelf, Coats Land, Antarctica

Posts 4,159
I can't access CS3 files so I can only give you an idea of what the cause might be. Have you checked the edit I made though..read the last paragraph.

__________________
©2006 GlosRFC - Searching 8,168,684,336 brain cells
glosrfc is offline   Reply With Quote
Old 11-26-2009, 01:17 PM   #5
windofdeath
Registered User
if(test["movie"+(i-1)]._alpha<=0) {
trace('succes');
delete this.onEnterFrame;
removeMovieClip('test.movie'+(i-1));
doneLoading = true;
}

when i remove the remove movieclip thing and the delete this.onEnterFrame, it keeps tracing succes
and when i put 1 of both back in, it only returns the trace('succes') once.
so i doubt thats the problem heren :S..


if you want i can post the full AS?
windofdeath is offline   Reply With Quote
Old 11-26-2009, 05:47 PM   #6
windofdeath
Registered User
found the problem.
when i put compress movie off, it seems to solve it for some reason. strange :S

never mind. it still freaks out. just takes longer till it starts :S
24 button presses to be exact.

http://crimsonred.nl/flash/poging1einde.html <-- new example of the app

Last edited by windofdeath; 11-26-2009 at 06:17 PM..
windofdeath is offline   Reply With Quote
Old 11-26-2009, 06:09 PM   #7
glosrfc
Registered User
 
glosrfc's Avatar
Location Halley Research Station, Latitude 75°35' S, Longitude 26°39' W, Brunt Ice Shelf, Coats Land, Antarctica

Posts 4,159
Glad you solved it...and yes, it does seem strange. Are you publishing for FP 6 or higher?

__________________
©2006 GlosRFC - Searching 8,168,684,336 brain cells
glosrfc is offline   Reply With Quote
Old 11-26-2009, 08:21 PM   #8
windofdeath
Registered User
flash player 9.

some guy on another forum wrote a whole new code for me in 10 minutes ( damn i wanna be able to do that too /jealouse) his code works fine.

its like... same base. but he typed it a lot cleaner, and loaded the images from an array instead of from just variables. might just be the thing...
windofdeath is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:51 PM.

SUPPORTERS:

kirupa.com's fast and reliable hosting provided by Media Temple. flash components
Creative web apps. Make your own free flash banners and photo slideshows.
Check out the great, high-quality flash extensions. Buy or sell stock flash, video, audio and fonts for as little as 50 cents at FlashDen.

Flash Transition Effects

Flash Effect Tutorials

Digicrafts Components
Flash effects. Art without coding. Upload, publish, deliver. Secure hosting for your professional or academic video, presentations & more. Screencast.com
Streamsolutions Content Delivery Networks Flipping Book - page flip flash component.
Flash-Gallery.com - Get your flash photo gallery (flash component or swf gallery Learn how to advertise on kirupa.com
 

cdn
content delivery network (cdn)

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd. Copyright 2010 - kirupa.com Copyright 2010 - kirupa.com