Jump to content
Search Community

Error button

final^^ test
Moderator Tag

Recommended Posts

hmmm, I don't know what else to try....

The error indicates a problem with the gotoAndPlay command, which doesn't make sense, but it could be something before that.

Again, grasping at straws...

Delete the function in frame 25 and paste in some code that works from a different frame.

Rename the 'back button' instance, and put the new name in the code.

Add semi-colons at the end of all the lines of code.

Link to comment
Share on other sites

I am looking at this again too and can not replicate the error.

 

at the bottom of your script on frame 1 please add

trace("Version = " + TweenLite.version);

 

and let us know what version displays in the output panel. thanks

Link to comment
Share on other sites

These code are all taken from another workable back button from the other 4 place.I have rename the button instances and codes and it still produce the same error for me.

 

The version is Version = 11.698

 

Here I have done, I duplicate the title_mc on frame 1(just copy and paste from the stage), and then I try goes in IS and then click back button and it works without any error. Is it a bug??does flash allows duplicate instance and object on same frame?

Edited by final^^
Link to comment
Share on other sites

I can't figure out why duping that MC would fix the problem, but yes, Flash does allow multiple instances of an object using the same instance name. If you tend to use code in your Flash, its a bad idea to do so (the code will only address one instance), but it won't produce a runtime error.

Link to comment
Share on other sites

I also does not know why it would fix this problem,The code work for the new duplicate title_mc on stage while the old title_mc stay on the stage without moving anything but once i delete the old title_mc on the stage error will occur.

Link to comment
Share on other sites

The new dup was hide while the old title_mc is still there and when click in IS and then back button, no title was there(new and old).

 

BTW, I try to hide the old title_mc with your code,after going in IS and back from there it generates this error:

the button is being click!
[object backbtn1_45]
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at interactive_fla::MainTimeline/frame1()[interactive_fla.MainTimeline::frame1:17]
at flash.display::MovieClip/gotoAndPlay()
at interactive_fla::MainTimeline/onClick4()[interactive_fla.MainTimeline::frame25:12]

then no button can be click.

Edited by final^^
Link to comment
Share on other sites

I'm out of suggestions for fixing your file.

FWIW, if this were my project, and it weren't much more complex than this, I'd take a different approach. The basics would be something like this, but you'd have to adapt it for your project:

Instead of using the timeline to navigate everything, put your various screens into movieClips. Put all those MCs on Frame 1 and use the 'back' button to hide the MCs that you don't want to see at any given time.

When you are animating your buttons, if they have the same parameters, you can share the functions by specifying the target of a Mouse Event like so:

function onRolloutMain5(e:MouseEvent):void

{

TweenMax.to(evt.currentTarget, 0.5, {scaleY:1, scaleX:1});//evt.currentTarget (instead of the instance name of the button).

}

 

To hide the MCs, place all but the current in an array then call a function to hide all the members of the array:

IE

var mcsToHide:Array;// Function requires an array
var mcsToShow:Array;
function onClickBtnName(e.MouseEvent):void
{
mcsToHide = [thisMC, thatMC, theOtherMC];
mcToShow = [theMCWeWantToSee];
fadeMe (mcsToHide, 0,0,0); // Or use a gradual fade by changing the numbers.
fadeMe (mcsToShow, 0,1,0);
}

function fadeMe(dobj:Array, duration:Number, inOut:Number, delayNum:Number):void
{
//TweenMax.to(dobj,duration,{autoAlpha:inOut,delay:delayNum});// Will turn off visibility, but code wouldn't see buttons!
TweenMax.to(dobj,duration,{alpha:inOut,delay:delayNum});// Won't turn off visibility
}//End fadeMe

Study the docs to understand this code. It is skeletal and would need to be beefed up if you were doing more stuff in your animation. For example, if you had more animation, you would also need to pause/resume your tweens when hiding/showing things.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...