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
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; } };
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
How about?: trace(_parent.preloaded); if(_parent.preloaded ){ this.gotoAndPlay(31); }else{ this.gotoAndPlay(_currentframe-1);
Yes I?m gonna try that, but Lost is now on Televsion. Back after soon after Lost!!
[quoted text, click to view] >How about?: >trace(_parent.preloaded); >if(_parent.preloaded ){ >this.gotoAndPlay(31); >>}else{ >this.gotoAndPlay(_currentframe-1); >}
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 :)
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
Here?s some cut and paste: _level0.preloaded = false (Thats correct, when the animation is done preloaded is set to false)
Then try: if(_level0.preloaded){ this.gotoAndPlay(31); }else{ this.gotoAndPlay(_currentframe-1); }
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 " %";
[quoted text, click to view] >if(_level0.preloaded){ >this.gotoAndPlay(31); >}else{ >this.gotoAndPlay(_currentframe-1); >}
trace(_level0.preloaded); says: The output window says: undefined undefined undefined undefined undefined
Is there any debbugger that can view what?s happen runtime on webb, or on my local server IIS?
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.) :-)
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;
Don't see what you're looking for? Try a search.
|