[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

_level3.gotoAndPlay(11);

Posted on 2006-06-07
7
Medium Priority
?
262 Views
Last Modified: 2012-06-21
I have main.swf with lots of buttons wich loads different swfs at the same level. to be more eye candy, i've placed a "rollout"  effect in every movie that is going to be loaded, begining on frame 11. that rollout effect should take place everytime the user select a different movie from wich is beeing shown. i hope you understand, my english is lousy.
so every button has the following action (and it works):

on (rollOver) {
_level3.gotoAndPlay(11);
}
on (release) {
if (_framesloaded >= _totalframes) {
loadMovieNum("newmovie.swf",3);
}
}

It works but it's a bit weird, so i'd like the both actions take place " on (release) ". Bu when i do this:

on (release) {
_level3.gotoAndPlay(11);
loadMovieNum("newmovie.swf",3);
}

this -> _level3.gotoAndPlay(11); -> doesn't happen. it skips that part and doesn't give me any error mesage.

How could i make this both things work under "on release"?

Thanks.

0
Comment
Question by:rpadua
  • 4
  • 2
7 Comments
 
LVL 19

Expert Comment

by:Montoya
ID: 16860813
rpauda,

if you're going to check for frames loaded and include them in a runtime effect, I would suggest preloading everything first. It is very possible that your button is not doing anything because the condition is false. You can test that within your if statement by just adding some traces.

if (_framesloaded >= _totalframes) {
trace("true");
loadMovieNum("newmovie.swf",3);
}else{
trace("false");
}

that will tell you if its even loaded. If you're getting false, then it would be best to just preload your assets so the user is not left waiting for a response. Does that make sense?


0
 
LVL 34

Expert Comment

by:Aneesh Chopra
ID: 16862238
Hi,

fix to your problem is here:

1.
copy following code on last frame where rollOut effect finishes..
---------
loadMovieNum(_level3.nextSWF,3);
--------

2.
add following code on button release
--------
on (release) {
  if (_framesloaded >= _totalframes) {
   _level3.nextSWF = "newmovie.swf";
   _level3.gotoAndPlay(11);
  }
}
----------

you are done...


Rgds
Aneesh
0
 

Author Comment

by:rpadua
ID: 16866733
none of the comments worked :\
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
LVL 34

Expert Comment

by:Aneesh Chopra
ID: 16866754
comments should work....
it depends that if you have implemented it right way...


ok ignore my previous comments...
here is another approach, which should be simpler to implement:
----------
just put following code on button release
---------
on (release) {
      _root.nextSWF = "newmovie.swf";
      _level3.gotoAndPlay(11);
      _root.onEnterFrame = function()
      {
            if (_level3._currentframe == _level3._totalframes)
            {
                  loadMovieNum(_root.nextSWF, 3);
                  delete _root.onEnterFrame;
            }
      };
}
-----------


Rgds
Aneesh
0
 

Author Comment

by:rpadua
ID: 16866792
you're not understanding.

BEFORE the button load a new movie, it should play the movie that is stoped on screen, since frame 11, and then, load the new movie.

and i can't just add the loadmovie action at the last frame when rollout finishes because, i donno wich movie the user wants to load after that one.

hope this will help...
0
 
LVL 34

Expert Comment

by:Aneesh Chopra
ID: 16867315
Dear,

you are not understanding the provided code..

the action "loadMove" on last frame is actually loading the swf which is being received dynamically on button click..

if you will notice... in place of swf name a vriable is passed, which  will hold the name of swf..

and button click update this variable with the swf name, and plays the rollout animation, when it reaches the end, it loads the swf which has been passed as variables....

if still not clear, i would request please upload all related source, I will do it for you...
0
 
LVL 34

Accepted Solution

by:
Aneesh Chopra earned 500 total points
ID: 16875501
Ok,

problem in your code:

1.
you are publishing for Flash player 5..
You must have to publish the music.fla for Flash player 6 alleast....

2.
remove "unloadMovieNum(3);" from last frame of all sub movies and just put a "stop();" action

3.
copy below code on button 1
---------------
on (release) {
      if (_root.nextSWF != "album1.swf")
      {
            _root.nextSWF = "album1.swf";
            if (_level3 != undefined)
            {
                  _level3.gotoAndPlay(11);
                  this.onEnterFrame = function()
                  {
                        if (_level3._currentframe == _level3._totalframes)
                        {
                              loadMovieNum(_root.nextSWF, 3);
                              delete this.onEnterFrame;
                        }
                  };
            } else
            {
                  loadMovieNum(_root.nextSWF, 3);
            }
      }
}
----------------

4.
similary replace all buttons code with above code, just change swf name for each button
for example, here is code for second button
---------
on (release) {
      if (_root.nextSWF != "album2.swf")
      {
            _root.nextSWF = "album2.swf";
            if (_level3 != undefined)
            {
                  _level3.gotoAndPlay(11);


                  this.onEnterFrame = function()
                  {
                        if (_level3._currentframe == _level3._totalframes)
                        {
                              loadMovieNum(_root.nextSWF, 3);
                              delete this.onEnterFrame;
                        }
                  };
            } else
            {
                  loadMovieNum(_root.nextSWF, 3);
            }
      }
}
---------

Rgds
Aneesh
0

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
Suggested Courses

612 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question