all groups > flash actionscript > september 2005 >
You're in the

flash actionscript

group:

This should be a easy task for a actionscript programmer?


This should be a easy task for a actionscript programmer? highlander_1
9/7/2005 5:56:29 PM
flash actionscript: ...but now I?ve posted this question in the correct "forum" :o

Once again here?s the problem:

This should be a easy task for a real actionscript programmer:

Here:
1. After the preloader animation for "myExternal.swf" is done
2. I want myMc in myMain.swf to play a short animation (a light tweening with
a 3 seconds short sound)

3. In my External.swf movie - "preloaded" is set to true after the content is
loaded.
4. In myMc I have the following condition i frame 30:

this.onEnterFrame = function(){
//The preloader if done
if(_parent.preloaded == true){
//Next frame where my animation and sound starts
this.gotoAndPlay(31);
}else{
//Previous frame
this.gotoAndPlay(currentframe-1);
}
delete this.onEnterFrame;
};


This does not work.
And if the light animation in myMc is playing correct (after the preloader
animation is done or "preloaded" is set to true),
the sound doesn?t. The sound always a plays a short piece (milliseconds), on
and on, like if it?s stuck or hanged up.
Why?

Note:
The sound seems always harder to manage with actionscript then tweenings and
so on.
I?ve tried foor-loops but then the movie instead was stoped

Forgive me for my english.

I appreciate any answer or suggestions of how to solve te problem


Re: This should be a easy task for a actionscript programmer? NSurveyor
9/7/2005 6:01:12 PM
Your code is a bit screwed up. You are using the gotoAndPlay previous frame
method (which you did incorrectly) and onEnterFrame for looping the code. Just
use:

stop();
this.onEnterFrame = function(){
//The preloader if done
if(_parent.preloaded){
//Next frame where my animation and sound starts
this.gotoAndPlay(31);
delete this.onEnterFrame;
}
};
Re: This should be a easy task for a actionscript programmer? highlander_1
9/7/2005 6:24:25 PM
Oh, my god - I?ve tried everything, even this screwed up code.
.:o

But now the animaion is stoped.
The loaded movie never runs, even if "preloaded" in
the debugger is showing a boolean value of true.

Please, take a look.
Click on Gallery and then click on the second row and first picture out of 6
in the 3D-rotating menu.
I?m trying to solve the problem where the preloader animation is playing
before the light animation.

http://www.goodwill.se/peter


Re: This should be a easy task for a actionscript programmer? NSurveyor
9/7/2005 6:35:25 PM
How about?:

trace(_parent.preloaded);
if(_parent.preloaded ){
this.gotoAndPlay(31);
}else{
this.gotoAndPlay(_currentframe-1);
Re: This should be a easy task for a actionscript programmer? highlander_1
9/7/2005 7:03:42 PM
Yes I?m gonna try that, but Lost is now on Televsion.
Back after soon after Lost!!
Re: This should be a easy task for a actionscript programmer? highlander_1
9/7/2005 8:05:00 PM
[quoted text, click to view]

Thank?s for answer, but do you or someone else
know what is going on here:

The debugger tells me "preloaded" is set to true.
But here?s what the trace action output window says:
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined

:)
Re: This should be a easy task for a actionscript programmer? NSurveyor
9/7/2005 8:55:05 PM
Hmm.. perhaps you are not scoping correctly... try:

if(preloaded){
this.gotoAndPlay(31);
}else{
this.gotoAndPlay(_currentframe-1);
}

Go to List Variables. Find preloaded, and post it's path, ie:
_level0.something.preloader
Re: This should be a easy task for a actionscript programmer? highlander_1
9/7/2005 9:12:45 PM
Here?s some cut and paste:
_level0.preloaded = false

(Thats correct, when the animation is done preloaded is set to false)

Re: This should be a easy task for a actionscript programmer? NSurveyor
9/7/2005 9:15:44 PM
Then try:

if(_level0.preloaded){
this.gotoAndPlay(31);
}else{
this.gotoAndPlay(_currentframe-1);
}

Re: This should be a easy task for a actionscript programmer? highlander_1
9/7/2005 9:19:32 PM
Here?s the preoloader action from the ExternalMovie.swf loaded inot a mcClip
called mcHolder in Main timeline in Main.swf

laddat = int(this.getBytesLoaded()/this.getBytesTotal()*100);
if (this.bar._currentframe == 100) {
this.gotoAndPlay(10);
//So the preloader animation is done before GlowClose
//animaton is started
_parent.preloaded = true;
} else {
this.bar.gotoAndStop(laddat);
}
procent = laddat add " %";

Re: This should be a easy task for a actionscript programmer? highlander_1
9/7/2005 9:25:23 PM
[quoted text, click to view]

trace(_level0.preloaded); says:

The output window says:
undefined
undefined
undefined
undefined
undefined
Re: This should be a easy task for a actionscript programmer? highlander_1
9/7/2005 9:36:35 PM
Is there any debbugger that can view what?s happen runtime on webb,
or on my local server IIS?
Re: This should be a easy task for a actionscript programmer? highlander_1
9/7/2005 9:52:42 PM
Wait!!
-Now I see there is something wrong here - I?m working on this "lead",
and hope I manage to solve the problem before the sun arise tomorrow
at 05.00 here in Sweden.
(But I feel allready like a "junkie" in my head.)
:-)
Re: This should be a easy task for a actionscript programmer? highlander_1
9/8/2005 7:27:23 PM
I must create a function with event "this.onEnterFrame"
and use "_parent."
But thanks to "NSurveyor" for taking your time!
Your answer "trigged" me to continue and not change direction
to a more complex solution or whatever "to much programming".

Here?s the working code:
this.onEnterFrame = function(){
trace(_parent.preloaded);
trace("frame 30");
if(_parent.preloaded == true){
trace(_parent.preloaded);
this.gotoAndPlay(31);
}else{
this.gotoAndPlay(29);
//this.gotoAndPlay(_currentframe-1);
}
delete this.onEnterFrame;
};
:):beer;
AddThis Social Bookmark Button