PDA

View Full Version : Re:Simple But complicated Bug !



twodanimator
July 24th, 2007, 11:08 AM
Hi All,
I have a main file called main.swf whcih contains an empty movie clip to load an SWFiles externally. And I have one more ordinary SWFile which contains navigation to go through 4 pages by clicking Next and Back buttons. if i open this ordinary file alone, it works, i mean Next and Back buttons work fine. Whereas after loading it in the main file, there also it works. But the bug is, if you click on either Next or Back button without moving your curser away, you will come to know that nothing is happening. if you move your curser a bit away and click it, it works. i gave the code on the button(s) is

on(release){
gotoAndStop(next/prevFrame());
}

- is there anything wrong with the code? it would be great of you, if you help me.

Thanks and regards,
Babu.

twodanimator
July 25th, 2007, 05:35 AM
No one knows the answer/ solution, my dear programmer(s)!? ;( Atleast is this right place where i can put my question or anything wrong with me??

-Babu

rabidGadfly
July 25th, 2007, 12:20 PM
Your post is a bit confusing. If you can zip and post your code you'll probably get some useful replies.

small_guy
July 25th, 2007, 12:57 PM
Up front, I agree with rabidGadfly's comment that this is a little confusing in terms of what it is you've got versus what it is you would like to be doing. That said, I will take a stab at this:

I assume this is the problem: you've got an external swf with Next and Back buttons. When you are working just within that file the Next and Back buttons work fine as they should but when you load this external swf into your main swf suddenly the Next and Back buttons are not working? Is that the issue?

If so...when you load an external swf into a main swf the coding for the external swf has to take into account that it is now operating through the main fla/swf. In other words, it is no longer a separate swf entity but is tied to the fla/swf into which it is loaded. In the gotoAndStop action, as you have it, Flash/ActionScript is trying to apply that (as you have it) to the main timeline in the main fla. So you need to instruct Flash which timeline it is that you want to apply the gotoAndStop command to. Even though the button you are adding code to and the timeline you want to control via the button are both within the external swf, the issue has become more complex once the external swf is loaded into the main fla.

First I would put your code on a frame instead of on the button itself.

Second it would read something like this (on the frame) --- let's assume, for this example, that the name of your external swf is book. The main fla name is unimportant because you will refer to as _root in the code. The name of your button is Next.

next_btn.onRelease = function () {
_root.book.gotoAndStop(nextFrame);
}

In essence you are telling the Next button in the loaded/external swf that it needs to go back to the _root timeline of the main fla. From there it needs to find the loaded in/external swf named book. From there it needs to then execute the gotoAndStop(nextFrame); command. (In this example case I am assuming that the content that is on your next and previous frames is on the main timeline of your loaded in swf.)

Be aware that if you then try to test the loaded in swf directly (not going through the main fla) that it will not work because this is now set-up through the main fla.

I hope this helps.


Hi All,
I have a main file called main.swf whcih contains an empty movie clip to load an SWFiles externally. And I have one more ordinary SWFile which contains navigation to go through 4 pages by clicking Next and Back buttons. if i open this ordinary file alone, it works, i mean Next and Back buttons work fine. Whereas after loading it in the main file, there also it works. But the bug is, if you click on either Next or Back button without moving your curser away, you will come to know that nothing is happening. if you move your curser a bit away and click it, it works. i gave the code on the button(s) is

on(release){
gotoAndStop(next/prevFrame());
}

- is there anything wrong with the code? it would be great of you, if you help me.

Thanks and regards,
Babu.